diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index cc6ec7730..9d1b5d912 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -139,7 +139,7 @@ {"name":"path","order":5,"path":"folders/nodes/data/value/path.yy",}, {"name":"struct","order":7,"path":"folders/nodes/data/value/struct.yy",}, {"name":"surface","order":11,"path":"folders/nodes/data/value/surface.yy",}, - {"name":"texts","order":6,"path":"folders/nodes/data/value/texts.yy",}, + {"name":"text","order":6,"path":"folders/nodes/data/value/text.yy",}, {"name":"trigger","order":9,"path":"folders/nodes/data/value/trigger.yy",}, {"name":"3D","order":133,"path":"folders/nodes/icons/3D.yy",}, {"name":"animation","order":135,"path":"folders/nodes/icons/animation.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 19ab5be1d..fac45f373 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -167,7 +167,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"path","folderPath":"folders/nodes/data/value/path.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"struct","folderPath":"folders/nodes/data/value/struct.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/nodes/data/value/surface.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"texts","folderPath":"folders/nodes/data/value/texts.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/nodes/data/value/text.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"trigger","folderPath":"folders/nodes/data/value/trigger.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"icons","folderPath":"folders/nodes/icons.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"3D","folderPath":"folders/nodes/icons/3D.yy",}, diff --git a/scripts/node_9slice/node_9slice.gml b/scripts/node_9slice/node_9slice.gml index db7ef05ac..76875045a 100644 --- a/scripts/node_9slice/node_9slice.gml +++ b/scripts/node_9slice/node_9slice.gml @@ -23,21 +23,24 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co drag_my = 0; drag_sv = 0; - static onValueFromUpdate = function(index) { - if(index == 0) { - var s = getInputData(0); - if(is_array(s)) s = s[0]; - inputs[| 1].setValue([surface_get_width_safe(s), surface_get_height_safe(s)]); - } + static onValueFromUpdate = function(index = 0) { + if(index != 0) return; + + var s = getInputData(0); + if(is_array(s)) s = s[0]; + + if(!is_surface(s)) return; + inputs[| 1].setValue( [ surface_get_width_safe(s), surface_get_height_safe(s) ] ); } static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { if(array_length(current_data) < 1) return; var _dim = current_data[1]; - var _splice = current_data[2]; - for( var i = 0, n = array_length(_splice); i < n; i++ ) - _splice[i] = round(_splice[i]); + + var _splice = array_create(array_length(current_data[2])); + for( var i = 0, n = array_length(current_data[2]); i < n; i++ ) + _splice[i] = round(current_data[2][i]); var sp_r = _x + (_dim[0] - _splice[0]) * _s; var sp_l = _x + _splice[2] * _s; diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index 5910143ac..6502798e6 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -8,17 +8,16 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0] = nodeValue("Path array", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); - static createNewInput = function() { + static createNewInput = function() { #region var index = ds_list_size(inputs); inputs[| index] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone ) .setVisible(true, true); return inputs[| index]; - } - if(!LOADING && !APPENDING) createNewInput(); + } if(!LOADING && !APPENDING) createNewInput(); #endregion - static refreshDynamicInput = function() { + static refreshDynamicInput = function() { #region var _l = ds_list_create(); for( var i = 0; i < input_fix_len; i++ ) @@ -38,24 +37,24 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc inputs = _l; createNewInput(); - } + } #endregion - static onValueFromUpdate = function(index) { + static onValueFromUpdate = function(index) { #region if(LOADING || APPENDING) return; refreshDynamicInput(); - } + } #endregion - static getLineCount = function() { + static getLineCount = function() { #region var l = 0; for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); l += struct_has(_path, "getLineCount")? _path.getLineCount() : 1; } return l; - } + } #endregion - static getSegmentCount = function(ind = 0) { + static getSegmentCount = function(ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -65,9 +64,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return 0; - } + } #endregion - static getLength = function(ind = 0) { + static getLength = function(ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -77,9 +76,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return 0; - } + } #endregion - static getAccuLength = function(ind = 0) { + static getAccuLength = function(ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -89,9 +88,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return 0; - } + } #endregion - static get__vec2Ratio = function(_rat, ind = 0) { + static get__vec2Ratio = function(_rat, ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -101,9 +100,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return new __vec2(); - } + } #endregion - static get__vec2Distance = function(_dist, ind = 0) { + static get__vec2Distance = function(_dist, ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -113,9 +112,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return new __vec2(); - } + } #endregion - static getBoundary = function(ind = 0) { + static getBoundary = function(ind = 0) { #region for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = getInputData(i); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; @@ -125,13 +124,13 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc } return 0; - } + } #endregion - static update = function(frame = CURRENT_FRAME) { + static update = function(frame = CURRENT_FRAME) { #region outputs[| 0].setValue(self); - } + } #endregion - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index cf8047737..f9a07160a 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -104,8 +104,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio var recPath = DIRECTORY + "Nodes/recent.json"; global.RECENT_NODES = file_exists(recPath)? json_load_struct(recPath) : []; - var group = ds_list_create(); - addNodeCatagory("Group", group, ["Node_Group"]); #region + var group = ds_list_create(); #region + addNodeCatagory("Group", group, ["Node_Group"]); ds_list_add(group, "Groups"); addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(group, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); diff --git a/scripts/node_string/node_string.yy b/scripts/node_string/node_string.yy index 0ca9965eb..d7438804c 100644 --- a/scripts/node_string/node_string.yy +++ b/scripts/node_string/node_string.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_get_char/node_string_get_char.yy b/scripts/node_string_get_char/node_string_get_char.yy index 38bfa3adc..ec64fda8c 100644 --- a/scripts/node_string_get_char/node_string_get_char.yy +++ b/scripts/node_string_get_char/node_string_get_char.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_join/node_string_join.yy b/scripts/node_string_join/node_string_join.yy index 49a02b690..90d03deaf 100644 --- a/scripts/node_string_join/node_string_join.yy +++ b/scripts/node_string_join/node_string_join.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_length/node_string_length.yy b/scripts/node_string_length/node_string_length.yy index 13abfb316..103ef5517 100644 --- a/scripts/node_string_length/node_string_length.yy +++ b/scripts/node_string_length/node_string_length.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_merge/node_string_merge.gml b/scripts/node_string_merge/node_string_merge.gml index d240e3616..c1524ad08 100644 --- a/scripts/node_string_merge/node_string_merge.gml +++ b/scripts/node_string_merge/node_string_merge.gml @@ -4,21 +4,62 @@ function Node_String_Merge(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro w = 96; - inputs[| 0] = nodeValue("Text A", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - - inputs[| 1] = nodeValue("Text B", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + setIsDynamicInput(1); outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + static createNewInput = function() { #region + 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 + static processData = function(_output, _data, _index = 0) { - return string(_data[0]) + string(_data[1]); + var _str = ""; + for( var i = 0, n = array_length(_data); i < n; i++ ) + _str += _data[i]; + + return _str; } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { - var str = getInputData(0); + var _str = outputs[| 0].getValue(); var bbox = drawGetBbox(xx, yy, _s); draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); - draw_text_bbox(bbox, str); + draw_text_bbox(bbox, _str); } } \ No newline at end of file diff --git a/scripts/node_string_merge/node_string_merge.yy b/scripts/node_string_merge/node_string_merge.yy index d682459df..77a92da0f 100644 --- a/scripts/node_string_merge/node_string_merge.yy +++ b/scripts/node_string_merge/node_string_merge.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_path_separate_folder/node_string_path_separate_folder.yy b/scripts/node_string_path_separate_folder/node_string_path_separate_folder.yy index e1e0660a9..b5fd80d1c 100644 --- a/scripts/node_string_path_separate_folder/node_string_path_separate_folder.yy +++ b/scripts/node_string_path_separate_folder/node_string_path_separate_folder.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_regex_match/node_string_regex_match.yy b/scripts/node_string_regex_match/node_string_regex_match.yy index 5edba1217..6715e1a5d 100644 --- a/scripts/node_string_regex_match/node_string_regex_match.yy +++ b/scripts/node_string_regex_match/node_string_regex_match.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_regex_replace/node_string_regex_replace.yy b/scripts/node_string_regex_replace/node_string_regex_replace.yy index 51a3b257b..2c22cc4f9 100644 --- a/scripts/node_string_regex_replace/node_string_regex_replace.yy +++ b/scripts/node_string_regex_replace/node_string_regex_replace.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_regex_search/node_string_regex_search.yy b/scripts/node_string_regex_search/node_string_regex_search.yy index 0405347c7..67ab186b1 100644 --- a/scripts/node_string_regex_search/node_string_regex_search.yy +++ b/scripts/node_string_regex_search/node_string_regex_search.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_split/node_string_split.yy b/scripts/node_string_split/node_string_split.yy index 574d0ed8c..541a59d8b 100644 --- a/scripts/node_string_split/node_string_split.yy +++ b/scripts/node_string_split/node_string_split.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_string_trim/node_string_trim.yy b/scripts/node_string_trim/node_string_trim.yy index d8a63fc01..46d15d3c2 100644 --- a/scripts/node_string_trim/node_string_trim.yy +++ b/scripts/node_string_trim/node_string_trim.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_to_text/node_to_text.yy b/scripts/node_to_text/node_to_text.yy index ad79e8e96..d4f084536 100644 --- a/scripts/node_to_text/node_to_text.yy +++ b/scripts/node_to_text/node_to_text.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file diff --git a/scripts/node_unicode/node_unicode.yy b/scripts/node_unicode/node_unicode.yy index 4b8749de7..ace8fbaf7 100644 --- a/scripts/node_unicode/node_unicode.yy +++ b/scripts/node_unicode/node_unicode.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "texts", - "path": "folders/nodes/data/value/texts.yy", + "name": "text", + "path": "folders/nodes/data/value/text.yy", }, } \ No newline at end of file