diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index 1192d44e4..988a8b943 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/scripts/__node_3d_combine/__node_3d_combine.gml b/scripts/__node_3d_combine/__node_3d_combine.gml index edd51e7eb..e9abd8198 100644 --- a/scripts/__node_3d_combine/__node_3d_combine.gml +++ b/scripts/__node_3d_combine/__node_3d_combine.gml @@ -62,17 +62,13 @@ function __Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) constr ["Objects", true], ]; - setIsDynamicInput(1); - outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("3D objects", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - output_display_list = [ - 0, 2, 1 - ] + output_display_list = [ 0, 2, 1 ] _3d_node_init(1, /*Transform*/ 4, 5, 1, 2, 3); @@ -82,35 +78,8 @@ function __Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setVisible(true, true); array_push(input_display_list, index); - } - if(!LOADING && !APPENDING) createNewInput(); - - static refreshDynamicInput = function() { - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - var _d = []; - for( var i = 0, n = array_length(input_display_list); i < n; i++ ) { - var ind = input_display_list[i]; - - if(i < input_display_len || ind < ds_list_size(inputs)) - array_push(_d, input_display_list[i]); - } - input_display_list = _d; - - createNewInput(); - } + } setDynamicInput(1, true, VALUE_TYPE.d3object); static onValueFromUpdate = function(index) { if(index < input_fix_len) return; diff --git a/scripts/button/button.gml b/scripts/button/button.gml index 6d71f6b0d..c03c43ab2 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -132,7 +132,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { } #endregion } -function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) { #region +function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) { var res = 0; var cc = is_array(_icon_blend)? _icon_blend[0] : _icon_blend; @@ -161,4 +161,16 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n draw_sprite_ui_uniform(_icon, _icon_index, _x + _w / 2, _y + _h / 2, _icon_scale, cc, _icon_alpha); return res; -} #endregion \ No newline at end of file +} + +function buttonTextIconInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_label = "") { + var _b = buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light); + var bxc = _x + _w / 2 - (string_width(_icon_label) + ui(64)) / 2; + var byc = _y + _h / 2; + draw_sprite_ui(_icon, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light); + draw_text(bxc + ui(48), byc, _icon_label); + + return _b; +} \ No newline at end of file diff --git a/scripts/event_recorder/event_recorder.gml b/scripts/event_recorder/event_recorder.gml index 6cc1eea7a..23ce21835 100644 --- a/scripts/event_recorder/event_recorder.gml +++ b/scripts/event_recorder/event_recorder.gml @@ -85,9 +85,13 @@ function Action(_type, _object, _data, _trigger = 0) constructor { break; case ACTION_TYPE.junction_connect : - var _d = obj.value_from; - obj.setFrom(data); - data = _d; + if(obj.is_dummy) { + data[0].setFrom(noone); + } else { + var _d = obj.value_from; + obj.setFrom(data); + data = _d; + } break; case ACTION_TYPE.junction_disconnect : @@ -192,9 +196,14 @@ function Action(_type, _object, _data, _trigger = 0) constructor { break; case ACTION_TYPE.junction_connect : - var _d = obj.value_from; - obj.setFrom(data); - data = _d; + if(obj.is_dummy) { + obj.setFrom(data[1]); + data[0] = obj.dummy_target; + } else { + var _d = obj.value_from; + obj.setFrom(data); + data = _d; + } break; case ACTION_TYPE.junction_disconnect : diff --git a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml index fbd3d541e..4d0061039 100644 --- a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml +++ b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml @@ -42,7 +42,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) ["Material", false], in_mesh + 1, ] - setIsDynamicInput(1); + setDynamicInput(1, false); obj_reading = false; obj_raw = noone; diff --git a/scripts/node_3d_scene/node_3d_scene.gml b/scripts/node_3d_scene/node_3d_scene.gml index 2a8c82bea..21fdf3047 100644 --- a/scripts/node_3d_scene/node_3d_scene.gml +++ b/scripts/node_3d_scene/node_3d_scene.gml @@ -3,41 +3,15 @@ function Node_3D_Scene(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constru outputs[| 0] = nodeValue("Scene", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3Scene, noone); - setIsDynamicInput(1); - object_lists = []; - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Mesh, noone ) .setVisible(true, true); - } #endregion - if(!LOADING && !APPENDING) createNewInput(); - - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.d3Mesh); static processData = function(_output, _data, _output_index, _array_index = 0) { #region var _scene = new __3dGroup(); diff --git a/scripts/node_PCX_equation/node_PCX_equation.gml b/scripts/node_PCX_equation/node_PCX_equation.gml index 4d17a2dee..cdfc20173 100644 --- a/scripts/node_PCX_equation/node_PCX_equation.gml +++ b/scripts/node_PCX_equation/node_PCX_equation.gml @@ -1,21 +1,11 @@ function Node_PCX_Equation(_x, _y, _group = noone) : Node_PCX(_x, _y, _group) constructor { name = "Equation"; - setDimension(96, 48);; + setDimension(96, 48); ast = noone; inputs[| 0] = nodeValue("Equation", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - static createNewInput = function() { #region - var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) - .setDisplay(VALUE_DISPLAY.text_box); - - inputs[| index + 1] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.PCXnode, noone ) - .setVisible(true, true); - inputs[| index + 1].editWidget.interactable = false; - } #endregion - outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.PCXnode, noone ); argument_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region @@ -51,20 +41,29 @@ function Node_PCX_Equation(_x, _y, _group = noone) : Node_PCX(_x, _y, _group) co return hh; }); #endregion - argument_renderer.register = function(parent = noone) { #region - for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) - inputs[| i].editWidget.register(parent); - } #endregion input_display_list = [ ["Function", false], 0, ["Arguments", false], argument_renderer, ["Inputs", true], ] - - setIsDynamicInput(2); - if(!LOADING && !APPENDING) createNewInput(); + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + .setDisplay(VALUE_DISPLAY.text_box); + + inputs[| index + 1] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.PCXnode, noone ) + .setVisible(true, true); + inputs[| index + 1].editWidget.interactable = false; + + return inputs[| index + 0]; + } setDynamicInput(2, false); + + argument_renderer.register = function(parent = noone) { #region + for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) + inputs[| i].editWidget.register(parent); + } #endregion static refreshDynamicInput = function() { #region var _in = ds_list_create(); diff --git a/scripts/node_VCT/node_VCT.gml b/scripts/node_VCT/node_VCT.gml index 0e446fb49..c5461e9d9 100644 --- a/scripts/node_VCT/node_VCT.gml +++ b/scripts/node_VCT/node_VCT.gml @@ -15,8 +15,6 @@ function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const ["Automations", false], ]; - setIsDynamicInput(1); - static createNewInput = function(key = "") { var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); diff --git a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml index 0b2929f9e..a2c036e80 100644 --- a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml +++ b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml @@ -19,7 +19,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( var input = nodeBuild("Node_VFX_Spawner", x, y); var output = nodeBuild("Node_VFX_Renderer", x + 256, y); - output.inputs[| output.input_fix_len + 1].setFrom(input.outputs[| 0]); + output.dummy_input.setFrom(input.outputs[| 0]); addNode(input); addNode(output); diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index a88ee590c..7ce8da47e 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -24,12 +24,10 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr ["Rendering", false], 1, 2, 3, ]; - setIsDynamicInput(2); - attribute_surface_depth(); attribute_interpolation(); - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) @@ -40,7 +38,10 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setVisible(true, true); array_push(input_display_list, ["Particle", false], index + 0, index + 1); - } if(!LOADING && !APPENDING) createNewInput(); #endregion + + return inputs[| index + 1]; + } setDynamicInput(2, true, VALUE_TYPE.particle); + dyna_input_check_shift = 1; outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -49,42 +50,6 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onInspector2Update = function() { clearCache(); } - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - var _disp = []; - - for( var i = 0; i < input_display_len; i++ ) - array_push(_disp, input_display_list[i]); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_l, inputs[| i]); - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(!inputs[| i + 1].value_from) continue; - - ds_list_add(_l, inputs[| i + 0]); - ds_list_add(_l, inputs[| i + 1]); - - array_push(_disp, ["Particle", false], i + 0, i + 1); - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - input_display_list = _disp; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static step = function() { #region var _typ = getInputData(2); diff --git a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml index 258e41955..556005501 100644 --- a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml +++ b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml @@ -25,8 +25,6 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x ["Rendering", false], 1, 2, 3, ]; - setIsDynamicInput(2); - attribute_surface_depth(); attribute_interpolation(); @@ -35,7 +33,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x static onInspector2Update = function() { clearCache(); } - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) @@ -46,8 +44,11 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x .setVisible(true, true); array_push(input_display_list, ["Particle", false], index + 0, index + 1); - } if(!LOADING && !APPENDING) createNewInput(); #endregion + return inputs[| index + 1]; + } setDynamicInput(2, true, VALUE_TYPE.particle); + dyna_input_check_shift = 1; + static createOutput = function() { #region if(group == noone) return; if(!is_struct(group)) return; @@ -65,42 +66,6 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x group.sortIO(); } if(!LOADING && !APPENDING) createOutput(); #endregion - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - var _disp = []; - - for( var i = 0; i < input_display_len ; i ++ ) - array_push(_disp, input_display_list[i]); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_l, inputs[| i]); - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(!inputs[| i + 1].value_from) continue; - - ds_list_add(_l, inputs[| i + 0]); - ds_list_add(_l, inputs[| i + 1]); - - array_push(_disp, ["Particle", false], i + 0, i + 1); - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - input_display_list = _disp; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static step = function() { #region if(outParent == undefined) return; diff --git a/scripts/node_armature_bind/node_armature_bind.gml b/scripts/node_armature_bind/node_armature_bind.gml index 95dadb635..6349df153 100644 --- a/scripts/node_armature_bind/node_armature_bind.gml +++ b/scripts/node_armature_bind/node_armature_bind.gml @@ -66,8 +66,6 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr layer_remove = -1; layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region - PROCESSOR_OVERLAY_CHECK - ds_map_clear(surfMap); var index = -1; @@ -85,8 +83,6 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr array_push(surfMap[? _id], [ index, _surf ]); else surfMap[? _id] = [ [ index, _surf ] ]; - - //print($"Add {_surf} to {_id}"); } #region draw bones @@ -197,7 +193,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _ty, _w, bh - ui(32), COLORS._main_accent, 1); #endregion - var amo = floor((ds_list_size(inputs) - input_fix_len) / data_length) - 1; + var amo = floor((ds_list_size(inputs) - input_fix_len) / data_length); if(array_length(current_data) != ds_list_size(inputs)) return 0; if(use_data) { @@ -381,7 +377,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr ]; input_display_list_len = array_length(input_display_list); - function deleteLayer(index) { #region + function deleteLayer(index) { var idx = input_fix_len + index * data_length; for( var i = 0; i < data_length; i++ ) { ds_list_delete(inputs, idx); @@ -393,13 +389,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr input_display_list[i] = input_display_list[i] - data_length; } - if(ds_list_size(inputs) == input_fix_len) - createNewInput(); doUpdate(); - #endregion } - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); @@ -423,12 +416,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr array_push(attributes.layer_visible, true); while(_s >= array_length(attributes.layer_selectable)) array_push(attributes.layer_selectable, true); - #endregion - } - - setIsDynamicInput(6); - - if(!LOADING && !APPENDING) createNewInput(); + + return inputs[| index + 0]; + } setDynamicInput(6); temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ]; blend_temp_surface = temp_surface[2]; @@ -452,22 +442,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr bone = noone; surface_selecting = noone; - static getInputAmount = function() { #region - return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length; - } #endregion - static getInputIndex = function(index) { #region if(index < input_fix_len) return index; return input_fix_len + (index - input_fix_len) * data_length; } #endregion - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - - if(index + data_length >= ds_list_size(inputs)) - createNewInput(); - } #endregion - static setBone = function() { #region ds_map_clear(boneMap); diff --git a/scripts/node_armature_pose/node_armature_pose.gml b/scripts/node_armature_pose/node_armature_pose.gml index 7810299f0..c2da7f489 100644 --- a/scripts/node_armature_pose/node_armature_pose.gml +++ b/scripts/node_armature_pose/node_armature_pose.gml @@ -9,8 +9,6 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const ["Bones", false] ] - setIsDynamicInput(1); - outputs[| 0] = nodeValue("Armature", self, JUNCTION_CONNECT.output, VALUE_TYPE.armature, noone); boneMap = ds_map_create(); @@ -26,7 +24,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; }, new scrollBox(["Octahedral", "Stick"], function(ind) { attributes.display_bone = ind; })]); - static createNewInput = function(bone = noone) { #region + static createNewInput = function(bone = noone) { var index = ds_list_size(inputs); inputs[| index] = nodeValue(bone != noone? bone.name : "bone", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 1 ] ) @@ -38,7 +36,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const array_push(input_display_list, index); return inputs[| index]; - } #endregion + } setDynamicInput(1, false); static setBone = function() { #region //print("Setting dem bones..."); diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index 2e7614e68..2372a870f 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -3,6 +3,9 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { setDimension(96, 48); + attributes.size = 0; + attributes.spread_value = false; + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Any", "Surface", "Number", "Color", "Text" ], update_hover: false }) .rejectArray(); @@ -15,49 +18,36 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var bw = _w / 2 - ui(4); var bh = ui(36); - var bx = _x; - var by = _y + ui(8); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, _focus, _hover) == 2) { - var amo = ds_list_size(inputs) - input_fix_len; - attributes.size = amo + 1; + if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) { + attributes.size++; refreshDynamicInput(); update(); } - draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light); - var bxc = bx + bw / 2 - (string_width("Add") + ui(64)) / 2; - var byc = by + bh / 2; - draw_sprite_ui(THEME.add, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light); - draw_text(bxc + ui(48), byc, __txt("Add")); - - var bx = _x + bw + ui(8); var amo = attributes.size; - if(amo > 1 && buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, _focus, _hover) == 2) { - var amo = ds_list_size(inputs) - input_fix_len; - attributes.size = max(amo - 1, 1); + if(buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) { + attributes.size = max(attributes.size - 1, 0); refreshDynamicInput(); update(); } - draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light); - var bxc = bx + bw / 2 - (string_width("Remove") + ui(64)) / 2; - var byc = by + bh / 2; - draw_sprite_ui(THEME.minus, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light, (amo > 1) * 0.5 + 0.5); - draw_set_alpha((amo > 1) * 0.5 + 0.5); - draw_text(bxc + ui(48), byc, __txt("Remove")); - draw_set_alpha(1); - return _h; }); #endregion input_display_list = [ 0, 1, ["Contents", false], array_adjust_tool, ]; - setIsDynamicInput(1); - outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - attributes.size = 1; - attributes.spread_value = false; + static createNewInput = function() { + var index = ds_list_size(inputs); + var _typ = getType(); + + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, _typ, -1 ) + .setVisible(true, true); + array_push(input_display_list, index); + + return inputs[| index]; + } setDynamicInput(1); static getType = function() { #region var _type = getInputData(0); @@ -71,56 +61,33 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { } } #endregion - static createNewInput = function() { #region - var index = ds_list_size(inputs); - var _typ = getType(); - - inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, _typ, -1 ) - .setVisible(true, true); - array_push(input_display_list, index); - - return inputs[| index]; - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - //dummy_input = nodeValue("Add value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0).setDummy(function() { return createNewInput(); }); - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - var amo = attributes.size; - var extra = true; - var lastNode = noone; + var _l = ds_list_create(); + var amo = attributes.size; for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len + amo || inputs[| i].value_from) { - ds_list_add(_l, inputs[| i]); - if(i >= input_fix_len) - inputs[| i].setVisible(true, true); - } + var _inp = inputs[| i]; + + if(i < input_fix_len + amo || _inp.value_from) + ds_list_add(_l, _inp); } - var _add = amo - (ds_list_size(_l) - input_fix_len); - repeat(_add) { - lastNode = createNewInput(); - ds_list_add(_l, lastNode); - } + var _add = amo - getInputAmount(); + repeat(_add) ds_list_add(_l, createNewInput()); input_display_list = array_clone(input_display_list_raw); for( var i = input_fix_len; i < ds_list_size(_l); i++ ) { _l[| i].index = i; array_push(input_display_list, i); - - if(_l[| i].value_from == noone) - extra = false; } ds_list_destroy(inputs); inputs = _l; - if(extra) lastNode = createNewInput(); - _l[| ds_list_size(_l) - 1].setVisible(false, true); - getJunctionList(); + setHeight(); + } #endregion static updateType = function(resetVal = false) { #region @@ -183,10 +150,11 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(is_array(val) && spd) array_append(res, val); else array_push(res, val); + + if(_typ == VALUE_TYPE.any && inputs[| i].value_from) + outputs[| 0].setType(inputs[| i].value_from.type); } - if(_typ == VALUE_TYPE.any && inputs[| input_fix_len].value_from) - outputs[| 0].setType(inputs[| input_fix_len].value_from.type); outputs[| 0].setValue(res); if(outputs[| 0].type == VALUE_TYPE.surface) diff --git a/scripts/node_array_add/node_array_add.gml b/scripts/node_array_add/node_array_add.gml index c499d4221..096c5ba2a 100644 --- a/scripts/node_array_add/node_array_add.gml +++ b/scripts/node_array_add/node_array_add.gml @@ -1,7 +1,6 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Array Add"; setDimension(96, 32 + 24); - min_h = h; inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) .setVisible(true, true); @@ -11,8 +10,6 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - setIsDynamicInput(1); - static createNewInput = function() { var index = ds_list_size(inputs); @@ -20,33 +17,7 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct .setVisible(true, true); return inputs[| index]; - } - if(!LOADING && !APPENDING) createNewInput(); - - static refreshDynamicInput = function() { - var _l = ds_list_create(); - - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } - - static onValueFromUpdate = function(index) { - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } + } setDynamicInput(1); static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); @@ -65,7 +36,7 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0].setType(_type); var _out = array_clone(_arr); - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _val = getInputData(i); inputs[| i].setType(_type); diff --git a/scripts/node_array_zip/node_array_zip.gml b/scripts/node_array_zip/node_array_zip.gml index 0d2220d00..32102efdc 100644 --- a/scripts/node_array_zip/node_array_zip.gml +++ b/scripts/node_array_zip/node_array_zip.gml @@ -7,41 +7,14 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - setIsDynamicInput(1); - - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) .setVisible(true, true); return inputs[| index]; - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion + } setDynamicInput(1); static step = function() { #region if(inputs[| 0].value_from == noone) { @@ -52,7 +25,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0].setType(inputs[| 0].value_from.type); } - for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) + for( var i = 0; i < ds_list_size(inputs); i += data_length ) inputs[| i].setType(inputs[| i].value_from == noone? VALUE_TYPE.any : inputs[| i].value_from.type); } #endregion @@ -62,7 +35,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(!is_array(_arr)) return; var len = 1; var val = []; - for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = 0; i < ds_list_size(inputs); i += data_length ) { val[i] = getInputData(i); if(!is_array(val[i])) { @@ -75,7 +48,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _out = array_create(len); for( var i = 0; i < len; i++ ) { - for( var j = 0; j < ds_list_size(inputs) - 1; j += data_length ) + for( var j = 0; j < ds_list_size(inputs); j += data_length ) _out[i][j] = array_safe_get_fast(val[j], i, 0); } diff --git a/scripts/node_camera/node_camera.gml b/scripts/node_camera/node_camera.gml index 29f4b4c7b..762745787 100644 --- a/scripts/node_camera/node_camera.gml +++ b/scripts/node_camera/node_camera.gml @@ -27,11 +27,9 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co attribute_surface_depth(); - setIsDynamicInput(6); - temp_surface = [ noone, noone ]; - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); @@ -59,49 +57,8 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co for( var i = 0; i < data_length; i++ ) array_push(input_display_list, index + i); - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - static refreshDynamicInput = function() { #region - var _in = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); - - array_resize(input_display_list, input_display_len); - - var sep = false; - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(inputs[| i].value_from) { - if(sep) array_push(input_display_list, new Inspector_Spacer(20, true)); - sep = true; - - for( var j = 0; j < data_length; j++ ) { - ds_list_add(_in, inputs[| i + j]); - array_push(input_display_list, i + j); - } - - } else { - for( var j = 0; j < data_length; j++ ) - delete inputs[| i + j]; - } - } - - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; - - ds_list_destroy(inputs); - inputs = _in; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion + return inputs[| index + 0]; + } setDynamicInput(6, true, VALUE_TYPE.surface); static getPreviewValues = function() { return getInputData(input_fix_len); } @@ -131,8 +88,6 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region - if(!is_surface(_data[input_fix_len])) return; - var _area = _data[0]; var _zoom = _data[1]; @@ -157,7 +112,8 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co surface_clear(temp_surface[i]); } - var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1; + var amo = getInputAmount(); + if(amo <= 0) return _outSurf; shader_set(sh_camera); shader_set_f("camDimension", _surf_w, _surf_h); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index af05725cd..ca8e4e26a 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -37,11 +37,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region PROCESSOR_OVERLAY_CHECK - var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1; - if(array_length(current_data) != ds_list_size(inputs)) return 0; - - var lh = 28; - var eh = 36; + var amo = getInputAmount(); + var lh = 28; + var eh = 36; properties_expand = array_verify(properties_expand, amo); var _h = 4; @@ -85,22 +83,23 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _px, _py, _pw, _ph, COLORS.node_composite_bg_blend, 1); - var jun = inputs[| index + 4]; - var bl_wid = jun.editWidget; + var jn_bld = inputs[| index + 4]; + var jn_alp = inputs[| index + 5]; - var _param = new widgetParam(_px + 4, _py + 4, _pww, _pwh, jun.showValue(), jun.display_data, _m, layer_renderer.rx, layer_renderer.ry); - bl_wid.setFocusHover(_focus, _hover); + var wd_bld = jn_bld.editWidget; + var wd_alp = jn_alp.editWidget; - bl_wid.font = f_p2; - bl_wid.drawParam(_param); - bl_wid.font = f_p0; + var _param = new widgetParam(_px + 4, _py + 4, _pww, _pwh, jn_bld.showValue(), jn_bld.display_data, _m, layer_renderer.rx, layer_renderer.ry); + _param.font = f_p2; + + wd_bld.setFocusHover(_focus, _hover); + wd_bld.drawParam(_param); - var jun = inputs[| index + 5]; - var bl_wid = jun.editWidget; - - var _param = new widgetParam(_px + 4 + _pww + 8, _py + 4, _pww, _pwh, jun.showValue(), jun.display_data, _m, layer_renderer.rx, layer_renderer.ry); - bl_wid.setFocusHover(_focus, _hover); - bl_wid.drawParam(_param); + var _param = new widgetParam(_px + 4 + _pww + 8, _py + 4, _pww, _pwh, jn_alp.showValue(), jn_alp.display_data, _m, layer_renderer.rx, layer_renderer.ry); + _param.font = f_p2; + + wd_alp.setFocusHover(_focus, _hover); + wd_alp.drawParam(_param); } #endregion if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) { @@ -226,7 +225,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) ]; input_display_list_len = array_length(input_display_list); - setIsDynamicInput(6); function deleteLayer(index) { #region var idx = input_fix_len + index * data_length; @@ -246,7 +244,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) doUpdate(); } #endregion - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); @@ -279,8 +277,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) while(_s >= array_length(attributes.layer_selectable)) array_push(attributes.layer_selectable, true); - - } if(!LOADING && !APPENDING) createNewInput(); #endregion + + return inputs[| index + 0]; + } setDynamicInput(6); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -308,15 +307,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) surface_selecting = noone; - static getInputAmount = function() { INLINE return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length; } - - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - - if(index + data_length >= ds_list_size(inputs)) - createNewInput(); - } #endregion - static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region PROCESSOR_OVERLAY_CHECK @@ -438,9 +428,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _vis = attributes.layer_visible; var _sel = attributes.layer_selectable; - var amo = (ds_list_size(inputs) - input_fix_len) / data_length; - if(array_length(current_data) < input_fix_len + amo * data_length) - return; + var amo = getInputAmount(); var anchors = array_create(ds_list_size(inputs)); @@ -646,7 +634,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } var res_index = 0; - var imageAmo = (ds_list_size(inputs) - input_fix_len) / data_length; + var imageAmo = getInputAmount(); var _vis = attributes.layer_visible; var bg = 0; var _bg = 0; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 1752ca831..534bd63cc 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -187,6 +187,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { input_button_length = array_length(input_buttons); }); + + dummy_input = noone; #endregion #region --- attributes ---- @@ -420,10 +422,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { _hi += junction_draw_hei_y; } + if(auto_input && dummy_input) _hi += junction_draw_hei_y; + for( var i = 0; i < ds_list_size(outputs); i++ ) if(outputs[| i].isVisible()) _ho += junction_draw_hei_y; - h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height); + h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height); fix_h = h; } #endregion @@ -440,56 +444,76 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { return self; } #endregion - static setIsDynamicInput = function(_data_length = 1, _auto_input = true, _dynamic_input_cond = DYNA_INPUT_COND.connection) { #region - is_dynamic_input = true; - auto_input = _auto_input; + #region //////////////////////////////// Dynamic IO //////////////////////////////// + auto_input = false; + dyna_input_check_shift = 0; + static createNewInput = -1; - input_display_list_raw = array_clone(input_display_list); - input_display_len = input_display_list == -1? 0 : array_length(input_display_list); - input_fix_len = ds_list_size(inputs); - data_length = _data_length; + static setDynamicInput = function(_data_length = 1, _auto_input = true, _dummy_type = VALUE_TYPE.any, _dynamic_input_cond = DYNA_INPUT_COND.connection) { #region + is_dynamic_input = true; + auto_input = _auto_input; + dummy_type = _dummy_type; + + input_display_list_raw = array_clone(input_display_list, 1); + input_display_len = input_display_list == -1? 0 : array_length(input_display_list); + input_fix_len = ds_list_size(inputs); + data_length = _data_length; + + dynamic_input_cond = _dynamic_input_cond; + + if(auto_input) { + dummy_input = nodeValue("Add value", self, JUNCTION_CONNECT.input, dummy_type, 0) + .setDummy(function() { return createNewInput(); }) + .setVisible(false, true); + } + } #endregion - dynamic_input_cond = _dynamic_input_cond; - } #endregion - - static createNewInput = -1; - - static refreshDynamicInput = function() { #region - var _in = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); - - array_resize(input_display_list, input_display_len); - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - var _active = false; - if(dynamic_input_cond & DYNA_INPUT_COND.connection) - _active |= inputs[| i].value_from != noone; - if(dynamic_input_cond & DYNA_INPUT_COND.zero) { - var _val = inputs[| i].getValue(); - _active |= _val != 0 || _val != ""; + static refreshDynamicInput = function() { #region + var _in = ds_list_create(); + + for( var i = 0; i < input_fix_len; i++ ) + ds_list_add(_in, inputs[| i]); + + input_display_list = array_clone(input_display_list_raw, 1); + var sep = false; + + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { + var _active = false; + if(dynamic_input_cond & DYNA_INPUT_COND.connection) + _active |= inputs[| i + dyna_input_check_shift].value_from != noone; + + if(dynamic_input_cond & DYNA_INPUT_COND.zero) { + var _val = inputs[| i + dyna_input_check_shift].getValue(); + _active |= _val != 0 || _val != ""; + } + + if(_active) { + if(sep && data_length > 1) array_push(input_display_list, new Inspector_Spacer(20, true)); + sep = true; + + for( var j = 0; j < data_length; j++ ) { + var _ind = i + j; + + ds_list_add(_in, inputs[| _ind]); + if(input_display_list != -1) + array_push(input_display_list, _ind); + } + } else { + for( var j = 0; j < data_length; j++ ) + delete inputs[| i + j]; + } } - if(_active) { - for( var j = 0; j < data_length; j++ ) { - ds_list_add(_in, inputs[| i + j]); - array_push(input_display_list, i + j); - } - } else { - for( var j = 0; j < data_length; j++ ) - delete inputs[| i + j]; - } - } + for( var i = 0; i < ds_list_size(_in); i++ ) + _in[| i].index = i; + + ds_list_destroy(inputs); + inputs = _in; + } #endregion + + static getInputAmount = function() { return (ds_list_size(inputs) - input_fix_len) / data_length; } - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; - - ds_list_destroy(inputs); - inputs = _in; - - createNewInput(); - } #endregion + #endregion //////////////////////////////// Dynamic IO //////////////////////////////// static getOutput = function(junc = noone) { #region for( var i = 0; i < ds_list_size(outputs); i++ ) { @@ -502,6 +526,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } #endregion static getInput = function(junc = noone, shift = input_fix_len) { #region + if(dummy_input) return dummy_input; + for( var i = shift; i < ds_list_size(inputs); i++ ) { var _inp = inputs[| i]; @@ -554,7 +580,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(!LOADING) PROJECT.modified = true; } #endregion - #region ++++ inspector update ++++ + #region //// inspector update static onInspector1Update = noone; static inspector1Update = function() { INLINE onInspector1Update(); } static hasInspector1Update = function() { INLINE return NODE_HAS_INSP1; } @@ -739,7 +765,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static valueFromUpdate = function(index) { #region onValueFromUpdate(index); - if(is_dynamic_input) will_setHeight = true; + if(auto_input && !LOADING && !APPENDING) + refreshDynamicInput(); + + if(is_dynamic_input) + will_setHeight = true; + cacheCheck(); } #endregion @@ -982,6 +1013,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { array_push(inputDisplayList, jun); } + + if(auto_input && dummy_input) array_push(inputDisplayList, dummy_input); }#endregion static preDraw = function(_x, _y, _s) { #region @@ -1293,8 +1326,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var yy = y * _s + _y; var _hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == self); - show_input_name = _hov && point_in_rectangle(_mx, _my, xx - 8 * _s, yy + 20 * _s, xx + 8 * _s, yy + h * _s); - show_output_name = _hov && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s); + show_input_name = _hov && point_in_rectangle(_mx, _my, xx - 12 * _s, yy + 20 * _s, xx + 12 * _s, yy + h * _s); + show_output_name = _hov && point_in_rectangle(_mx, _my, xx + (w - 12) * _s, yy + 20 * _s, xx + (w + 12) * _s, yy + h * _s); if(show_input_name) { for(var i = 0, n = array_length(inputDisplayList); i < n; i++) { diff --git a/scripts/node_equation/node_equation.gml b/scripts/node_equation/node_equation.gml index dcbd34468..14cb752fe 100644 --- a/scripts/node_equation/node_equation.gml +++ b/scripts/node_equation/node_equation.gml @@ -37,17 +37,9 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) setDimension(96, 48); ast = []; - inputs[| 0] = nodeValue("Equation", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + attributes.size = 0; - static createNewInput = function() { #region - var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) - .setDisplay(VALUE_DISPLAY.text_box); - - inputs[| index + 1] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) - .setVisible(true, true); - inputs[| index + 1].editWidget.interactable = false; - } #endregion + inputs[| 0] = nodeValue("Equation", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); @@ -56,9 +48,24 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) argument_renderer.y = _y; argument_renderer.w = _w; - var tx = _x + ui(8); - var ty = _y + ui(8); - var hh = ui(8); + var bw = _w / 2 - ui(4); + var bh = ui(36); + if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) { + attributes.size++; + refreshDynamicInput(); + update(); + } + + var amo = attributes.size; + if(buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) { + attributes.size = max(attributes.size - 1, 0); + refreshDynamicInput(); + update(); + } + + var tx = _x + ui(8); + var ty = _y + bh + ui(16); + var hh = bh + ui(16); var _th = TEXTBOX_HEIGHT; for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { @@ -94,42 +101,48 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) ["Arguments", false], argument_renderer, ["Inputs", true], ] - - setIsDynamicInput(2); - if(!LOADING && !APPENDING) createNewInput(); + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + .setDisplay(VALUE_DISPLAY.text_box); + + inputs[| index + 1] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + .setVisible(true, true); + + return inputs[| index + 0]; + } setDynamicInput(2, false); static refreshDynamicInput = function() { #region - var _in = ds_list_create(); + var _l = ds_list_create(); + var amo = attributes.size; - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); + for(var i = 0; i < input_fix_len; i++ ) + ds_list_add(_l, inputs[| i]); - array_resize(input_display_list, input_display_len); - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - var varName = getInputData(i); + for(var i = 0; i < amo; i++ ) { + var _i = input_fix_len + i * data_length; - if(varName != "") { - ds_list_add(_in, inputs[| i + 0]); - ds_list_add(_in, inputs[| i + 1]); - inputs[| i + 1].editWidget.setInteract(true); - inputs[| i + 1].name = varName; - - array_push(input_display_list, i + 1); - } else { - delete inputs[| i + 0]; - delete inputs[| i + 1]; - } + if(_i >= ds_list_size(_l)) + createNewInput(); + + for(var j = 0; j < data_length; j++) + ds_list_add(_l, inputs[| _i + j]); } - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; + input_display_list = array_clone(input_display_list_raw); + + for( var i = input_fix_len; i < ds_list_size(_l); i++ ) { + _l[| i].index = i; + array_push(input_display_list, i); + } ds_list_destroy(inputs); - inputs = _in; + inputs = _l; + + getJunctionList(); + setHeight(); - createNewInput(); } #endregion static onValueUpdate = function(index = 0) { #region @@ -137,8 +150,6 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(safe_mod(index - input_fix_len, data_length) == 0) //Variable name inputs[| index + 1].name = getInputData(index); - - refreshDynamicInput(); } #endregion static processData = function(_output, _data, _output_index, _array_index = 0) { #region diff --git a/scripts/node_hlsl/node_hlsl.gml b/scripts/node_hlsl/node_hlsl.gml index 278006408..8b017042f 100644 --- a/scripts/node_hlsl/node_hlsl.gml +++ b/scripts/node_hlsl/node_hlsl.gml @@ -55,7 +55,7 @@ output.color = surfaceColor;") ["Values", true], ]; - setIsDynamicInput(3, false); + setDynamicInput(3, false); static refreshDynamicInput = function() { #region var _in = ds_list_create(); diff --git a/scripts/node_image_grid/node_image_grid.gml b/scripts/node_image_grid/node_image_grid.gml index 1d2a289b2..60aa6cde3 100644 --- a/scripts/node_image_grid/node_image_grid.gml +++ b/scripts/node_image_grid/node_image_grid.gml @@ -17,47 +17,22 @@ function Node_Image_Grid(_x, _y, _group = noone) : Node(_x, _y, _group) construc .setDisplay(VALUE_DISPLAY.padding) .rejectArray(); - setIsDynamicInput(1); - - static createNewInput = function() { #region - var index = ds_list_size(inputs); - inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) - .setVisible(true, true); - } if(!LOADING && !APPENDING) createNewInput(); #endregion - outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []); temp_surface = [ noone, noone ]; + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) + .setVisible(true, true); + + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.surface); + attribute_surface_depth(); - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static update = function(frame = CURRENT_FRAME) { #region var _axis = getInputData(0); var _col = getInputData(1); @@ -68,7 +43,7 @@ function Node_Image_Grid(_x, _y, _group = noone) : Node(_x, _y, _group) construc var hh = 0; var surfs = []; - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { var _surf = getInputData(i); if(!is_array(_surf)) _surf = [ _surf ]; diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index 97fe75d89..9446dc650 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -38,19 +38,6 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 1] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {}); - setIsDynamicInput(1); - output_fix_len = ds_list_size(outputs); - - static createNewInput = function() { #region - var index = ds_list_size(inputs); - inputs[| index] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) - .setVisible(true, true); - - var index = ds_list_size(outputs); - outputs[| index] = nodeValue("Values", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) - .setVisible(true, true); - } if(!LOADING && !APPENDING) createNewInput(); #endregion - content = {}; path_current = ""; edit_time = 0; @@ -78,47 +65,6 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons triggerRender(); } #endregion - static refreshDynamicInput = function() { #region - var _in = ds_list_create(); - var _ot = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); - - for( var i = 0; i < output_fix_len; i++ ) - ds_list_add(_ot, outputs[| i]); - - for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { - if(getInputData(i) != "") { - ds_list_add(_in, inputs[| i + 0]); - ds_list_add(_ot, outputs[| i + 1]); - } else { - delete inputs[| i + 0]; - delete outputs[| i + 1]; - } - } - - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; - for( var i = 0; i < ds_list_size(_ot); i++ ) - _ot[| i].index = i; - - ds_list_destroy(inputs); - inputs = _in; - - ds_list_destroy(outputs); - outputs = _ot; - - createNewInput(); - } #endregion - - static onValueUpdate = function(index = 0) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - function updatePaths(path) { #region if(path == -1) return false; @@ -153,40 +99,6 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons if(path_current != path) updatePaths(path); outputs[| 1].setValue(content); - - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { - var key = getInputData(i); - var out = outputs[| i + 1]; - - out.name = key; - var keys = string_splice(key, "."); - var _str = content; - - for( var j = 0; j < array_length(keys); j++ ) { - var k = keys[j]; - - if(!variable_struct_exists(_str, k)) { - out.setValue(0); - out.setType(VALUE_TYPE.float); - break; - } - - var val = variable_struct_get(_str, k); - if(j == array_length(keys) - 1) { - if(is_struct(val)) - out.setType(VALUE_TYPE.struct); - else if(is_array(val) && array_length(val)) - out.setType(is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float); - else - out.setType(is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float); - - out.setValue(val); - } - - if(is_struct(val)) _str = val; - else break; - } - } } #endregion static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region @@ -196,6 +108,4 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } #endregion - - static doApplyDeserialize = function() { refreshDynamicInput(); } } \ No newline at end of file diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index 5f744104f..76721b05b 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -11,71 +11,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con inputs[| 1] = nodeValue("Struct", self, JUNCTION_CONNECT.input, VALUE_TYPE.struct, {}) .setVisible(true, true); - static createNewInput = function() { - var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - - inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) - .setVisible(false, false); - - array_push(input_display_list, index + 0); - array_push(input_display_list, index + 1); - } - - input_display_list = [ 0, 1, - ["Inputs", false], - ] - - setIsDynamicInput(3); - - if(!LOADING && !APPENDING) createNewInput(); - - static refreshDynamicInput = function() { - var _in = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); - - array_resize(input_display_list, input_display_len); - - if(inputs[| 1].value_from != noone) { - ds_list_destroy(inputs); - inputs = _in; - return; - } - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(getInputData(i) != "") { - ds_list_add(_in, inputs[| i + 0]); - ds_list_add(_in, inputs[| i + 1].setVisible(false, true)); - - array_push(input_display_list, i + 0); - array_push(input_display_list, i + 1); - } else { - delete inputs[| i + 0]; - delete inputs[| i + 1]; - } - } - - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; - - ds_list_destroy(inputs); - inputs = _in; - - createNewInput(); - } - - static onValueUpdate = function(index = 0) { - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - if(safe_mod(index - input_fix_len, data_length) == 0) { //Variable name - inputs[| index + 1].name = getInputData(index) + " value"; - } - - refreshDynamicInput(); - } + input_display_list = [ 0, 1 ] static writeFile = function() { var path = getInputData(0); @@ -83,31 +19,10 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con if(filename_ext(path) != ".json") path += ".json"; - var cont = {}; - - if(inputs[| 1].value_from == noone) { - for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { - var _key = getInputData(i + 0); - var _val = getInputData(i + 1); - - inputs[| i + 1].setType(inputs[| i + 1].value_from? inputs[| i + 1].value_from.type : VALUE_TYPE.any); - - variable_struct_set(cont, _key, _val); - } - } else - cont = getInputData(1); - + var cont = getInputData(1); json_save_struct(path, cont); } - static step = function() { - for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) { - var inp = inputs[| i + 1]; - var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type; - inp.setType(typ); - } - } - static update = function(frame = CURRENT_FRAME) { writeFile(); } static onInspector1Update = function() { writeFile(); } @@ -122,8 +37,4 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } - - static doApplyDeserialize = function() { - refreshDynamicInput(); - } } \ No newline at end of file diff --git a/scripts/node_logic/node_logic.gml b/scripts/node_logic/node_logic.gml index ed4be4241..d2aa5e784 100644 --- a/scripts/node_logic/node_logic.gml +++ b/scripts/node_logic/node_logic.gml @@ -41,17 +41,8 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { new scrollItem("Xor" , s_node_logic, 5), ]) .rejectArray(); - inputs[| 1] = nodeValue("a", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) - .setVisible(true, true); - - input_display_list = [ - 0, 1, - ] - outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); - setIsDynamicInput(1); - static createNewInput = function() { var index = ds_list_size(inputs); @@ -59,37 +50,8 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| index] = nodeValue(jname, self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) .setVisible(true, true); - array_push(input_display_list, index); return inputs[| index]; - } - - if!(LOADING || APPENDING) - createNewInput(); - - static refreshDynamicInput = function() { - var _in = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - ds_list_add(_in, inputs[| i]); - - array_resize(input_display_list, input_display_len); - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(inputs[| i].value_from) { - ds_list_add(_in, inputs[| i]); - array_push(input_display_list, i); - } else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_in); i++ ) - _in[| i].index = i; - - ds_list_destroy(inputs); - inputs = _in; - - createNewInput(); - } + } setDynamicInput(1, true, VALUE_TYPE.boolean); static trimInputs = function(amo) { if(ds_list_size(inputs) < amo + 1) { @@ -99,7 +61,6 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { while(ds_list_size(inputs) > amo + 1) ds_list_delete(inputs, amo + 1); } - array_resize(input_display_list, amo + 1); } static onValueUpdate = function(index) { @@ -109,50 +70,34 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { switch(mode) { case LOGIC_OPERATOR.lnot : trimInputs(1); + auto_input = false; return; + case LOGIC_OPERATOR.lnand : case LOGIC_OPERATOR.lnor : case LOGIC_OPERATOR.lxor : trimInputs(2); + auto_input = false; return; case LOGIC_OPERATOR.land : case LOGIC_OPERATOR.lor : - while(ds_list_size(inputs) < 3) - createNewInput(); - return; - } - } - - static onValueFromUpdate = function(index) { - if(LOADING || APPENDING) return; - - var mode = getInputData(0); - switch(mode) { - case LOGIC_OPERATOR.lnot : - trimInputs(1); - return; - case LOGIC_OPERATOR.lnand : - case LOGIC_OPERATOR.lnor : - case LOGIC_OPERATOR.lxor : - trimInputs(2); + auto_input = true; return; } - if(index < input_fix_len) return; - - refreshDynamicInput(); + will_setHeight = true; } static _eval = function(mode, a, b) { switch(mode) { - case LOGIC_OPERATOR.land : return bool(a) && bool(b); - case LOGIC_OPERATOR.lor : return bool(a) || bool(b); + case LOGIC_OPERATOR.land : return bool(a) && bool(b); + case LOGIC_OPERATOR.lor : return bool(a) || bool(b); case LOGIC_OPERATOR.lnot : return !bool(a); case LOGIC_OPERATOR.lnand : return !(bool(a) && bool(b)); case LOGIC_OPERATOR.lnor : return !(bool(a) || bool(b)); - case LOGIC_OPERATOR.lxor : return bool(a) ^^ bool(b); + case LOGIC_OPERATOR.lxor : return bool(a) ^^ bool(b); } return false; } @@ -199,7 +144,8 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { case LOGIC_OPERATOR.land : case LOGIC_OPERATOR.lor : var val = a; - var to = max(2, ds_list_size(inputs) - 1); + var to = ds_list_size(inputs); + for( var i = 2; i < to; i++ ) { var b = getInputData(i); val = evalLogicArray(mode, val, b); diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 017a72d5b..bbb04ca38 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -28,14 +28,12 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru ["Inputs", true], ]; - setIsDynamicInput(3, false); - argument_name = []; argument_val = []; lua_state = lua_create(); - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); @@ -46,7 +44,12 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); inputs[| index + 2].editWidget.interactable = false; - } if(!LOADING && !APPENDING) createNewInput(); #endregion + + return inputs[| index + 0]; + } + + setDynamicInput(3, false); + if(!LOADING && !APPENDING) createNewInput(); static getState = function() { #region if(inputs[| 3].value_from == noone) return lua_state; @@ -71,15 +74,6 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(inputs[| i + 2].editWidget != noone) inputs[| i + 2].editWidget.interactable = true; - var type = getInputData(i + 1); - switch(type) { - case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break; - case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break; - case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break; - case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break; - } - - inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); array_push(input_display_list, i + 2); } else { delete inputs[| i + 0]; @@ -94,13 +88,31 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru ds_list_destroy(inputs); inputs = _in; + refreshInputType(); createNewInput(); } #endregion + static refreshInputType = function() { #region + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { + var type = getInputData(i + 1); + switch(type) { + case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break; + case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break; + case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break; + case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break; + } + + inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); + } + } #endregion + static onValueUpdate = function(index = 0) { #region if(LOADING || APPENDING) return; - if((index - input_fix_len) % data_length == 0) refreshDynamicInput(); + var _ind = (index - input_fix_len) % data_length; + + if(_ind == 0) refreshDynamicInput(); + else if(_ind == 1) refreshInputType(); } #endregion static step = function() { #region diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index 9edfb0946..924614732 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -30,14 +30,12 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru ["Inputs", true], ]; - setIsDynamicInput(3, false); - argument_name = []; argument_val = []; lua_state = lua_create(); - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); @@ -48,7 +46,12 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); inputs[| index + 2].editWidget.interactable = false; - } if(!LOADING && !APPENDING) createNewInput(); #endregion + + return inputs[| index + 0]; + } + + setDynamicInput(3, false); + if(!LOADING && !APPENDING) createNewInput(); static getState = function() { #region if(inputs[| 3].value_from == noone) @@ -74,15 +77,6 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(inputs[| i + 2].editWidget != noone) inputs[| i + 2].editWidget.interactable = true; - var type = getInputData(i + 1); - switch(type) { - case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break; - case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break; - case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break; - case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break; - } - - inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); array_push(input_display_list, i + 2); } else { delete inputs[| i + 0]; @@ -97,13 +91,31 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru ds_list_destroy(inputs); inputs = _in; + refreshInputType(); createNewInput(); } #endregion + static refreshInputType = function() { #region + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { + var type = getInputData(i + 1); + switch(type) { + case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break; + case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break; + case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break; + case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break; + } + + inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); + } + } #endregion + static onValueUpdate = function(index = 0) { #region if(LOADING || APPENDING) return; - if((index - input_fix_len) % data_length == 0) refreshDynamicInput(); + var _ind = (index - input_fix_len) % data_length; + + if(_ind == 0) refreshDynamicInput(); + else if(_ind == 1) refreshInputType(); } #endregion static step = function() { #region diff --git a/scripts/node_midi_in/node_midi_in.gml b/scripts/node_midi_in/node_midi_in.gml index dd0749cd0..8cdab09cd 100644 --- a/scripts/node_midi_in/node_midi_in.gml +++ b/scripts/node_midi_in/node_midi_in.gml @@ -28,40 +28,24 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var bw = _w / 2 - ui(4); var bh = ui(36); - var bx = _x; - var by = _y + ui(8); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, _focus, _hover) == 2) { + if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) { createNewInput(); } - draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light); - var bxc = bx + bw / 2 - (string_width("Add") + ui(64)) / 2; - var byc = by + bh / 2; - draw_sprite_ui(THEME.add, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light); - draw_text(bxc + ui(48), byc, __txt("Add")); - - var bx = _x + bw + ui(8); var amo = ds_list_size(inputs); - if(amo > 1 && buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, _focus, _hover) == 2) { + if(amo > 1 && buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) { var _out = outputs[| ds_list_size(outputs) - 1]; for( var i = 0, n = array_length(_out.value_to); i < n; i++ ) _out.value_to[i].removeFrom(); array_remove(input_display_list, ds_list_size(inputs) - 1); ds_list_delete(inputs, ds_list_size(inputs) - 1); + ds_list_delete(inputs, ds_list_size(inputs) - 1); ds_list_delete(outputs, ds_list_size(outputs) - 1); } - draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light); - var bxc = bx + bw / 2 - (string_width("Remove") + ui(64)) / 2; - var byc = by + bh / 2; - draw_sprite_ui(THEME.minus, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light, (amo > 1) * 0.5 + 0.5); - draw_set_alpha((amo > 1) * 0.5 + 0.5); - draw_text(bxc + ui(48), byc, __txt("Remove")); - draw_set_alpha(1); - var _wx = TEXTBOX_HEIGHT + ui(16); - var _wy = by + bh + ui(8); + var _wy = _y + bh + ui(16); var _wh = TEXTBOX_HEIGHT; var _ww = _w - _wx - _wh - ui(8); @@ -110,10 +94,9 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor ["Watchers", false], watcher_controllers, ]; - setIsDynamicInput(2); - - static createNewInput = function() { #region - index_watching = ds_list_size(inputs); + static createNewInput = function() { + var _index = ds_list_size(inputs); + index_watching = _index; var _inp = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, -1 ); _inp.editWidget.slidable = false; @@ -121,7 +104,9 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor ds_list_add(inputs, nodeValue("Normalize", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )); ds_list_add(outputs, nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1 )); - } #endregion + + return _inp; + } setDynamicInput(2, false); index_watching = noone; disp_value = 0; diff --git a/scripts/node_mk_flare/node_mk_flare.gml b/scripts/node_mk_flare/node_mk_flare.gml index c7ffca419..d2cbe8b4a 100644 --- a/scripts/node_mk_flare/node_mk_flare.gml +++ b/scripts/node_mk_flare/node_mk_flare.gml @@ -95,8 +95,6 @@ function Node_MK_Flare(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _flares = inputs[| 5].getValue(); var _amo = array_length(_flares); - //print($"{_flares}: {_amo}"); - var _fx = _x; var _fy = _y + ui(8); var _fh = ui(32); @@ -314,12 +312,6 @@ function Node_MK_Flare(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) flares = []; - setIsDynamicInput(1); - - static createNewInput = function() { #region - ds_list_add(inputs, nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [] ).setArrayDepth(1)); - } #endregion - ox = 0; oy = 0; cx = 0 diff --git a/scripts/node_module_test/node_module_test.gml b/scripts/node_module_test/node_module_test.gml index 14d47bbf0..287d609e4 100644 --- a/scripts/node_module_test/node_module_test.gml +++ b/scripts/node_module_test/node_module_test.gml @@ -13,7 +13,7 @@ function Node_Module_Test(_x, _y, _group = noone) : Node(_x, _y, _group) constru //input_display_list = [ 0 ]; - setIsDynamicInput(1); + setDynamicInput(1); static createNewInput = function() { #region var index = ds_list_size(inputs); diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index 93d11d65f..42faf7a9c 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -41,7 +41,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { ["Anchors", false], ]; - setIsDynamicInput(1); + setDynamicInput(1, false); tool_pathDrawer = new NodeTool( "Draw path", THEME.path_tools_draw ) .addSetting("Smoothness", VALUE_TYPE.float, function(val) { tool_pathDrawer.attribute.thres = val; }, "thres", 4) diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index 5f0d840b5..9e032c228 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -2,7 +2,6 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc name = "Path Array"; setDimension(96, 48);; - setIsDynamicInput(1); cached_pos = ds_map_create(); outputs[| 0] = nodeValue("Path array", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); @@ -14,39 +13,11 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc .setVisible(true, true); return inputs[| index]; - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - _l[| i] = inputs[| i]; - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion + } setDynamicInput(1, true, VALUE_TYPE.pathnode); static getLineCount = function() { #region var l = 0; - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); l += struct_has(_path, "getLineCount")? _path.getLineCount() : 1; } @@ -54,7 +25,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getSegmentCount = function(ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -66,7 +37,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getLength = function(ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -78,7 +49,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getAccuLength = function(ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -90,7 +61,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getPointRatio = function(_rat, ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -102,7 +73,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getPointDistance = function(_dist, ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -114,7 +85,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getBoundary = function(ind = 0) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -126,7 +97,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _path = getInputData(i); if(!struct_has(_path, "drawOverlay")) continue; diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index 81c36e919..20434a239 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -32,13 +32,15 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 7] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); - setIsDynamicInput(2); - - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Name " + string(index - input_fix_len), self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); inputs[| index + 1] = nodeValue("Rule " + string(index - input_fix_len), self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - } #endregion + + return inputs[| index + 0]; + } + + setDynamicInput(2, false); if(!LOADING && !APPENDING) createNewInput(); outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); @@ -138,12 +140,11 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const createNewInput(); } #endregion - static onValueUpdate = function(index) { - if(LOADING || APPENDING) return; - - refreshDynamicInput(); + static onValueUpdate = function(index) { #region + if(index > input_fix_len && !LOADING && !APPENDING) + refreshDynamicInput(); } - + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region inputs[| 2].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -273,9 +274,11 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const if(ds_list_size(inputs) < input_fix_len + 2) return; var rules = {}; - for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { var _name = getInputData(i + 0); var _rule = getInputData(i + 1); + if(_name == "") continue; + if(!struct_has(rules, _name)) rules[$ _name] = [ _rule ]; else diff --git a/scripts/node_path_smooth/node_path_smooth.gml b/scripts/node_path_smooth/node_path_smooth.gml index 01577fbb7..eda61b003 100644 --- a/scripts/node_path_smooth/node_path_smooth.gml +++ b/scripts/node_path_smooth/node_path_smooth.gml @@ -18,7 +18,7 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru ["Anchors", false], ]; - setIsDynamicInput(1); + setDynamicInput(1, false); tools = [ new NodeTool( "Anchor add / remove", THEME.path_tools_add ), @@ -265,10 +265,10 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru ]; } else { for( var i = 0, n = amo; i < n; i++ ) { - var _a0 = array_safe_get_fast(anchors, i - 1,, ARRAY_OVERFLOW.loop); - var _a1 = array_safe_get_fast(anchors, i ,, ARRAY_OVERFLOW.loop); - var _a2 = array_safe_get_fast(anchors, i + 1,, ARRAY_OVERFLOW.loop); - + var _a0 = array_safe_get_fast(anchors, (i - 1) % n, [ 0, 0 ]); + var _a1 = array_safe_get_fast(anchors, (i ) % n, [ 0, 0 ]); + var _a2 = array_safe_get_fast(anchors, (i + 1) % n, [ 0, 0 ]); + var _dr = point_direction(_a0[0], _a0[1], _a2[0], _a2[1]); var _ds0 = point_distance(_a1[0], _a1[1], _a0[0], _a0[1]) / smot; var _ds2 = point_distance(_a1[0], _a1[1], _a2[0], _a2[1]) / smot; diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index fa33a1ff0..d5571698a 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -5,7 +5,7 @@ enum ARRAY_PROCESS { expand_inv, } -#macro PROCESSOR_OVERLAY_CHECK if(array_length(current_data) != ds_list_size(inputs)) return; +#macro PROCESSOR_OVERLAY_CHECK if(array_length(current_data) != ds_list_size(inputs)) return 0; function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { attributes.array_process = ARRAY_PROCESS.loop; diff --git a/scripts/node_rigid_group_inline/node_rigid_group_inline.gml b/scripts/node_rigid_group_inline/node_rigid_group_inline.gml index 18da588e0..4bea50278 100644 --- a/scripts/node_rigid_group_inline/node_rigid_group_inline.gml +++ b/scripts/node_rigid_group_inline/node_rigid_group_inline.gml @@ -13,7 +13,7 @@ function Node_Rigid_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inlin var _object = nodeBuild("Node_Rigid_Object", x, y); var _output = nodeBuild("Node_Rigid_Render", x + 160, y); - _output.inputs[| 2].setFrom(_object.outputs[| 0]) + _output.dummy_input.setFrom(_object.outputs[| 0]) addNode(_object); addNode(_output); diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 72ad860be..1fe6067f3 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -15,8 +15,6 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - setIsDynamicInput(1); - attribute_surface_depth(); attributes.show_objects = true; @@ -31,36 +29,13 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onInspector2Update = function() { clearCache(); } - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone ) .setVisible(true, true); - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.rigid); static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; @@ -98,7 +73,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr draw_set_color(c_white); physics_world_draw_debug(flag); } else { - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { var objNode = getInputData(i); if(!is_array(objNode)) continue; diff --git a/scripts/node_rigid_render_output/node_rigid_render_output.gml b/scripts/node_rigid_render_output/node_rigid_render_output.gml index 849e828bd..40c4ecc54 100644 --- a/scripts/node_rigid_render_output/node_rigid_render_output.gml +++ b/scripts/node_rigid_render_output/node_rigid_render_output.gml @@ -13,8 +13,6 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) - setIsDynamicInput(1); - attribute_surface_depth(); attributes.show_objects = true; @@ -24,11 +22,13 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x attributes.show_objects = !attributes.show_objects; })]); - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone ) .setVisible(true, true); - } if(!LOADING && !APPENDING) createNewInput(); #endregion + + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.rigid); static createOutput = function() { #region if(group == noone) return; @@ -47,31 +47,6 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x group.sortIO(); } if(!LOADING && !APPENDING) createOutput(); #endregion - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; if(inline_context != noone) gr = inline_context; diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index 3468feca1..a6e87dea5 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -17,15 +17,6 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| 3] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.padding) .rejectArray(); - - setIsDynamicInput(1); - - static createNewInput = function() { #region - var index = ds_list_size(inputs); - inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) - .setVisible(true, true); - } #endregion - if(!LOADING && !APPENDING) createNewInput(); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -33,33 +24,16 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { temp_surface = [ noone, noone ]; + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) + .setVisible(true, true); + + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.surface); + attribute_surface_depth(); - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - for( var i = 0; i < ds_list_size(inputs); i++ ) { - if(i < input_fix_len || inputs[| i].value_from) - ds_list_add(_l, inputs[| i]); - else - delete inputs[| i]; - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(index < input_fix_len) return; - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static step = function() { #region var _axis = getInputData(0); @@ -76,7 +50,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var ww = 0; var hh = 0; - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { var _surf = getInputData(i); if(!is_array(_surf)) _surf = [ _surf ]; @@ -117,7 +91,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var ppind = 0; var sx = 0, sy = 0; - for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { var _surf = getInputData(i); if(!is_array(_surf)) _surf = [ _surf ]; diff --git a/scripts/node_statistic/node_statistic.gml b/scripts/node_statistic/node_statistic.gml index f9630a925..9617a6135 100644 --- a/scripts/node_statistic/node_statistic.gml +++ b/scripts/node_statistic/node_statistic.gml @@ -34,49 +34,16 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Sum", "Mean", "Median", "Max", "Min" ]) .rejectArray(); - setIsDynamicInput(1); - - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, -1 ) .setVisible(false, true); - } #endregion - if(!LOADING && !APPENDING) createNewInput(); + + return inputs[| index]; + } setDynamicInput(1, true, VALUE_TYPE.float); outputs[| 0] = nodeValue("Statistic", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1); - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) { - _l[| i] = inputs[| i]; - } - - for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { - if(inputs[| i].value_from) { - ds_list_add(_l, inputs[| i]); - inputs[| i].setVisible(true, true); - } else { - delete inputs[| i]; - } - } - - for( var i = 0; i < ds_list_size(_l); i++ ) { - _l[| i].index = i; - } - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - - refreshDynamicInput(); - } #endregion - static update = function(frame = CURRENT_FRAME) { #region var type = getInputData(0); var res = 0; diff --git a/scripts/node_string_merge/node_string_merge.gml b/scripts/node_string_merge/node_string_merge.gml index ca0cb9921..65ddf581d 100644 --- a/scripts/node_string_merge/node_string_merge.gml +++ b/scripts/node_string_merge/node_string_merge.gml @@ -3,48 +3,16 @@ function Node_String_Merge(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro setDimension(96, 48); - setIsDynamicInput(1); - outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - static createNewInput = function() { #region + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) .setVisible(true, true); return inputs[| index]; - } if(!LOADING && !APPENDING) createNewInput(); #endregion - - static refreshDynamicInput = function() { #region - var _l = ds_list_create(); - - for( var i = 0; i < input_fix_len; i++ ) - _l[| i] = inputs[| i]; - - for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - if(inputs[| i].value_from || inputs[| i].getValue() != "") - ds_list_add(_l, inputs[| i]); - } - - for( var i = 0; i < ds_list_size(_l); i++ ) - _l[| i].index = i; - - ds_list_destroy(inputs); - inputs = _l; - - createNewInput(); - } #endregion - - static onValueUpdate = function(index) { #region - if(LOADING || APPENDING) return; - refreshDynamicInput(); - } #endregion - - static onValueFromUpdate = function(index) { #region - if(LOADING || APPENDING) return; - refreshDynamicInput(); - } #endregion + } setDynamicInput(1, true, VALUE_TYPE.text); static processData = function(_output, _data, _index = 0) { var _str = ""; diff --git a/scripts/node_struct/node_struct.gml b/scripts/node_struct/node_struct.gml index 112cfdef3..4cb77562e 100644 --- a/scripts/node_struct/node_struct.gml +++ b/scripts/node_struct/node_struct.gml @@ -11,10 +11,10 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) .setVisible(false, false); - } + + return inputs[| index + 0]; + } setDynamicInput(2, false); - setIsDynamicInput(2); - if(!LOADING && !APPENDING) createNewInput(); static refreshDynamicInput = function() { diff --git a/scripts/node_switch/node_switch.gml b/scripts/node_switch/node_switch.gml index 6b0dd5180..7896bc3ad 100644 --- a/scripts/node_switch/node_switch.gml +++ b/scripts/node_switch/node_switch.gml @@ -10,7 +10,13 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| 1] = nodeValue("Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) .setVisible(false, true); - static createNewInput = function() { #region + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + + input_display_list = [ 0, + ["Inputs", false], 1 + ] + + static createNewInput = function() { var index = ds_list_size(inputs); inputs[| index + 0] = nodeValue("Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); @@ -19,15 +25,9 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor array_push(input_display_list, index + 0); array_push(input_display_list, index + 1); - } #endregion - - outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - - input_display_list = [ 0, - ["Inputs", false], 1 - ] - - setIsDynamicInput(2); + + return inputs[| index + 0]; + } setDynamicInput(2, false); if(!LOADING && !APPENDING) createNewInput(); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 9d4b0a2cb..fc3a2b7ea 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -2163,9 +2163,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return controlNode.rendered; } #endregion - static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region + static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region ////Set from //print($"Connecting {_valueFrom.name} to {name}"); + if(is_dummy) { + var _targ = dummy_get(); + dummy_target = _targ; + UNDO_HOLDING = true; + var _res = _targ.setFrom(_valueFrom, _update, checkRecur, log); + UNDO_HOLDING = false; + + recordAction(ACTION_TYPE.junction_connect, self, [ _targ, _valueFrom ]); + return _res; + } + if(_valueFrom == noone) return removeFrom(); @@ -2343,13 +2354,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static drawJunction_fast = function(_s, _mx, _my) { #region INLINE - var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); - var is_hover = hov && abs(_mx - x) + abs(_my - y) < _s; + var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); + var _hov = hov && abs(_mx - x) + abs(_my - y) < _s; + var _aa = 0.75 + (!is_dummy * 0.25); draw_set_color(draw_fg); + draw_set_alpha(_aa); draw_circle(x, y, _s, false); - - return is_hover; + draw_set_alpha(1); + + return _hov; } #endregion static drawJunction = function(_s, _mx, _my) { #region @@ -2363,7 +2377,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var _bgS = THEME.node_junctions_bg; var _fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline; - if(type == VALUE_TYPE.action) { + if(is_dummy) { + __draw_sprite_ext(THEME.node_junction_add, is_hover, x, y, _s, _s, 0, c_white, 0.5 + 0.5 * is_hover); + + } else if(type == VALUE_TYPE.action) { var _cbg = c_white; if(draw_blend != -1) @@ -2407,7 +2424,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static drawName = function(_s, _mx, _my) { #region var _draw_cc = COLORS._main_text; - var _draw_aa = hover_in_graph? 1 : 0.8; + var _draw_aa = 0.8 + hover_in_graph * 0.2; draw_set_text(f_p1, fa_left, fa_center, _draw_cc); draw_set_alpha(_draw_aa); diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 18e14d624..672eb7fb3 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -25,6 +25,8 @@ function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constr self.parent = parent; } } + + static toString = function() { return $"Custon renderer"; } } #endregion function Inspector_Sprite(spr) constructor { self.spr = spr; }