From 6fe517245afed052a17fcd3b9b208620baf04aac Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sun, 18 Aug 2024 18:13:40 +0700 Subject: [PATCH] 17.10.2 --- objects/o_dialog_menubox/Draw_64.gml | 29 +- scripts/addon_function/addon_function.gml | 15 +- .../contextMenu_controller.gml | 5 +- scripts/node_data/node_data.gml | 132 ++++---- .../node_monitor_capture.gml | 6 +- scripts/node_processor/node_processor.gml | 6 +- scripts/node_skew/node_skew.gml | 30 +- scripts/panel_graph/panel_graph.gml | 20 +- scripts/panel_inspector/panel_inspector.gml | 282 +++++++++--------- scripts/panel_menu/panel_menu.gml | 46 +-- scripts/panel_palette/panel_palette.gml | 4 +- .../panel_preview_window.gml | 15 +- 12 files changed, 283 insertions(+), 307 deletions(-) diff --git a/objects/o_dialog_menubox/Draw_64.gml b/objects/o_dialog_menubox/Draw_64.gml index 69f54143a..ff1775f1c 100644 --- a/objects/o_dialog_menubox/Draw_64.gml +++ b/objects/o_dialog_menubox/Draw_64.gml @@ -57,27 +57,30 @@ if(!ready) exit; if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) { if(_menuItem.active && _lclick) { + var _par = _menuItem.params; + var _dat = { + _x: dialog_x, + x: dialog_x + dialog_w, + y: yy, + name: _menuItem.name, + index: i, + depth: depth, + context: context, + params: _menuItem.params, + }; + if(_menuItem.isShelf) { - var _dat = { - _x: dialog_x, - x: dialog_x + dialog_w, - y: yy, - depth: depth, - name: _menuItem.name, - index: i, - context: context, - params: _menuItem.params, - }; - var _res = _menuItem.func(_dat); array_push(children, _res.id); // open child } else if(remove_parents) { - _menuItem.func(); + if(_par == noone) _menuItem.func(); + else _menuItem.func(_par); instance_destroy(o_dialog_menubox); // close all } else { - _menuItem.func(); + if(_par == noone) _menuItem.func(); + else _menuItem.func(_par); instance_destroy(); // close self } diff --git a/scripts/addon_function/addon_function.gml b/scripts/addon_function/addon_function.gml index 37c50bd9c..9712d53f3 100644 --- a/scripts/addon_function/addon_function.gml +++ b/scripts/addon_function/addon_function.gml @@ -37,23 +37,18 @@ function addonContextGenerator(_addon, _function) constructor { } function addonContextItem(_addon, _name, _function) constructor { - self._addon = _addon; - self._name = _name; + self._addon = _addon; + self._name = _name; self._function = _function; - menu_item = menuItem(_name, function(_data) { - lua_call(_addon.thread, self._function, lua_byref(_data.context, true)); - })//.setColor(COLORS._main_accent); + menu_item = menuItem(_name, function(_data) { lua_call(_addon.thread, self._function, lua_byref(_data.context, true)); }); } function addonContextSubMenu(_name, _content) constructor { - self.name = _name; + self.name = _name; self.content = _content; - menu_item = menuItem(name, function(_dat) { - return submenuCall(_dat, content); - })//.setColor(COLORS._main_accent) - .setIsShelf(); + menu_item = menuItem(name, function(_dat) { return submenuCall(_dat, content); }).setIsShelf(); } function addonTrigger(_addon, _openDialog = true) { diff --git a/scripts/contextMenu_controller/contextMenu_controller.gml b/scripts/contextMenu_controller/contextMenu_controller.gml index ab87070ca..d73f9e3e6 100644 --- a/scripts/contextMenu_controller/contextMenu_controller.gml +++ b/scripts/contextMenu_controller/contextMenu_controller.gml @@ -44,7 +44,7 @@ function submenuCall(_data = undefined, menu = []) { if(is_undefined(_data)) return menuCall("", menu); var dia = instance_create_depth(_data.x - ui(4), _data.y, _data.depth - 1, o_dialog_menubox); - dia.context = _data.context; + dia.context = _data.context; dia.setMenu(menu); if(_data.x - ui(4) + dia.dialog_w > WIN_W - ui(2)) @@ -61,7 +61,8 @@ function fileNameCall(path, onModify, _x = mouse_mx + 8, _y = mouse_my + 8) { return dia; } -function menuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) { return new MenuItem(name, func, spr, hotkey, toggle, params); } +function menuItem( name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) { return new MenuItem(name, func, spr, hotkey, toggle, params); } +function menuItemShelf(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) { return new MenuItem(name, func, spr, hotkey, toggle, params).setIsShelf(); } function MenuItem(_name, _func, _spr = noone, _hotkey = noone, _toggle = noone, _params = {}) constructor { active = true; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 38fca2593..71388079a 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -3,7 +3,6 @@ #macro INAME internalName == ""? name : internalName #macro SHOW_PARAM (show_parameter && previewable) - #macro NODE_SET_INPUT_SIZE input_list_size = array_length(inputs); output_list_size = array_length(outputs); enum CACHE_USE { none, @@ -147,9 +146,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { outputMap = ds_map_create(); input_value_map = {}; - input_list_size = 0; - output_list_size = 0; - use_display_list = true; input_display_list = -1; output_display_list = -1; @@ -201,9 +197,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { run_in(1, function() { input_buttons = []; - NODE_SET_INPUT_SIZE - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _in = inputs[i]; if(!is_instanceof(_in, NodeValue)) continue; if(_in.type != VALUE_TYPE.trigger) continue; @@ -343,19 +338,18 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var type_self = instanceof(self); if(!struct_has(global.NODE_GUIDE, type_self)) return; - NODE_SET_INPUT_SIZE var _n = global.NODE_GUIDE[$ type_self]; var _ins = _n.inputs; var _ots = _n.outputs; - var amo = min(input_list_size, array_length(_ins)); + var amo = min(array_length(inputs), array_length(_ins)); for( var i = 0; i < amo; i++ ) { inputs[i].name = _ins[i].name; inputs[i].tooltip = _ins[i].tooltip; } - var amo = min(output_list_size, array_length(_ots)); + var amo = min(array_length(outputs), array_length(_ots)); for( var i = 0; i < amo; i++ ) { outputs[i].name = _ots[i].name; outputs[i].tooltip = _ots[i].tooltip; @@ -406,7 +400,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static refreshDynamicInput = function() { - NODE_SET_INPUT_SIZE var _in = []; for( var i = 0; i < input_fix_len; i++ ) @@ -415,7 +408,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { input_display_list = array_clone(input_display_list_raw, 1); var sep = false; - for( var i = input_fix_len; i < input_list_size; i += data_length ) { + for( var i = input_fix_len; i < array_length(inputs); i += data_length ) { var _active = false; var _inp = inputs[i + dyna_input_check_shift]; @@ -454,7 +447,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } - static getInputAmount = function() { return (input_list_size - input_fix_len) / data_length; } + static getInputAmount = function() { return (array_length(inputs) - input_fix_len) / data_length; } function onInputResize() { refreshDynamicInput(); triggerRender(); } @@ -462,7 +455,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _targ = noone; var _dy = 9999; - for( var i = 0; i < output_list_size; i++ ) { + for( var i = 0; i < array_length(outputs); i++ ) { if(!outputs[i].isVisible()) continue; if(junc != noone && !junc.isConnectable(outputs[i], true)) continue; @@ -476,12 +469,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static getInput = function(_y = 0, junc = noone, shift = input_fix_len) { - NODE_SET_INPUT_SIZE var _targ = noone; var _dy = 9999; - for( var i = shift; i < input_list_size; i++ ) { + for( var i = shift; i < array_length(inputs); i++ ) { var _inp = inputs[i]; if(!_inp.isVisible()) continue; @@ -531,7 +523,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { /////============= STEP ============= static stepBegin = function() { - NODE_SET_INPUT_SIZE if(use_cache) cacheArrayCheck(); @@ -607,16 +598,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { return jun_list_arr; } - static getOutputJunctionAmount = function() { return output_display_list == -1? output_list_size : array_length(output_display_list); } + static getOutputJunctionAmount = function() { return output_display_list == -1? array_length(outputs) : array_length(output_display_list); } static getOutputJunctionIndex = function(index) { return output_display_list == -1? index : output_display_list[index]; } static updateIO = function() { - NODE_SET_INPUT_SIZE - for( var i = 0, n = input_list_size; i < n; i++ ) + for( var i = 0, n = array_length(inputs); i < n; i++ ) inputs[i].visible_in_list = false; - inputs_amount = (input_display_list == -1 || !use_display_list)? input_list_size : array_length(input_display_list); + inputs_amount = (input_display_list == -1 || !use_display_list)? array_length(inputs) : array_length(input_display_list); inputs_index = []; for( var i = 0; i < inputs_amount; i++ ) { @@ -631,19 +621,18 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } inputs_amount = array_length(inputs_index); - outputs_amount = output_display_list == -1? output_list_size : array_length(output_display_list); + outputs_amount = output_display_list == -1? array_length(outputs) : array_length(output_display_list); outputs_index = array_create_ext(outputs_amount, function(index) { return getOutputJunctionIndex(index); }); } run_in(1, function() /*=>*/ { updateIO() }); static setHeight = function() { - NODE_SET_INPUT_SIZE w = SHOW_PARAM? attributes.node_param_width : min_w; if(!auto_height) return; var _ss = getGraphPreviewSurface(); var _ps = is_surface(_ss); - var _ou = preview_channel >= 0 && preview_channel < output_list_size && outputs[preview_channel].type == VALUE_TYPE.surface; + var _ou = preview_channel >= 0 && preview_channel < array_length(outputs) && outputs[preview_channel].type == VALUE_TYPE.surface; var _prev_surf = previewable && preview_draw && (_ps || _ou); junction_draw_hei_y = SHOW_PARAM? 32 : 24; @@ -669,7 +658,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } var _p = previewable; - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _inp = inputs[i]; if(is_instanceof(_inp, NodeValue) && _inp.isVisible()) { if(_p) _hi += junction_draw_hei_y; @@ -680,13 +669,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(auto_input && dummy_input) _hi += junction_draw_hei_y; var _p = previewable; - for( var i = 0; i < output_list_size; i++ ) { + for( var i = 0; i < array_length(outputs); i++ ) { if(!outputs[i].isVisible()) continue; if(_p) _ho += junction_draw_hei_y; _p = true; } - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _inp = inputs[i]; var _byp = _inp.bypass_junc; if(_byp == noone) continue; @@ -700,9 +689,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static getJunctionList = function() { ////getJunctionList - NODE_SET_INPUT_SIZE - var amo = input_display_list == -1? input_list_size : array_length(input_display_list); + var amo = input_display_list == -1? array_length(inputs) : array_length(input_display_list); inputDisplayList = []; for(var i = 0; i < amo; i++) { @@ -720,13 +708,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static onValidate = function() { - NODE_SET_INPUT_SIZE value_validation[VALIDATION.pass] = 0; value_validation[VALIDATION.warning] = 0; value_validation[VALIDATION.error] = 0; - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var jun = inputs[i]; if(jun.value_validation) value_validation[jun.value_validation]++; @@ -734,20 +721,19 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static getJunctionTos = function() { - var _vto = array_create(output_list_size); - for (var j = 0; j < output_list_size; j++) + var _vto = array_create(array_length(outputs)); + for (var j = 0; j < array_length(outputs); j++) _vto[j] = array_clone(outputs[j].value_to); return _vto; } static checkConnectGroup = function(_io) { - NODE_SET_INPUT_SIZE var _y = y; var _n = noone; - for(var i = 0; i < input_list_size; i++) { + for(var i = 0; i < array_length(inputs); i++) { var _in = inputs[i]; if(_in.value_from == noone) continue; if(_in.value_from.node.group == group) continue; @@ -761,7 +747,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { _io.inputs[$ _ind ] = [ _in ]; } - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var _ou = outputs[i]; for(var j = 0; j < array_length(_ou.value_to); j++) { @@ -789,10 +775,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static resetDefault = function() { var folder = instanceof(self); - NODE_SET_INPUT_SIZE if(!ds_map_exists(global.PRESETS_MAP, folder)) { - for( var i = 0, n = input_list_size; i < n; i++ ) + for( var i = 0, n = array_length(inputs); i < n; i++ ) inputs[i].resetValue(); return; } @@ -807,7 +792,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { return; } - for( var i = 0, n = input_list_size; i < n; i++ ) + for( var i = 0, n = array_length(inputs); i < n; i++ ) inputs[i].resetValue(); } if(!APPENDING && !LOADING) run_in(1, function() /*=>*/ { if(set_default) resetDefault() }); @@ -829,9 +814,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { // } static getInputs = function(frame = CURRENT_FRAME) { - NODE_SET_INPUT_SIZE - inputs_data = array_verify(inputs_data, input_list_size); + inputs_data = array_verify(inputs_data, array_length(inputs)); __frame = frame; array_foreach(inputs, function(_inp, i) /*=>*/ { @@ -856,7 +840,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static postUpdate = function(frame = CURRENT_FRAME) {} static doUpdate = function(frame = CURRENT_FRAME) { - NODE_SET_INPUT_SIZE if(PROJECT.safeMode) return; if(NODE_EXTRACT) return; @@ -897,7 +880,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { cached_manual = false; if(!use_cache && PROJECT.onion_skin.enabled) { - for( var i = 0; i < output_list_size; i++ ) { + for( var i = 0; i < array_length(outputs); i++ ) { if(outputs[i].type != VALUE_TYPE.surface) continue; cacheCurrentFrame(outputs[i].getValue()); break; @@ -947,7 +930,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { __temp_frame = frame; return array_any(inputs, function(inp) /*=>*/ {return inp.isActiveDynamic(__temp_frame)}); - // for(var i = 0; i < input_list_size; i++) + // for(var i = 0; i < array_length(inputs); i++) // if(inputs[i].isActiveDynamic(frame)) return true; // return false; @@ -977,7 +960,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static forwardPassiveDynamic = function() { rendered = false; - for( var i = 0, n = output_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(outputs); i < n; i++ ) { var _outp = outputs[i]; for(var j = 0; j < array_length(_outp.value_to); j++) { @@ -999,7 +982,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static isLeaf = function() { INLINE - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { var _inp = inputs[i]; if(!_inp.value_from == noone) return false; } @@ -1012,7 +995,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(list == noone) return isLeaf(); - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { var _inp = inputs[i].value_from; if(_inp != noone && array_exists(list, _inp.node)) @@ -1027,7 +1010,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static isRenderable = function(log = false) { //Check if every input is ready (updated) if(!active || !isRenderActive()) return false; - for(var j = 0; j < input_list_size; j++) + for(var j = 0; j < array_length(inputs); j++) if(!inputs[j].isRendered()) return false; return true; @@ -1048,7 +1031,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(attributes.show_update_trigger && updatedInTrigger.value_from) array_push(prev, updatedInTrigger.value_from.node); - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { var _in = inputs[i]; if(_in.value_from != noone) { @@ -1078,7 +1061,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, $"→→→→→ Call get next node from: {INAME}"); - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var _ot = outputs[i]; if(!_ot.forward) continue; @@ -1103,7 +1086,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } } - for(var i = 0; i < input_list_size; i++) { + for(var i = 0; i < array_length(inputs); i++) { var _in = inputs[i]; if(_in.bypass_junc == noone) continue; @@ -1125,7 +1108,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static getNextNodesRaw = function() { var nodes = []; - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var _ot = outputs[i]; if(!_ot.forward) continue; if(_ot.type == VALUE_TYPE.node) continue; @@ -1143,7 +1126,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { array_push(nodes, _tos[j].node); } - for(var i = 0; i < input_list_size; i++) { + for(var i = 0; i < array_length(inputs); i++) { var _in = inputs[i]; if(_in.bypass_junc == noone) continue; @@ -1190,7 +1173,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } run_in(1, function() { refreshNodeDisplay(); }); static preDraw = function(_x, _y, _s) { - NODE_SET_INPUT_SIZE var xx = x * _s + _x; var yy = y * _s + _y; @@ -1216,11 +1198,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { updatedOutTrigger.x = xx + w * _s; updatedOutTrigger.y = yy + 10; - if(in_cache_len != array_length(inputDisplayList) || out_cache_len != output_list_size) { + if(in_cache_len != array_length(inputDisplayList) || out_cache_len != array_length(outputs)) { refreshNodeDisplay(); in_cache_len = array_length(inputDisplayList); - out_cache_len = output_list_size; + out_cache_len = array_length(outputs); } var _junRy = junction_draw_pad_y; @@ -1236,7 +1218,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var rx = x; var ry = y + _junRy; - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { jun = inputs[i]; jun.x = _ix; jun.rx = rx; @@ -1270,7 +1252,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { ry += junction_draw_hei_y * jun.isVisible(); } - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _inp = inputs[i]; var jun = _inp.bypass_junc; if(jun == noone) continue; @@ -1470,14 +1452,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(jun.drawJunction(_s, _mx, _my)) hover = jun; } - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var jun = outputs[i]; if(!jun.isVisible()) continue; if(jun.drawJunction(_s, _mx, _my)) hover = jun; } - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _inp = inputs[i]; var jun = _inp.bypass_junc; @@ -1510,14 +1492,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(jun.drawJunction_fast(_s, _mx, _my)) hover = jun; } - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var jun = outputs[i]; if(!jun.isVisible()) continue; if(jun.drawJunction_fast(_s, _mx, _my)) hover = jun; } - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var _inp = inputs[i]; var jun = _inp.bypass_junc; @@ -1544,7 +1526,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(draw_graph_culled) return; if(!active) return; - var amo = input_display_list == -1? input_list_size : array_length(input_display_list); + var amo = input_display_list == -1? array_length(inputs) : array_length(input_display_list); var jun; var xx = x * _s + _x; @@ -1579,19 +1561,19 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } if(show_output_name) { - for(var i = 0; i < output_list_size; i++) + for(var i = 0; i < array_length(outputs); i++) if(outputs[i].isVisible()) outputs[i].drawNameBG(_s); - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var jun = inputs[i].bypass_junc; if(jun == noone || !jun.visible) continue; jun.drawNameBG(_s); } - for(var i = 0; i < output_list_size; i++) + for(var i = 0; i < array_length(outputs); i++) if(outputs[i].isVisible()) outputs[i].drawName(_s, _mx, _my); - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var jun = inputs[i].bypass_junc; if(jun == noone || !jun.visible) continue; jun.drawName(_s, _mx, _my); @@ -1619,7 +1601,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var high = params.highlight; // 0 var bg = params.bg; // 0 - for(var i = 0; i < output_list_size; i++) { + for(var i = 0; i < array_length(outputs); i++) { var jun = outputs[i]; var connected = false; @@ -1643,7 +1625,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } - __draw_inputs = array_verify(__draw_inputs, input_list_size); + __draw_inputs = array_verify(__draw_inputs, array_length(inputs)); var _len = 0; var _jun, _hov; @@ -1658,7 +1640,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } var drawLineIndex = 1; - for(var i = 0, n = input_list_size; i < n; i++) { + for(var i = 0, n = array_length(inputs); i < n; i++) { _jun = inputs[i]; _jun.draw_blend_color = bg; _jun.draw_blend = high? PREFERENCES.connection_line_highlight_fade : -1; @@ -1670,7 +1652,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(i >= 0) __draw_inputs[_len++] = _jun; } - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { var jun = inputs[i].bypass_junc; if(jun == noone || !jun.visible) continue; jun.drawBypass(params); @@ -1956,7 +1938,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(!PREFERENCES.connection_line_highlight_all && _depth == 1) return; - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { if(inputs[i].value_from == noone) continue; inputs[i].value_from.node.drawBranch(_depth + 1); } @@ -1976,7 +1958,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { /////============ PREVIEW ============ static getPreviewValues = function() { - if(preview_channel >= output_list_size) return noone; + if(preview_channel >= array_length(outputs)) return noone; var _type = outputs[preview_channel].type; if(_type != VALUE_TYPE.surface && _type != VALUE_TYPE.dynaSurface) @@ -2010,7 +1992,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static getAnimationCacheExist = function(frame) { return cacheExist(frame); } static clearInputCache = function() { - for( var i = 0; i < input_list_size; i++ ) + for( var i = 0; i < array_length(inputs); i++ ) inputs[i].cache_value[0] = false; } @@ -2097,7 +2079,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(group != _group) return; setRenderStatus(true); - for( var i = 0, n = input_list_size; i < n; i++ ) { + for( var i = 0, n = array_length(inputs); i < n; i++ ) { var _input = inputs[i]; if(_input.value_from == noone) continue; @@ -2106,7 +2088,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } static clearInputCache = function() { - for( var i = 0; i < input_list_size; i++ ) { + for( var i = 0; i < array_length(inputs); i++ ) { if(!is_instanceof(inputs[i], NodeValue)) continue; inputs[i].resetCache(); } diff --git a/scripts/node_monitor_capture/node_monitor_capture.gml b/scripts/node_monitor_capture/node_monitor_capture.gml index 90bef47e0..d28367269 100644 --- a/scripts/node_monitor_capture/node_monitor_capture.gml +++ b/scripts/node_monitor_capture/node_monitor_capture.gml @@ -4,11 +4,11 @@ function Node_Monitor_Capture(_x, _y, _group = noone) : Node(_x, _y, _group) con monitors = display_measure_all(); - inputs[0] = nodeValue_Enum_Scroll("Mode", self, 0, [ "Monitor", "Region" ]); + newInput(0, nodeValue_Enum_Scroll("Mode", self, 0, [ "Monitor", "Region" ])); - inputs[1] = nodeValue_Enum_Scroll("Monitor", self, 0, array_create_ext(array_length(monitors), function(ind) { return monitors[ind][9]; })); + newInput(1, nodeValue_Enum_Scroll("Monitor", self, 0, array_create_ext(array_length(monitors), function(ind) /*=>*/ {return monitors[ind][9]}))); - inputs[2] = nodeValue_Vec4("Region", self, [ 0, 0, display_get_width(), display_get_height() ]); + newInput(2, nodeValue_Vec4("Region", self, [ 0, 0, display_get_width(), display_get_height() ])); outputs[0] = nodeValue_Output("GUI", self, VALUE_TYPE.surface, noone); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 6c94c63d2..1ed7b6558 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -152,7 +152,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct for(var l = 0; l < process_amount; l++) { - for(var i = input_list_size - 1; i >= 0; i--) + for(var i = array_length(inputs) - 1; i >= 0; i--) _data[i] = all_inputs[i][l]; if(_output.type == VALUE_TYPE.surface) { #region // Output surface verification @@ -305,11 +305,9 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct static preGetInputs = function() {} static getInputs = function() { - NODE_SET_INPUT_SIZE - preGetInputs(); - var _len = input_list_size; + var _len = array_length(inputs); process_amount = 1; inputs_data = array_verify(inputs_data, _len); diff --git a/scripts/node_skew/node_skew.gml b/scripts/node_skew/node_skew.gml index 571c5bc5c..35cbad029 100644 --- a/scripts/node_skew/node_skew.gml +++ b/scripts/node_skew/node_skew.gml @@ -1,35 +1,35 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Skew"; - inputs[0] = nodeValue_Surface("Surface in", self); - inputs[1] = nodeValue_Enum_Button("Axis", self, 0, ["x", "y"]); + newInput(0, nodeValue_Surface("Surface in", self)); + newInput(1, nodeValue_Enum_Button("Axis", self, 0, ["x", "y"])); newInput(2, nodeValue_Float("Strength", self, 0)) .setDisplay(VALUE_DISPLAY.slider, { range: [-1, 1, 0.01] }) .setMappable(12); - inputs[3] = nodeValue_Bool("Wrap", self, false); + newInput(3, nodeValue_Bool("Wrap", self, false)); newInput(4, nodeValue_Vec2("Center", self, [0, 0] , { side_button : button(function() { centerAnchor(); }).setIcon(THEME.anchor).setTooltip(__txt("Set to center")) })); newInput(5, nodeValue_Enum_Scroll("Oversample mode", self, 0, [ "Empty", "Clamp", "Repeat" ])) .setTooltip("How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture."); - inputs[6] = nodeValue_Surface("Mask", self); + newInput(6, nodeValue_Surface("Mask", self)); newInput(7, nodeValue_Float("Mix", self, 1)) .setDisplay(VALUE_DISPLAY.slider); - inputs[8] = nodeValue_Bool("Active", self, true); + newInput(8, nodeValue_Bool("Active", self, true)); active_index = 8; - inputs[9] = nodeValue_Toggle("Channel", self, 0b1111, { data: array_create(4, THEME.inspector_channel) }); + newInput(9, nodeValue_Toggle("Channel", self, 0b1111, { data: array_create(4, THEME.inspector_channel) })); __init_mask_modifier(6); // inputs 10, 11 ////////////////////////////////////////////////////////////////////////////////////////////////// - inputs[12] = nodeValueMap("Strength map", self); + newInput(12, nodeValueMap("Strength map", self)); ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -44,30 +44,30 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons attribute_oversample(); attribute_interpolation(); - static centerAnchor = function() { #region + static centerAnchor = function() { if(!is_surface(current_data[0])) return; var ww = surface_get_width_safe(current_data[0]); var hh = surface_get_height_safe(current_data[0]); inputs[4].setValue([ww / 2, hh / 2]); - } #endregion + } - static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { PROCESSOR_OVERLAY_CHECK var _hov = false; var hv = inputs[4].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= hv; return _hov; - } #endregion + } - static step = function() { #region + static step = function() { __step_mask_modifier(); inputs[2].mappableStep(); - } #endregion + } - static processData = function(_outSurf, _data, _output_index, _array_index) { #region + static processData = function(_outSurf, _data, _output_index, _array_index) { var _samp = struct_try_get(attributes, "oversample"); surface_set_shader(_outSurf, sh_skew); @@ -85,5 +85,5 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _outSurf = channel_apply(_data[0], _outSurf, _data[9]); return _outSurf; - } #endregion + } } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index c856fcaa6..bac5ae158 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1347,7 +1347,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _to = value_focus.value_to[i]; var _lb = $"[{_to.node.display_name}] {_to.getName()}"; - array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.params.juncTo.removeFrom(); }, THEME.cross, noone, noone, { juncTo: _to })); + array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.juncTo.removeFrom(); }, THEME.cross, noone, noone, { juncTo: _to })); } for( var i = 0, n = array_length(value_focus.value_to_loop); i < n; i++ ) { @@ -1355,7 +1355,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _to = value_focus.value_to_loop[i]; var _lb = $"[{_to.junc_in.node.display_name}] {_to.junc_in.getName()}"; - array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.params.juncTo.destroy(); }, _to.icon_24, noone, noone, { juncTo: _to })); + array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.juncTo.destroy(); }, _to.icon_24, noone, noone, { juncTo: _to })); } } else { var sep = false; @@ -1365,7 +1365,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _jun = value_focus.value_from; var _lb = $"[{_jun.node.display_name}] {_jun.getName()}"; - array_push(menu, menuItem(_lb, function(data) /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross)); + array_push(menu, menuItem(_lb, function() /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross)); } if(value_focus.value_from_loop) { @@ -1373,7 +1373,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _jun = value_focus.value_from_loop.junc_out; var _lb = $"[{_jun.node.display_name}] {_jun.getName()}"; - array_push(menu, menuItem(_lb, function(data) /*=>*/ { __junction_hovering.removeFromLoop(); }, value_focus.value_from_loop.icon_24)); + array_push(menu, menuItem(_lb, function() /*=>*/ { __junction_hovering.removeFromLoop(); }, value_focus.value_from_loop.icon_24)); } } @@ -1817,8 +1817,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var menu = [ menuItem("Feedback", function(data) { - var junc_in = data.params.junc_in; - var junc_out = data.params.junc_out; + var junc_in = data.junc_in; + var junc_out = data.junc_out; var feed = nodeBuild("Node_Feedback_Inline", 0, 0).skipDefault(); // feed.connectJunctions(junc_in, junc_out); @@ -1826,18 +1826,18 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { feed.attributes.junc_out = [ junc_out.node.node_id, junc_out.index ]; feed.scanJunc(); - }, THEME.feedback_24,,, { junc_in : _connect[1], junc_out : _connect[2] }), + }, THEME.feedback_24, noone, noone, { junc_in : _connect[1], junc_out : _connect[2] }), menuItem("Loop", function(data) { - var junc_in = data.params.junc_in; - var junc_out = data.params.junc_out; + var junc_in = data.junc_in; + var junc_out = data.junc_out; var feed = nodeBuild("Node_Iterate_Inline", 0, 0).skipDefault(); feed.attributes.junc_in = [ junc_in .node.node_id, junc_in .index ]; feed.attributes.junc_out = [ junc_out.node.node_id, junc_out.index ]; feed.scanJunc(); - }, THEME.loop_24,,, { junc_in : _connect[1], junc_out : _connect[2] }), + }, THEME.loop_24, noone, noone, { junc_in : _connect[1], junc_out : _connect[2] }), ]; menuCall("", menu); diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 69d764995..c4616c041 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -741,124 +741,121 @@ function Panel_Inspector() : PanelContent() constructor { else jun = _inspecting.output_display_list[_oi]; } - #region draw custom displayer - - if(is_instanceof(jun, Inspector_Spacer)) { // SPACER - var _hh = ui(jun.h); - var _yy = yy + _hh / 2 - ui(2); - - if(jun.line) { - draw_set_color(COLORS.panel_inspector_key_separator); - draw_line(ui(8), _yy, con_w - ui(8), _yy); - } - - hh += _hh; - continue; - - } else if(is_instanceof(jun, Inspector_Sprite)) { // SPRITE - var _spr = jun.spr; - var _sh = sprite_get_height(_spr); - - draw_sprite(_spr, 0, xc, yy); - - hh += _sh + ui(8); - continue; - - } else if(is_instanceof(jun, Inspector_Label)) { // TEXT - var _txt = jun.text; - - draw_set_text(jun.font, fa_left, fa_top, COLORS._main_text_sub); - var _sh = string_height_ext(_txt, -1, con_w - ui(16)) + ui(16); - draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, 0, yy, con_w, _sh, COLORS._main_icon_light); - draw_text_ext_add(ui(8), yy + ui(8), _txt, -1, con_w - ui(16)); - - hh += _sh + ui(8); - continue; - - } else if(is_instanceof(jun, Inspector_Custom_Renderer)) { - jun.register(contentPane); - jun.rx = ui(16) + x; - jun.ry = top_bar_h + y; - - var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8); - if(!is_undefined(_wdh)) hh += _wdh; - continue; - } else if(is_array(jun)) { // LABEL - var pad = i && _colsp == false? ui(4) : 0 - _colsp = false; - yy += pad; - - var txt = __txt(jun[0]); - var coll = jun[1] && filter_text == ""; - var lbh = viewMode? ui(32) : ui(26); - var togl = array_safe_get_fast(jun, 2, noone); - if(togl != noone) var toging = _inspecting.getInputData(togl); - - var lbx = (togl != noone) * ui(40); - var lbw = con_w - lbx; - var ltx = lbx + ui(32); - - if(_hover && point_in_rectangle(_m[0], _m[1], lbx, yy, con_w, yy + lbh)) { - contentPane.hover_content = true; - draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_hover, 1); - - if(mouse_press(mb_left, pFOCUS)) - jun[@ 1] = !coll; - if(mouse_press(mb_right, pFOCUS)) - menuCall("inspector_group_menu", group_menu, 0, 0, fa_left, _inspecting); - } else - draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_bg, 1); + if(is_instanceof(jun, Inspector_Spacer)) { // SPACER + var _hh = ui(jun.h); + var _yy = yy + _hh / 2 - ui(2); - if(filter_text == "") - draw_sprite_ui(THEME.arrow, 0, lbx + ui(16), yy + lbh / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1); - - var cc, aa = 1; - - if(togl != noone) { - if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, ui(32), yy + lbh)) { - contentPane.hover_content = true; - draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, 0, yy, ui(32), lbh, COLORS.panel_inspector_group_hover, 1); - - if(mouse_press(mb_left, pFOCUS)) - _inspecting.inputs[togl].setValue(!toging); - } else - draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, 0, yy, ui(32), lbh, COLORS.panel_inspector_group_bg, 1); - - cc = toging? COLORS._main_accent : COLORS.panel_inspector_group_bg; - aa = 0.5 + toging * 0.5; - - draw_sprite_ui(THEME.inspector_checkbox, 0, ui(16), yy + lbh / 2, 1, 1, 0, cc, 1); - if(toging) - draw_sprite_ui(THEME.inspector_checkbox, 1, ui(16), yy + lbh / 2, 1, 1, 0, cc, 1); - } - - draw_set_text(viewMode? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text, aa); - draw_text_add(ltx, yy + lbh / 2, txt); - draw_set_alpha(1); - - hh += lbh + ui(viewMode? 8 : 6) + pad; - - if(coll) { // skip - _colsp = true; - var j = i + 1; - var _len = array_length(_inspecting.input_display_list); - - while(j < _len) { - var j_jun = _inspecting.input_display_list[j]; - if(is_array(j_jun)) - break; - j++; - } - - i = j - 1; - } - - continue; - + if(jun.line) { + draw_set_color(COLORS.panel_inspector_key_separator); + draw_line(ui(8), _yy, con_w - ui(8), _yy); } + + hh += _hh; + continue; + + } else if(is_instanceof(jun, Inspector_Sprite)) { // SPRITE + var _spr = jun.spr; + var _sh = sprite_get_height(_spr); + + draw_sprite(_spr, 0, xc, yy); + + hh += _sh + ui(8); + continue; + + } else if(is_instanceof(jun, Inspector_Label)) { // TEXT + var _txt = jun.text; + + draw_set_text(jun.font, fa_left, fa_top, COLORS._main_text_sub); + var _sh = string_height_ext(_txt, -1, con_w - ui(16)) + ui(16); + draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, 0, yy, con_w, _sh, COLORS._main_icon_light); + draw_text_ext_add(ui(8), yy + ui(8), _txt, -1, con_w - ui(16)); + + hh += _sh + ui(8); + continue; + + } else if(is_instanceof(jun, Inspector_Custom_Renderer)) { + jun.register(contentPane); + jun.rx = ui(16) + x; + jun.ry = top_bar_h + y; + + var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8); + if(!is_undefined(_wdh)) hh += _wdh; + continue; + + } else if(is_array(jun)) { // LABEL + var pad = i && _colsp == false? ui(4) : 0 + _colsp = false; + yy += pad; + + var txt = __txt(jun[0]); + var coll = jun[1] && filter_text == ""; + var lbh = viewMode? ui(32) : ui(26); + var togl = array_safe_get_fast(jun, 2, noone); + if(togl != noone) var toging = _inspecting.getInputData(togl); + + var lbx = (togl != noone) * ui(40); + var lbw = con_w - lbx; + var ltx = lbx + ui(32); + + if(_hover && point_in_rectangle(_m[0], _m[1], lbx, yy, con_w, yy + lbh)) { + contentPane.hover_content = true; + draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_hover, 1); + + if(mouse_press(mb_left, pFOCUS)) + jun[@ 1] = !coll; + if(mouse_press(mb_right, pFOCUS)) + menuCall("inspector_group_menu", group_menu, 0, 0, fa_left, _inspecting); + } else + draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_bg, 1); - #endregion - + if(filter_text == "") + draw_sprite_ui(THEME.arrow, 0, lbx + ui(16), yy + lbh / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1); + + var cc, aa = 1; + + if(togl != noone) { + if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, ui(32), yy + lbh)) { + contentPane.hover_content = true; + draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, 0, yy, ui(32), lbh, COLORS.panel_inspector_group_hover, 1); + + if(mouse_press(mb_left, pFOCUS)) + _inspecting.inputs[togl].setValue(!toging); + } else + draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, 0, yy, ui(32), lbh, COLORS.panel_inspector_group_bg, 1); + + cc = toging? COLORS._main_accent : COLORS.panel_inspector_group_bg; + aa = 0.5 + toging * 0.5; + + draw_sprite_ui(THEME.inspector_checkbox, 0, ui(16), yy + lbh / 2, 1, 1, 0, cc, 1); + if(toging) + draw_sprite_ui(THEME.inspector_checkbox, 1, ui(16), yy + lbh / 2, 1, 1, 0, cc, 1); + } + + draw_set_text(viewMode? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text, aa); + draw_text_add(ltx, yy + lbh / 2, txt); + draw_set_alpha(1); + + hh += lbh + ui(viewMode? 8 : 6) + pad; + + if(coll) { // skip + _colsp = true; + var j = i + 1; + var _len = array_length(_inspecting.input_display_list); + + while(j < _len) { + var j_jun = _inspecting.input_display_list[j]; + if(is_array(j_jun)) + break; + j++; + } + + i = j - 1; + } + + continue; + + } + if(!is_instanceof(jun, NodeValue)) continue; if(!jun.show_in_inspector || jun.type == VALUE_TYPE.object) continue; @@ -939,7 +936,7 @@ function Panel_Inspector() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) prop_selecting = jun; - if(mouse_press(mb_right, pFOCUS && mbRight)) { #region right click menu + if(mouse_press(mb_right, pFOCUS && mbRight)) { // right click menu prop_selecting = jun; var _menuItem = [ menu_junc_color, -1 ]; @@ -959,15 +956,15 @@ function Panel_Inspector() : PanelContent() constructor { if(_inp && jun.extract_node != "") { if(is_array(jun.extract_node)) { - var ext = menuItem(__txtx("panel_inspector_extract_multiple", "Extract to..."), function(_dat) { + var ext = menuItemShelf(__txtx("panel_inspector_extract_multiple", "Extract to..."), function(_dat) { var arr = []; for(var i = 0; i < array_length(__dialog_junction.extract_node); i++) { var _rec = __dialog_junction.extract_node[i]; - array_push(arr, menuItem(_rec, function(_dat) { __dialog_junction.extractNode(_dat.name); })); + array_push(arr, menuItem(_rec, function(_dat) { __dialog_junction.extractNode(_dat.name); }, noone, noone, noone, { name : _rec })); } return submenuCall(_dat, arr); - }).setIsShelf(); + }); array_push(_menuItem, ext); } else array_push(_menuItem, menu_junc_extract); @@ -975,36 +972,29 @@ function Panel_Inspector() : PanelContent() constructor { var dia = menuCall("inspector_value_menu", _menuItem); __dialog_junction = jun; - } #endregion + } } } - #region color picker - // if(key_mod_press(ALT) && color_picker_index) - // pickers[picker_index].editWidget.onColorPick(); - - if(MESSAGE != noone && MESSAGE.type == "Color") { - var inp = array_safe_get_fast(pickers, picker_index, 0); - if(is_struct(inp)) { - inp.setValue(MESSAGE.data); - MESSAGE = noone; - } + if(MESSAGE != noone && MESSAGE.type == "Color") { + var inp = array_safe_get_fast(pickers, picker_index, 0); + if(is_struct(inp)) { + inp.setValue(MESSAGE.data); + MESSAGE = noone; } - - color_picking = false; - #endregion + } - #region drag - if(prop_dragging) { - if(DRAGGING == noone && point_distance(prop_sel_drag_x, prop_sel_drag_y, mouse_mx, mouse_my) > 16) { - prop_dragging.dragValue(); - prop_dragging = noone; - } - - if(mouse_release(mb_left)) - prop_dragging = noone; + color_picking = false; + + if(prop_dragging) { //drag + if(DRAGGING == noone && point_distance(prop_sel_drag_x, prop_sel_drag_y, mouse_mx, mouse_my) > 16) { + prop_dragging.dragValue(); + prop_dragging = noone; } - #endregion + + if(mouse_release(mb_left)) + prop_dragging = noone; + } if(prop_highlight_time) { prop_highlight_time--; @@ -1033,13 +1023,13 @@ function Panel_Inspector() : PanelContent() constructor { _y += _hh; if(is_instanceof(inspecting, Node_Canvas) && inspecting.nodeTool != noone && is_instanceof(inspecting.nodeTool.nodeObject, Node)) - return drawNodeProperties(_y, _m, inspecting.nodeTool.nodeObject); + return _hh + drawNodeProperties(_y, _m, inspecting.nodeTool.nodeObject); if(inspectGroup >= 0) - return drawNodeProperties(_y, _m, inspecting); + return _hh + drawNodeProperties(_y, _m, inspecting); if(is_instanceof(inspecting, Node_Frame)) - return drawNodeProperties(_y, _m, inspecting); + return _hh + drawNodeProperties(_y, _m, inspecting); for( var i = 0, n = min(10, array_length(inspectings)); i < n; i++ ) { if(i) { diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 25673f179..306c7f505 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -38,11 +38,13 @@ registerFunction("", "Recent Files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function(_dat) { var arr = []; + var dat = []; for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) { var _rec = RECENT_FILES[| i]; - array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); })); + array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.path); }, noone, noone, noone, { path: _rec })); } - return submenuCall(_dat, arr) + + return submenuCall(_dat, arr); }).setMenu("recent_files",, true); registerFunction("", "Import .zip", "", MOD_KEY.none, __IMPORT_ZIP ).setMenu("import_zip", ) @@ -179,11 +181,13 @@ function Panel_Menu() : PanelContent() constructor { ]], [ __txt("Panels"), [ - menuItem(__txt("Workspace"), function(_dat) { - var arr = [], lays = []; + menuItemShelf(__txt("Workspace"), function(_dat) { + var arr = []; + var lay = []; + var f = file_find_first(DIRECTORY + "layouts/*", 0); while(f != "") { - array_push(lays, filename_name_only(f)); + array_push(lay, filename_name_only(f)); f = file_find_next(); } @@ -199,17 +203,15 @@ function Panel_Menu() : PanelContent() constructor { array_push(arr, MENU_ITEMS.reset_layout); array_push(arr, -1); - for(var i = 0; i < array_length(lays); i++) { - array_push(arr, menuItem(lays[i], - function(_dat) { - PREFERENCES.panel_layout_file = _dat.name; - PREF_SAVE(); - setPanel(); - },,, function(item) { return item.name == PREFERENCES.panel_layout_file; } )); + for(var i = 0; i < array_length(lay); i++) { + array_push(arr, menuItem(lay[i], + function(_dat) /*=>*/ { PREFERENCES.panel_layout_file = _dat.path; PREF_SAVE(); setPanel(); }, noone, noone, + function(item) /*=>*/ {return item.name == PREFERENCES.panel_layout_file}, + { path: lay[i] })); } return submenuCall(_dat, arr); - }).setIsShelf(), + }), -1, MENU_ITEMS.collections_panel, @@ -222,22 +224,22 @@ function Panel_Menu() : PanelContent() constructor { MENU_ITEMS.globalvar_panel, MENU_ITEMS.file_explorer_panel, - menuItem(__txt("Nodes"), function(_dat) { + menuItemShelf(__txt("Nodes"), function(_dat) { return submenuCall(_dat, [ MENU_ITEMS.align_panel, MENU_ITEMS.nodes_panel, MENU_ITEMS.tunnels_panel, ]); - } ).setIsShelf(), + }), - menuItem(__txt("Color"), function(_dat) { + menuItemShelf(__txt("Color"), function(_dat) { return submenuCall(_dat, [ MENU_ITEMS.color_panel, MENU_ITEMS.palettes_panel, MENU_ITEMS.palettes_mixer_panel, MENU_ITEMS.gradients_panel, ]); - } ).setIsShelf(), + }), MENU_ITEMS.preview_histogram, ]], @@ -265,9 +267,9 @@ function Panel_Menu() : PanelContent() constructor { menuItem(__txtx("panel_menu_test_error", "Display Error"), function() /*=>*/ { noti_error("Error message") }), menuItem(__txtx("panel_menu_test_crash", "Force crash"), function() /*=>*/ { print(1 + "a"); }), -1, - menuItem(__txt("Misc."), function(_dat) { + menuItemShelf(__txt("Misc."), function(_dat) { return submenuCall(_dat, [ menuItem(__txtx("panel_menu_node_credit", "Node credit dialog"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Cost()); }), ]); - } ).setIsShelf(), + }), ]]); } @@ -711,16 +713,18 @@ function Panel_Menu() : PanelContent() constructor { if(_b == 2) { _hov = true; var arr = []; + var dat = []; var tip = []; + for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) { var _rec = RECENT_FILES[| i]; var _dat = RECENT_FILE_DATA[| i]; - array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); })); + array_push(arr, menuItem(_rec, function(_dat) /*=>*/ {return LOAD_PATH(_dat.path)}, noone, noone, noone, { path: _dat.path }) ); array_push(tip, [ method(_dat, _dat.getThumbnail), VALUE_TYPE.surface ]); } var dia = hori? menuCall("title_recent_menu", arr, x + tcx, y + h, fa_center) : menuCall("title_recent_menu", arr, x + w, y + tby0); - dia.tooltips = tip; + dia.tooltips = tip; } if(hori) { diff --git a/scripts/panel_palette/panel_palette.gml b/scripts/panel_palette/panel_palette.gml index 786d47a48..387c3b91a 100644 --- a/scripts/panel_palette/panel_palette.gml +++ b/scripts/panel_palette/panel_palette.gml @@ -15,7 +15,7 @@ function Panel_Palette() : PanelContent() constructor { view_label = true; menu_refresh = menuItem(__txt("Refresh"), function() { __initPalette(); }); - menu_add = menuItem(__txt("Add"), function(_dat) { + menu_add = menuItemShelf(__txt("Add"), function(_dat) { return submenuCall(_dat, [ menuItem(__txt("File..."), function() { var _p = get_open_filename("hex|*.hex|gpl|*.gpl|Image|.png", "palette"); @@ -35,7 +35,7 @@ function Panel_Palette() : PanelContent() constructor { }).setName("Palette") }), ]); - }).setIsShelf(); + }); menu_stretch = menuItem(__txt("Stretch"), function() { PREFERENCES.palette_stretch = !PREFERENCES.palette_stretch; }, noone, noone, function() /*=>*/ {return PREFERENCES.palette_stretch}); menu_mini = menuItem(__txt("Label"), function() { view_label = !view_label; }, noone, noone, function() /*=>*/ {return view_label}); diff --git a/scripts/panel_preview_window/panel_preview_window.gml b/scripts/panel_preview_window/panel_preview_window.gml index b2fe5d542..9d71e7413 100644 --- a/scripts/panel_preview_window/panel_preview_window.gml +++ b/scripts/panel_preview_window/panel_preview_window.gml @@ -45,15 +45,15 @@ function Panel_Preview_Window() : PanelContent() constructor { pany = 0; } - function changeChannel(index) { - var channel = index - array_length(menu); + function changeChannel(_index) { + var channel = 0; + for( var i = 0; i < array_length(node_target.outputs); i++ ) { var o = node_target.outputs[i]; if(o.type != VALUE_TYPE.surface) continue; - if(channel-- == 0) { + + if(channel++ == _index) preview_channel = i; - return; - } } } @@ -159,11 +159,14 @@ function Panel_Preview_Window() : PanelContent() constructor { if(mouse_click(mb_right, pFOCUS)) { var _menu = array_clone(menu); + var _chan = 0; + for( var i = 0; i < array_length(node_target.outputs); i++ ) { var o = node_target.outputs[i]; if(o.type != VALUE_TYPE.surface) continue; - array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); })); + array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); }, noone, noone, noone, { index: _chan })); + _chan++; } menuCall("preview_window_menu", _menu, 0, 0, fa_left, node_target); }