- Improve project loading speed.

- Compact mode
This commit is contained in:
Tanasart 2023-11-13 18:11:54 +07:00
parent 1573e3d1a6
commit a1b8f26abd
14 changed files with 91 additions and 69 deletions

View file

@ -46,7 +46,7 @@ event_inherited();
var name = __txt(cat.name);
maxLen = max(maxLen, string_width(name));
}
category_width = maxLen + ui(44);
category_width = maxLen + ui(48);
#endregion
function rightClick(node) { #region
@ -283,9 +283,9 @@ event_inherited();
BLEND_OVERRIDE;
if(i == ADD_NODE_PAGE) {
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, _y + hh, category_width, hg);
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, _y + hh, category_width - ui(32), hg);
} else if(sHOVER && catagory_pane.hover && point_in_rectangle(_m[0], _m[1], 0, _y + hh, category_width - ui(32), _y + hh + hg - 1)) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _y + hh, category_width, hg, c_white, 0.75);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _y + hh, category_width - ui(32), hg, CDEF.main_white, 1);
if(mouse_click(mb_left, sFOCUS)) {
setPage(i);
content_pane.scroll_y = 0;

View file

@ -12,8 +12,7 @@ if !ready exit;
#region base UI
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
if(sFOCUS)
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
if(sFOCUS) draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
#endregion
#region text
@ -29,7 +28,8 @@ if !ready exit;
draw_set_text(f_code, fa_left, fa_top, COLORS._main_text);
var _hh = string_height_ext(ctxt[1], -1, dialog_w - ui(64));
draw_sprite_stretched(THEME.ui_panel_inner_bg, 0, dialog_x + ui(24), py - ui(8), dialog_w - ui(48), _hh + ui(16));
draw_sprite_stretched(THEME.ui_panel_inner_bg, 1, dialog_x + ui(24), py - ui(8), dialog_w - ui(48), _hh + ui(16));
draw_text_ext(dialog_x + ui(32), py, ctxt[1], -1, dialog_w - ui(64));
py += _hh + ui(16);

View file

@ -40,7 +40,7 @@ function __initAddon() {
var _str = {
name: f,
path: _path,
meta: _mSrt.meta,
meta: struct_try_get(_mSrt, "meta", {}),
open: false
};

View file

@ -44,11 +44,8 @@ function json_save_struct(path, struct, pretty = false) {
gml_pragma("forceinline");
var s;
if(pretty)
s = json_stringify(struct, true);
else
s = json_stringify_minify(struct);
if(pretty) s = json_stringify(struct, true);
else s = json_stringify_minify(struct);
var f = file_text_open_write(path);
file_text_write_string(f, s);

View file

@ -4,7 +4,7 @@ function drawWidgetInit() {
visi_hold = noone;
min_w = ui(160);
lineBreak = true;
lineBreak = PREFERENCES.inspector_view_default;
}
function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) {
@ -12,13 +12,23 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var xc = xx + ww / 2;
var _font = lineBreak? f_p0 : f_p1;
var breakLine = lineBreak || jun.expUse;
var lb_h = line_get_height(_font) + ui(8);
var lb_y = yy + lb_h / 2;
var breakLine = lineBreak || jun.expUse;
if(jun.type == VALUE_TYPE.text) breakLine = true;
var _name = jun.getName();
var wid = jun.editWidget;
switch(instanceof(wid)) { #region
case "textArea" :
case "paddingBox" :
case "areaBox" :
case "controlPointBox" :
case "cornerBox" :
case "rotatorRandom" :
case "rotatorRange" :
breakLine = true;
} #endregion
var butx = xx;
if(jun.connect_type == JUNCTION_CONNECT.input && jun.isAnimable() && !jun.expUse) { #region animation
@ -217,7 +227,6 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var widH = breakLine? editBoxH : 0;
var mbRight = true;
var wid = jun.editWidget;
if(jun.expUse) { #region expression editor
var expValid = jun.expTree != noone && jun.expTree.validate();
@ -257,8 +266,9 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
switch(jun.display_type) {
case VALUE_DISPLAY.padding : param.h = ui(192); break;
case VALUE_DISPLAY.corner : param.h = ui(192); break;
case VALUE_DISPLAY.area :
param.h = ui(204);
case VALUE_DISPLAY.area : param.h = ui(204); break;
case VALUE_DISPLAY.rotation :
param.halign = breakLine? fa_center : fa_left;
break;
}
break;
@ -266,15 +276,20 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
case VALUE_TYPE.boolean :
param.halign = breakLine? fa_left : fa_center;
param.s = breakLine? ui(24) : editBoxH;
if(!breakLine) {
param.w = ui(128);
param.x = param.x + editBoxW - param.w;
}
break;
case VALUE_TYPE.d3Material :
case VALUE_TYPE.surface :
param.h = ui(96);
param.h = breakLine? ui(96) : ui(48);
break;
case VALUE_TYPE.curve :
param.h = ui(160);
param.h = breakLine? ui(160) : ui(100);
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + param.h))
mbRight = false;
break;

View file

@ -539,16 +539,16 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
} else {
render_cached = false;
var sBase = surface_get_target();
getInputs(frame);
LOG_BLOCK_START();
LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} <<<<<<<<<<");
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
var sBase = surface_get_target();
try {
update(frame); // Update only if input hash differs from previous.
update(frame);
} catch(exception) {
var sCurr = surface_get_target();
while(surface_get_target() != sBase)

View file

@ -255,17 +255,20 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static getInputs = function() { #region
preGetInputs();
process_amount = 1;
inputs_data = array_verify(inputs_data, ds_list_size(inputs));
inputs_is_array = array_verify(inputs_is_array, ds_list_size(inputs));
process_length = array_verify(process_length, ds_list_size(inputs));
var _len = ds_list_size(inputs);
for(var i = 0; i < ds_list_size(inputs); i++) {
process_amount = 1;
inputs_data = array_verify(inputs_data, _len);
inputs_is_array = array_verify(inputs_is_array, _len);
process_length = array_verify(process_length, _len);
all_inputs = array_verify(all_inputs, _len);
for(var i = 0; i < _len; i++) {
var val = inputs[| i].getValue();
var amo = inputs[| i].arrayLength(val);
if(amo == 0) val = noone; //empty array
if(amo == 1) val = val[0]; //spread single array
else if(amo == 1) val = val[0]; //spread single array
amo = max(1, amo);
setInputData(i, val);
@ -287,16 +290,16 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
var amoMax = process_amount;
for( var i = 0, n = array_length(process_length); i < n; i++ ) {
for( var i = 0; i < _len; i++ ) {
amoMax /= process_length[i][0];
process_length[i][1] = amoMax;
}
for(var i = 0; i < ds_list_size(inputs); i++)
all_inputs[i] = array_create(process_amount);
for(var i = 0; i < _len; i++)
all_inputs[i] = array_verify(all_inputs[i], process_amount);
for(var l = 0; l < process_amount; l++) #region input preparation
for(var i = 0; i < ds_list_size(inputs); i++) {
for(var i = 0; i < _len; i++) {
var _in = inputs_data[i];
if(!inputs_is_array[i]) {

View file

@ -28,9 +28,10 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
var _msk = _data[3];
var _msd = _data[4];
inputs[| 4].setVisible(is_surface(_msk));
if(is_surface(_msk) && _msd)
_dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ];
var _maskUse = is_surface(_msk);
inputs[| 4].setVisible(_maskUse);
if(_maskUse && _msd) _dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -41,15 +42,16 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
return _outSurf;
}
surface_set_target(_outSurf);
DRAW_CLEAR
shader_set(sh_solid);
if(is_surface(_msk))
if(_maskUse) {
surface_set_shader(_outSurf, sh_solid);
draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, 1);
else
draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _col, 1);
shader_reset();
surface_reset_shader();
return _outSurf;
}
surface_set_target(_outSurf);
draw_clear(_col);
surface_reset_target();
return _outSurf;

View file

@ -480,28 +480,28 @@ function Panel_Inspector() : PanelContent() constructor {
} else {
if(i >= array_length(_inspecting.input_display_list)) break;
var jun_disp = _inspecting.input_display_list[i];
if(is_array(jun_disp)) {
if(is_array(jun_disp)) { // LABEL
var txt = __txt(jun_disp[0]);
var coll = jun_disp[1] && filter_text == "";
var lbh = lineBreak? ui(32) : ui(26);
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, con_w, yy + ui(32))) {
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_hover, 1);
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, con_w, yy + lbh)) {
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, lbh, COLORS.panel_inspector_group_hover, 1);
if(mouse_press(mb_left, pFOCUS))
jun_disp[@ 1] = !coll;
if(mouse_press(mb_right, pFOCUS))
menuCall("inspector_group_menu",,, group_menu,, _inspecting);
} else
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_bg, 1);
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, lbh, COLORS.panel_inspector_group_bg, 1);
if(filter_text == "") {
draw_sprite_ui(THEME.arrow, 0, ui(16), yy + ui(32) / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1);
}
if(filter_text == "")
draw_sprite_ui(THEME.arrow, 0, ui(16), yy + lbh / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(32), yy + ui(32) / 2, txt);
draw_set_text(lineBreak? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(32), yy + lbh / 2, txt);
hh += ui(32 + 8);
hh += lbh + ui(lineBreak? 8 : 6);
if(coll) {
var j = i + 1;
@ -757,8 +757,10 @@ function Panel_Inspector() : PanelContent() constructor {
by += ui(36);
view_mode_tooltip.index = lineBreak;
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2)
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2) {
lineBreak = !lineBreak;
PREFERENCES.inspector_view_default = lineBreak;
}
var bx = w - ui(44);
var by = ui(12);

View file

@ -37,6 +37,7 @@
PREFERENCES.panel_preview_dragging = MOD_KEY.alt;
PREFERENCES.inspector_focus_on_double_click = true;
PREFERENCES.inspector_view_default = 1;
PREFERENCES.node_show_render_status = false;
PREFERENCES.node_show_time = true;

View file

@ -15,6 +15,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
tb_value.slidable = true;
tb_value.slide_speed = 1;
halign = fa_center;
static setInteract = function(interactable = noone) {
self.interactable = interactable;
tb_value.interactable = interactable;
@ -25,6 +27,7 @@ function rotator(_onModify, _step = -1) : widget() constructor {
}
static drawParam = function(params) {
halign = params.halign;
return draw(params.x, params.y, params.w, params.data, params.m);
}
@ -34,18 +37,22 @@ function rotator(_onModify, _step = -1) : widget() constructor {
w = _w;
h = ui(64);
_x += _w / 2;
var _r = ui(28);
switch(halign) {
case fa_left : _x += _r; break;
case fa_center : _x += _w / 2; break;
}
if(!is_real(_data)) return;
var knob_y = _y + h / 2;
var _r = ui(28);
if(draw_tb) {
tb_value.setFocusHover(active, hover);
tb_value.draw(_x + ui(64), knob_y - ui(17), ui(64), TEXTBOX_HEIGHT, _data, _m);
}
draw_sprite(spr_bg, 0, _x, knob_y);
draw_sprite(spr_bg, 0, round(_x), round(knob_y));
draw_set_color(COLORS.widget_rotator_guide);
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data) - 1, knob_y + lengthdir_y(ui(20), _data) - 1);
@ -88,9 +95,6 @@ function rotator(_onModify, _step = -1) : widget() constructor {
draw_sprite(spr_knob, 0, px, py);
}
//draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
//draw_text(_x, knob_y, string(_data));
resetFocus();
return h;

View file

@ -53,7 +53,7 @@ function rotatorRandom(_onModify) : widget() constructor {
var kny = _y + h / 2;
var px, py, _r = ui(28);
draw_sprite(THEME.rotator_bg, 0, _x, kny);
draw_sprite(THEME.rotator_bg, 0, round(_x), round(kny));
tooltip.index = mode;
if(buttonInstant(THEME.button_hide_circle_28, knx - ui(28 / 2), kny - ui(28 / 2), ui(28), ui(28), _m, active, hover, tooltip, THEME.rotator_random_mode, mode) == 2) { #region

View file

@ -55,7 +55,7 @@ function rotatorRange(_onModify) : widget() constructor {
py[i] = knob_y + lengthdir_y(_r, _data[i]);
}
draw_sprite(THEME.rotator_bg, 0, _x, knob_y);
draw_sprite(THEME.rotator_bg, 0, round(_x), round(knob_y));
draw_set_color(COLORS.widget_rotator_guide);
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data[0]) - 1, knob_y + lengthdir_y(ui(20), _data[0]) - 1);

View file

@ -32,8 +32,6 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
}
static draw = function(_x, _y, _w, _h, _surface, _display_data, _m, _rx, _ry) {
_h = ui(96);
x = _x;
y = _y;
w = _w;