From b633781dff8764001bffb82fe2564dc0e098290b Mon Sep 17 00:00:00 2001 From: Tanasart Date: Mon, 6 Jan 2025 11:32:21 +0700 Subject: [PATCH] conn --- objects/o_dialog_add_node/Create_0.gml | 3 +-- .../node_VFX_group_inline.gml | 2 ++ .../node_VFX_renderer/node_VFX_renderer.gml | 3 ++- scripts/node_data/node_data.gml | 2 ++ .../node_iterate_each/node_iterate_each.gml | 16 ++++++------- .../node_iterate_filter.gml | 24 +++++++++---------- .../node_iterator_each_inline_input.gml | 1 + .../node_iterator_each_inline_output.gml | 1 + .../node_iterator_filter_inline_input.gml | 1 + .../node_iterator_filter_inline_output.gml | 1 + .../node_iterator_sort_inline_input.gml | 1 + .../node_iterator_sort_inline_output.gml | 1 + scripts/node_registry/node_registry.gml | 4 ++-- scripts/node_value/node_value.gml | 16 ++++--------- 14 files changed, 39 insertions(+), 37 deletions(-) diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 4eeb2daec..ff44ccc32 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -87,8 +87,7 @@ event_inherited(); function trigger_favourite() { if(node_menu_selecting == noone) return; - var _node = node_menu_selecting.nodeName; - struct_toggle(global.FAV_NODES, _node); + struct_toggle(global.FAV_NODES, node_menu_selecting.nodeName); PREF_SAVE(); } 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 4977f6922..c02bb1541 100644 --- a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml +++ b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml @@ -9,6 +9,8 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( newInput(0, nodeValue_Bool("Loop", self, true )) .rejectArray(); + output_node_type = Node_VFX_Renderer; + is_simulation = true; update_on_frame = true; managedRenderOrder = true; diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index 22ed0b8f5..605e54f2e 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -4,7 +4,8 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr icon = THEME.vfx; use_cache = CACHE_USE.auto; - manual_ungroupable = false; + inline_output = false; + manual_ungroupable = false; newInput(0, nodeValue_Vec2("Output dimension", self, DEF_SURF )); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 800987688..01ca88c56 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -43,6 +43,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { array_push(PROJECT.allNodes, self); + inline_input = true; + inline_output = true; inline_context = noone; inline_parent_object = ""; diff --git a/scripts/node_iterate_each/node_iterate_each.gml b/scripts/node_iterate_each/node_iterate_each.gml index 85cc4c314..f956c241f 100644 --- a/scripts/node_iterate_each/node_iterate_each.gml +++ b/scripts/node_iterate_each/node_iterate_each.gml @@ -9,31 +9,31 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou custom_input_index = array_length(inputs); custom_output_index = array_length(inputs); - if(NODE_NEW_MANUAL) { #region + if(NODE_NEW_MANUAL) { var input = nodeBuild("Node_Iterator_Each_Input", -256, -32, self); var output = nodeBuild("Node_Iterator_Each_Output", 256, -32, self); output.inputs[0].setFrom(input.outputs[0]); - } #endregion + } - static onStep = function() { #region + static onStep = function() { var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type; inputs[0].setType(type); - } #endregion + } - static doInitLoop = function() { #region + static doInitLoop = function() { var arrIn = getInputData(0); var arrOut = outputs[0].getValue(); if(array_length(arrOut) != array_length(arrIn)) outputs[0].setValue([]); - } #endregion + } - static getIterationCount = function() { #region + static getIterationCount = function() { var arrIn = getInputData(0); var maxIter = is_array(arrIn)? array_length(arrIn) : 0; if(!is_real(maxIter)) maxIter = 1; return maxIter; - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_iterate_filter/node_iterate_filter.gml b/scripts/node_iterate_filter/node_iterate_filter.gml index fffb1472d..f5258a973 100644 --- a/scripts/node_iterate_filter/node_iterate_filter.gml +++ b/scripts/node_iterate_filter/node_iterate_filter.gml @@ -9,19 +9,19 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr custom_input_index = array_length(inputs); custom_output_index = array_length(inputs); - if(NODE_NEW_MANUAL) { #region + if(NODE_NEW_MANUAL) { var input = nodeBuild("Node_Iterator_Filter_Input", -256, -32, self); var output = nodeBuild("Node_Iterator_Filter_Output", 256, -32, self); output.inputs[0].setFrom(input.outputs[0]); - } #endregion + } - static onStep = function() { #region + static onStep = function() { var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type; inputs[0].setType(type); - } #endregion + } - static doInitLoop = function() { #region + static doInitLoop = function() { var arrIn = getInputData(0); var arrOut = outputs[0].getValue(); @@ -31,10 +31,8 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr for( var i = 0, n = array_length(nodes); i < n; i++ ) { var _n = nodes[i]; - if(is_instanceof(_n, Node_Iterator_Filter_Input)) - _int = _n; - if(is_instanceof(_n, Node_Iterator_Filter_Output)) - _oup = _n; + if(is(_n, Node_Iterator_Filter_Input)) _int = _n; + if(is(_n, Node_Iterator_Filter_Output)) _oup = _n; } if(_int == noone) { @@ -50,17 +48,17 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr } var _ofr = _oup.inputs[0].value_from; - var _imm = _ofr && is_instanceof(_ofr.node, Node_Iterator_Filter_Input); + var _imm = _ofr && is(_ofr.node, Node_Iterator_Filter_Input); if(!_imm) surface_array_free(arrOut); outputs[0].setValue([]) - } #endregion + } - static getIterationCount = function() { #region + static getIterationCount = function() { var arrIn = getInputData(0); var maxIter = is_array(arrIn)? array_length(arrIn) : 0; if(!is_real(maxIter)) maxIter = 1; return maxIter; - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_iterator_each_inline_input/node_iterator_each_inline_input.gml b/scripts/node_iterator_each_inline_input/node_iterator_each_inline_input.gml index 5d52e3024..ffd0c44d5 100644 --- a/scripts/node_iterator_each_inline_input/node_iterator_each_inline_input.gml +++ b/scripts/node_iterator_each_inline_input/node_iterator_each_inline_input.gml @@ -5,6 +5,7 @@ function Node_Iterator_Each_Inline_Input(_x, _y, _group = noone) : Node(_x, _y, setDimension(96, 48); clonable = false; + inline_input = false; inline_parent_object = "Node_Iterate_Each_Inline"; manual_ungroupable = false; diff --git a/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml b/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml index 2d1e2f10d..f582a9ef1 100644 --- a/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml +++ b/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml @@ -5,6 +5,7 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y, setDimension(96, 48); clonable = false; + inline_output = false; inline_parent_object = "Node_Iterate_Each_Inline"; manual_ungroupable = false; diff --git a/scripts/node_iterator_filter_inline_input/node_iterator_filter_inline_input.gml b/scripts/node_iterator_filter_inline_input/node_iterator_filter_inline_input.gml index 2f67a92da..beba48bd8 100644 --- a/scripts/node_iterator_filter_inline_input/node_iterator_filter_inline_input.gml +++ b/scripts/node_iterator_filter_inline_input/node_iterator_filter_inline_input.gml @@ -5,6 +5,7 @@ function Node_Iterator_Filter_Inline_Input(_x, _y, _group = noone) : Node(_x, _y setDimension(96, 48); clonable = false; + inline_input = false; inline_parent_object = "Node_Iterate_Filter_Inline"; manual_ungroupable = false; diff --git a/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml b/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml index 8c8bc560f..a876605c8 100644 --- a/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml +++ b/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml @@ -5,6 +5,7 @@ function Node_Iterator_Filter_Inline_Output(_x, _y, _group = noone) : Node(_x, _ setDimension(96, 48); clonable = false; + inline_output = false; inline_parent_object = "Node_Iterate_Filter_Inline"; manual_ungroupable = false; diff --git a/scripts/node_iterator_sort_inline_input/node_iterator_sort_inline_input.gml b/scripts/node_iterator_sort_inline_input/node_iterator_sort_inline_input.gml index 2c8f71b8c..8f7941f2c 100644 --- a/scripts/node_iterator_sort_inline_input/node_iterator_sort_inline_input.gml +++ b/scripts/node_iterator_sort_inline_input/node_iterator_sort_inline_input.gml @@ -5,6 +5,7 @@ function Node_Iterator_Sort_Inline_Input(_x, _y, _group = noone) : Node(_x, _y, setDimension(96, 48); clonable = false; + inline_input = false; inline_parent_object = "Node_Iterate_Sort_Inline"; manual_ungroupable = false; diff --git a/scripts/node_iterator_sort_inline_output/node_iterator_sort_inline_output.gml b/scripts/node_iterator_sort_inline_output/node_iterator_sort_inline_output.gml index 2076596f6..e611275f8 100644 --- a/scripts/node_iterator_sort_inline_output/node_iterator_sort_inline_output.gml +++ b/scripts/node_iterator_sort_inline_output/node_iterator_sort_inline_output.gml @@ -5,6 +5,7 @@ function Node_Iterator_Sort_Inline_Output(_x, _y, _group = noone) : Node(_x, _y, setDimension(96, 48); clonable = false; + inline_output = false; inline_parent_object = "Node_Iterate_Sort_Inline"; manual_ungroupable = false; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index cf68f5a13..2d7ae4c09 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -162,7 +162,7 @@ function NodeObject(_name, _spr, _node, _tooltip = "") constructor { draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _x + grid_size - ui(12), _y + ui(6)); } - var fav = struct_exists(global.FAV_NODES, node); + var fav = struct_exists(global.FAV_NODES, nodeName); if(fav) { gpu_set_tex_filter(true); draw_sprite_ui_uniform(THEME.star, 0, _x + grid_size - ui(10), _y + grid_size - ui(10), .8, COLORS._main_accent, 1.); @@ -188,7 +188,7 @@ function NodeObject(_name, _spr, _node, _tooltip = "") constructor { } static drawList = function(_x, _y, _mx, _my, _h, _w, _param = {}) { - var fav = struct_exists(global.FAV_NODES, node); + var fav = struct_exists(global.FAV_NODES, nodeName); if(fav) { gpu_set_tex_filter(true); draw_sprite_ui_uniform(THEME.star, 0, _x + ui(16), _y + _h / 2, .8, COLORS._main_accent, 1.); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 2cb940519..86c3aa9b6 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1711,16 +1711,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return _res; } - if(_valueFrom == noone) - return removeFrom(); + if(_valueFrom == noone) return removeFrom(); + if(isConnectable(_valueFrom, checkRecur, log) < 0) return conn; run_in(2, function() /*=>*/ { updateColor(getValue()); }); - var conn = isConnectable(_valueFrom, checkRecur, log); - if(conn < 0) return conn; - - if(setFrom_condition != -1 && !setFrom_condition(_valueFrom)) - return -2; + if(setFrom_condition != -1 && !setFrom_condition(_valueFrom)) return -2; if(value_from != noone) array_remove(value_from.value_to, self); @@ -1729,10 +1725,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru value_from = _valueFrom; array_push(_valueFrom.value_to, self); - if(!LOADING && !APPENDING && _valueFrom.node.inline_context != noone) { - var _inline = _valueFrom.node.inline_context; - if(node.manual_ungroupable) _inline.addNode(node); - } + if(!LOADING && !APPENDING && _valueFrom.node.inline_context != noone && node.manual_ungroupable && (node.inline_input && _valueFrom.node.inline_output)) + _valueFrom.node.inline_context.addNode(node); node.valueUpdate(index, _o); if(_update && connect_type == CONNECT_TYPE.input) {