From ffe75f4c0cee41f9efd3acd884ed847d3b1f8e38 Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Wed, 19 Jan 2022 12:11:17 +0700 Subject: [PATCH] Refactor node visibility --- rooms/rm_main/rm_main.yy | 4 +- scripts/event_recorder/event_recorder.gml | 12 ++--- scripts/load_function/load_function.gml | 2 +- scripts/node_2d_light/node_2d_light.gml | 36 ++++++------- scripts/node_3D_obj/node_3D_obj.gml | 2 +- .../node_3d_prim_cube/node_3d_prim_cube.gml | 2 +- .../node_3d_transform/node_3d_transform.gml | 6 +-- scripts/node_array/node_array.gml | 51 ++++++++++++++----- scripts/node_composite/node_composite.gml | 6 +-- scripts/node_data/node_data.gml | 13 +++++ .../node_displacement/node_displacement.gml | 4 +- scripts/node_dither/node_dither.gml | 8 +-- scripts/node_export/node_export.gml | 8 +-- scripts/node_functions/node_functions.gml | 4 -- scripts/node_gradient/node_gradient.gml | 8 +-- scripts/node_group_input/node_group_input.gml | 19 ++++--- .../node_group_output/node_group_output.gml | 4 +- .../node_image_animated.gml | 10 ++-- .../node_image_sequence.gml | 2 +- scripts/node_image_sheet/node_image_sheet.gml | 4 +- scripts/node_keyframe/node_keyframe.gml | 4 ++ scripts/node_line/node_line.gml | 4 +- scripts/node_math/node_math.gml | 4 +- scripts/node_noise_cell/node_noise_cell.gml | 4 +- scripts/node_outline/node_outline.gml | 2 +- scripts/node_particle/node_particle.gml | 10 ++-- .../node_particle_effector.gml | 24 ++++----- scripts/node_posterize/node_posterize.gml | 6 +-- scripts/node_registry/node_registry.gml | 21 ++++++-- .../node_seperate_shapes.gml | 1 + .../node_simple_shape/node_simple_shape.gml | 50 +++++++++--------- .../node_sprite_sheet/node_sprite_sheet.gml | 4 +- scripts/node_text/node_text.gml | 2 +- scripts/node_transform/node_transform.gml | 6 +-- scripts/node_value/node_value.gml | 7 +++ scripts/panel_graph/panel_graph.gml | 6 +-- scripts/save_function/save_function.gml | 15 +----- shaders/sh_color_adjust/sh_color_adjust.fsh | 2 +- .../sh_seperate_shape_counter.fsh | 7 +-- 39 files changed, 218 insertions(+), 166 deletions(-) diff --git a/rooms/rm_main/rm_main.yy b/rooms/rm_main/rm_main.yy index e9d6b369f..eec355ee2 100644 --- a/rooms/rm_main/rm_main.yy +++ b/rooms/rm_main/rm_main.yy @@ -14,7 +14,7 @@ ], "layers": [ {"instances":[ - {"properties":[],"isDnd":false,"objectId":{"name":"o_main","path":"objects/o_main/o_main.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":0.0,"resourceVersion":"1.0","name":"inst_4C1D5EA","tags":[],"resourceType":"GMRInstance",}, + {"properties":[],"isDnd":false,"objectId":{"name":"o_main","path":"objects/o_main/o_main.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":976.0,"y":224.0,"resourceVersion":"1.0","name":"inst_5E4E5D1","tags":[],"resourceType":"GMRInstance",}, ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":16,"gridY":16,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, {"spriteId":null,"colour":4280491036,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":16,"gridY":16,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, ], @@ -22,7 +22,7 @@ "creationCodeFile": "", "inheritCode": false, "instanceCreationOrder": [ - {"name":"inst_4C1D5EA","path":"rooms/rm_main/rm_main.yy",}, + {"name":"inst_5E4E5D1","path":"rooms/rm_main/rm_main.yy",}, ], "inheritCreationOrder": false, "sequenceId": null, diff --git a/scripts/event_recorder/event_recorder.gml b/scripts/event_recorder/event_recorder.gml index f78a7cbc2..8ebf9957e 100644 --- a/scripts/event_recorder/event_recorder.gml +++ b/scripts/event_recorder/event_recorder.gml @@ -13,7 +13,7 @@ enum ACTION_TYPE { list_delete, node_added, - node_deleted, + node_delete, junction_connect, group_added, @@ -57,9 +57,9 @@ function Action(_type, _object, _data) constructor { ds_list_insert(obj, data[1], data[0]); break; case ACTION_TYPE.node_added : - node_delete(obj); + nodeDelete(obj); break; - case ACTION_TYPE.node_deleted : + case ACTION_TYPE.node_delete : ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); break; case ACTION_TYPE.junction_connect : @@ -105,8 +105,8 @@ function Action(_type, _object, _data) constructor { case ACTION_TYPE.node_added : ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); break; - case ACTION_TYPE.node_deleted : - node_delete(obj); + case ACTION_TYPE.node_delete : + nodeDelete(obj); break; case ACTION_TYPE.junction_connect : var _d = obj.value_from; @@ -140,7 +140,7 @@ function Action(_type, _object, _data) constructor { case ACTION_TYPE.node_added : ss = "node add: " + string(obj.name); break; - case ACTION_TYPE.node_deleted : + case ACTION_TYPE.node_delete : ss = "node deleted: " + string(obj.name); break; case ACTION_TYPE.junction_connect : diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 81585fbdd..ab48c148d 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -47,7 +47,7 @@ function LOAD_PATH(path, readonly = false) { PANEL_MENU.addNotiExtra(warn); } - clearNodes(); + nodeCleanUp(); var create_list = ds_list_create(); if(ds_map_exists(_map, "nodes")) { diff --git a/scripts/node_2d_light/node_2d_light.gml b/scripts/node_2d_light/node_2d_light.gml index 530bfb7b6..22af3fc93 100644 --- a/scripts/node_2d_light/node_2d_light.gml +++ b/scripts/node_2d_light/node_2d_light.gml @@ -86,29 +86,29 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor { switch(_shape) { case LIGHT_SHAPE_2D.point : - node_input_visible(inputs[| 2], true); - node_input_visible(inputs[| 3], true); - node_input_visible(inputs[| 6], false); - node_input_visible(inputs[| 7], false); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], false); + inputs[| 2].setVisible(true); + inputs[| 3].setVisible(true); + inputs[| 6].setVisible(false); + inputs[| 7].setVisible(false); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(false); break; case LIGHT_SHAPE_2D.line : case LIGHT_SHAPE_2D.line_asym : - node_input_visible(inputs[| 2], false); - node_input_visible(inputs[| 3], true); - node_input_visible(inputs[| 6], true); - node_input_visible(inputs[| 7], true); - node_input_visible(inputs[| 8], true); - node_input_visible(inputs[| 9], _shape == LIGHT_SHAPE_2D.line_asym); + inputs[| 2].setVisible(false); + inputs[| 3].setVisible(true); + inputs[| 6].setVisible(true); + inputs[| 7].setVisible(true); + inputs[| 8].setVisible(true); + inputs[| 9].setVisible(_shape == LIGHT_SHAPE_2D.line_asym); break; case LIGHT_SHAPE_2D.spot : - node_input_visible(inputs[| 2], false); - node_input_visible(inputs[| 3], false); - node_input_visible(inputs[| 6], true); - node_input_visible(inputs[| 7], true); - node_input_visible(inputs[| 8], true); - node_input_visible(inputs[| 9], false); + inputs[| 2].setVisible(false); + inputs[| 3].setVisible(false); + inputs[| 6].setVisible(true); + inputs[| 7].setVisible(true); + inputs[| 8].setVisible(true); + inputs[| 9].setVisible(false); break; } diff --git a/scripts/node_3D_obj/node_3D_obj.gml b/scripts/node_3D_obj/node_3D_obj.gml index 9e4fde425..7eca98c0b 100644 --- a/scripts/node_3D_obj/node_3D_obj.gml +++ b/scripts/node_3D_obj/node_3D_obj.gml @@ -47,7 +47,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor { function createMaterial(m_index) { var index = ds_list_size(inputs); inputs[| index] = nodeValue( index, "Texture " + materials[m_index], self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface); - inputs[| index].show_in_inspector = false; + inputs[| index].setVisible(false); input_display_list[input_display_len + m_index] = index; } diff --git a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml index ae1934a99..9ca741d9a 100644 --- a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml +++ b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml @@ -145,7 +145,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor { var _sca = inputs[| 4].getValue(); var _usetex = inputs[| 5].getValue(); - for(var i = 6; i <= 11; i++) inputs[| i].show_in_inspector = _usetex; + for(var i = 6; i <= 11; i++) inputs[| i].setVisible(_usetex); var _outSurf = outputs[| 0].getValue(); if(!is_surface(_outSurf)) { diff --git a/scripts/node_3d_transform/node_3d_transform.gml b/scripts/node_3d_transform/node_3d_transform.gml index e58269ca1..0fbfda15b 100644 --- a/scripts/node_3d_transform/node_3d_transform.gml +++ b/scripts/node_3d_transform/node_3d_transform.gml @@ -141,17 +141,17 @@ function Node_3D_Transform(_x, _y) : Node_Processor(_x, _y) constructor { switch(_out_type) { case OUTPUT_SCALING.same_as_input : - node_input_visible(inputs[| 5], false); + inputs[| 5].setVisible(false); _ww = surface_get_width(_data[0]); _hh = surface_get_height(_data[0]); break; case OUTPUT_SCALING.constant : - node_input_visible(inputs[| 5], true); + inputs[| 5].setVisible(true); _ww = _out[0]; _hh = _out[1]; break; case OUTPUT_SCALING.relative : - node_input_visible(inputs[| 5], true); + inputs[| 5].setVisible(true); _ww = surface_get_width(_data[0]) * _out[0]; _hh = surface_get_height(_data[0]) * _out[1]; break; diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index 8d477db89..05de62100 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -5,34 +5,59 @@ function Node_create_Array(_x, _y) { } function Node_Array(_x, _y) : Node(_x, _y) constructor { - name = "Array"; + name = "Array"; previewable = false; input_size = 0; - input_max = 8; w = 96; + min_h = 0; - for(var i = 0; i < input_max; i++) { - inputs[| i] = nodeValue(i, "Value " + string(i), self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0); + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) + .setVisible(true, true); } + createNewInput(); outputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - static update = function() { - var res = array_create(input_size); - - input_size = 0; - for(var i = 0; i < input_max; i++) { + static updateValueFrom = function(index) { + var _l = ds_list_create(); + for( var i = 0; i < ds_list_size(inputs); i++ ) { if(inputs[| i].value_from) { - res[i] = inputs[| i].getValue(); - input_size = i + 1; + ds_list_add(_l, inputs[| i]); + } else { + delete inputs[| i]; } } - if(input_size < input_max) { - inputs[| input_size].show_in_inspector = true; + + for( var i = 0; i < ds_list_size(_l); i++ ) { + _l[| i].index = i; } + + ds_list_destroy(inputs); + inputs = _l; + + createNewInput(); + } + + static update = function() { + var res = array_create(ds_list_size(inputs) - 1); + + for( var i = 0; i < ds_list_size(inputs) - 1; i++ ) { + res[i] = inputs[| i].getValue(); + } + outputs[| 0].setValue(res); } doUpdate(); + + static postDeserialize = function() { + var _inputs = load_map[? "inputs"]; + + for(var i = 0; i < ds_list_size(_inputs); i++) { + createNewInput(); + } + } } \ No newline at end of file diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 88e25951d..9be785478 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -250,12 +250,12 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor { switch(_dim_type) { case COMPOSE_OUTPUT_SCALING.first : - inputs[| 2].show_in_inspector = false; + inputs[| 2].setVisible(false); ww = surface_get_width(base); hh = surface_get_height(base); break; case COMPOSE_OUTPUT_SCALING.largest : - inputs[| 2].show_in_inspector = false; + inputs[| 2].setVisible(false); for(var i = input_fix_len; i < array_length(_data) - data_length; i += data_length) { var _s = _data[i]; ww = max(ww, surface_get_width(_s)); @@ -263,7 +263,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor { } break; case COMPOSE_OUTPUT_SCALING.constant : - inputs[| 2].show_in_inspector = true; + inputs[| 2].setVisible(true); ww = _dim[0]; hh = _dim[1]; break; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 4325cf146..84d249ccd 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -574,4 +574,17 @@ function Node(_x, _y) constructor { static preConnect = function() {} static postConnect = function() {} + + static cleanUp = function() { + for( var i = 0; i < ds_list_size(inputs); i++ ) { + inputs[| i].cleanUp(); + } + for( var i = 0; i < ds_list_size(outputs); i++ ) { + outputs[| i].cleanUp(); + } + + ds_list_destroy(inputs); + ds_list_destroy(outputs); + ds_map_destroy(attributes); + } } \ No newline at end of file diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 779ad52e5..05140fed5 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -45,11 +45,11 @@ function Node_Displace(_x, _y) : Node_Processor(_x, _y) constructor { static process_data = function(_outSurf, _data, _output_index) { switch(_data[5]) { case 0 : - inputs[| 2].show_in_inspector = true; + inputs[| 2].setVisible(true); break; case 1 : case 2 : - inputs[| 2].show_in_inspector = false; + inputs[| 2].setVisible(false); break; } var ww = surface_get_width(_data[0]); diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 1e57dc41a..c5e5959c6 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -83,25 +83,25 @@ function Node_Dither(_x, _y) : Node_Processor(_x, _y) constructor { switch(_typ) { case 0 : - node_input_visible(inputs[| 3], false); + inputs[| 3].setVisible(false); shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 2); shader_set_uniform_f_array(uniform_dither, dither2); break; case 1 : - node_input_visible(inputs[| 3], false); + inputs[| 3].setVisible(false); shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 4); shader_set_uniform_f_array(uniform_dither, dither4); break; case 2 : - node_input_visible(inputs[| 3], false); + inputs[| 3].setVisible(false); shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 8); shader_set_uniform_f_array(uniform_dither, dither8); break; case 3 : - node_input_visible(inputs[| 3], true); + inputs[| 3].setVisible(true); if(is_surface(_map)) { shader_set_uniform_i(uniform_map_use, 1); shader_set_uniform_f_array(uniform_map_dim, [ surface_get_width(_map), surface_get_height(_map) ]); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index e0f9f5d50..08147545d 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -60,10 +60,10 @@ function Node_Export(_x, _y) : Node(_x, _y) constructor { inputs[| 2].setValue("%d%n%3f"); } - inputs[| 5].show_in_inspector = form == 2; - inputs[| 6].show_in_inspector = form == 2; - inputs[| 7].show_in_inspector = form == 2; - inputs[| 8].show_in_inspector = form == 2; + inputs[| 5].setVisible(form == 2); + inputs[| 6].setVisible(form == 2); + inputs[| 7].setVisible(form == 2); + inputs[| 8].setVisible(form == 2); } static renderGif = function(temp_path, target_path) { diff --git a/scripts/node_functions/node_functions.gml b/scripts/node_functions/node_functions.gml index 02f4a162d..00f008e57 100644 --- a/scripts/node_functions/node_functions.gml +++ b/scripts/node_functions/node_functions.gml @@ -1,6 +1,2 @@ #macro def_surf_size PREF_MAP[? "default_surface_side"] #macro def_surf_size2 [PREF_MAP[? "default_surface_side"], PREF_MAP[? "default_surface_side"]] - -function node_input_visible(node, vis) { - node.show_in_inspector = vis; -} \ No newline at end of file diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 38c6a7095..d78323067 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -85,11 +85,11 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor { } if(_typ == 0 || _typ == 2) { - inputs[| 3].show_in_inspector = true; - inputs[| 4].show_in_inspector = false; + inputs[| 3].setVisible(true); + inputs[| 4].setVisible(false); } else if(_typ == 1) { - inputs[| 3].show_in_inspector = false; - inputs[| 4].show_in_inspector = true; + inputs[| 3].setVisible(false); + inputs[| 4].setVisible(true); } surface_set_target(_outSurf); diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index b7f41b70a..797cb85e5 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -79,6 +79,7 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { case VALUE_DISPLAY.rotation_range : if(!is_array(_val) || array_length(_val) != 2) inParent.value = new animValue([0, 0], inParent); + inParent.setDisplay(_dtype); break; case VALUE_DISPLAY.enum_button : @@ -89,11 +90,13 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { case VALUE_DISPLAY.padding : if(!is_array(_val) || array_length(_val) != 4) inParent.value = new animValue([0, 0, 0, 0], inParent); + inParent.setDisplay(_dtype); break; case VALUE_DISPLAY.area : if(!is_array(_val) || array_length(_val) != 5) inParent.value = new animValue([0, 0, 0, 0, 5], inParent); + inParent.setDisplay(_dtype); break; case VALUE_DISPLAY.vector : @@ -127,7 +130,9 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { break; } - group.sortIO(); + if(index == 5) { + group.sortIO(); + } } static createInput = function(override_order = false) { @@ -169,23 +174,23 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { var _dtype = inputs[| 0].getValue(); - inputs[| 1].show_in_inspector = false; - inputs[| 3].show_in_inspector = false; - inputs[| 4].show_in_inspector = false; + inputs[| 1].setVisible(false); + inputs[| 3].setVisible(false); + inputs[| 4].setVisible(false); switch(_dtype) { case VALUE_DISPLAY.range : case VALUE_DISPLAY.slider : case VALUE_DISPLAY.slider_range : - inputs[| 1].show_in_inspector = true; + inputs[| 1].setVisible(true); break; case VALUE_DISPLAY.enum_button : case VALUE_DISPLAY.enum_scroll : - inputs[| 3].show_in_inspector = true; + inputs[| 3].setVisible(true); break; case VALUE_DISPLAY.vector : case VALUE_DISPLAY.vector_range : - inputs[| 4].show_in_inspector = true; + inputs[| 4].setVisible(true); break; } } diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 3e0415e38..1166048a7 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -17,7 +17,8 @@ function Node_Group_Output(_x, _y, _group) : Node(_x, _y) constructor { h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1); + inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) + .setVisible(true, true); inputs[| 1] = nodeValue(1, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); @@ -50,6 +51,7 @@ function Node_Group_Output(_x, _y, _group) : Node(_x, _y) constructor { outParent.setFrom(inputs[| 0]); } } + if(!LOADING && !APPENDING) createOutput(); diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index da0a5dd1d..a73cd70cc 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -117,13 +117,9 @@ function Node_Image_Animated(_x, _y) : Node(_x, _y) constructor { var pad = inputs[| 1].getValue(); var str = inputs[| 2].getValue(); - if(str) { - inputs[| 3].show_in_inspector = false; - inputs[| 4].show_in_inspector = false; - } else { - inputs[| 3].show_in_inspector = true; - inputs[| 4].show_in_inspector = true; - } + inputs[| 3].setVisible(!str); + inputs[| 4].setVisible(!str); + var spd = str? (ANIMATOR.frames_total + 1) / array_length(spr) : inputs[| 3].getValue(); var _end = inputs[| 4].getValue(); if(spd == 0) spd = 1; diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index e60db3bb4..8bdbdbfa4 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -118,7 +118,7 @@ function Node_Image_Sequence(_x, _y) : Node(_x, _y) constructor { var pad = inputs[| 1].getValue(); var can = inputs[| 2].getValue(); - inputs[| 3].show_in_inspector = can != CANVAS_SIZE.individual; + inputs[| 3].setVisible(can != CANVAS_SIZE.individual); var siz = inputs[| 3].getValue(); diff --git a/scripts/node_image_sheet/node_image_sheet.gml b/scripts/node_image_sheet/node_image_sheet.gml index 209a5f502..418a70cfa 100644 --- a/scripts/node_image_sheet/node_image_sheet.gml +++ b/scripts/node_image_sheet/node_image_sheet.gml @@ -238,7 +238,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor { if(_out == 0) { update_on_frame = true; - inputs[| 8].show_in_inspector = true; + inputs[| 8].setVisible(true); var _spd = inputs[| 8].getValue(); if(is_surface(_outSurf)) @@ -259,7 +259,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor { surface_reset_target(); } else if(_out == 1) { update_on_frame = false; - inputs[| 8].show_in_inspector = false; + inputs[| 8].setVisible(false); surf_array = array_create(_amo); for(var i = 0; i < _amo; i++) { diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 85f0503c0..0a53d7d20 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -229,4 +229,8 @@ function animValue(_val, _node) constructor { ds_list_add(values, new valueKey(_time, _val, ease_in, ease_out)); } } + + static cleanUp = function() { + ds_list_destroy(values); + } } \ No newline at end of file diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index 193d0b37d..aa5e36e3d 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -69,9 +69,9 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor { if(_ang < 0) _ang = 360 + _ang; if(_use_path) { - node_input_visible(inputs[| 6], false); + inputs[| 6].setVisible(false); } else { - node_input_visible(inputs[| 6], true); + inputs[| 6].setVisible(true); } random_set_seed(_sed); diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index d4223e702..960c0db9c 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -30,12 +30,12 @@ function Node_Math(_x, _y) : Node_Value_Processor(_x, _y) constructor { case 3 : case 4 : case 5 : - inputs[| 2].show_in_inspector = true; + inputs[| 2].setVisible(true); break; case 6 : case 7 : case 8 : - inputs[| 2].show_in_inspector = false; + inputs[| 2].setVisible(false); break; } diff --git a/scripts/node_noise_cell/node_noise_cell.gml b/scripts/node_noise_cell/node_noise_cell.gml index 12edaaf5d..a36bea454 100644 --- a/scripts/node_noise_cell/node_noise_cell.gml +++ b/scripts/node_noise_cell/node_noise_cell.gml @@ -58,8 +58,8 @@ function Node_Cellular(_x, _y) : Node(_x, _y) constructor { var _pat = inputs[| 6].getValue(); var _mid = inputs[| 7].getValue(); - inputs[| 8].show_in_inspector = _pat == 1; - inputs[| 9].show_in_inspector = _pat == 1; + inputs[| 8].setVisible(_pat == 1); + inputs[| 9].setVisible(_pat == 1); var _rad = inputs[| 8].getValue(); var _sht = inputs[| 9].getValue(); diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index c51707073..ad5170331 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -73,6 +73,6 @@ function Node_Outline(_x, _y) : Node_Processor(_x, _y) constructor { static step = function() { var blend = inputs[| 3].getValue(); - inputs[| 4].show_in_inspector = blend; + inputs[| 4].setVisible(blend); } } \ No newline at end of file diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 9976c2a13..bce2c3cd5 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -423,15 +423,15 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor { var _inSurf = inputs[| 0].getValue(); var _scatt = inputs[| 27].getValue(); - inputs[| 25].show_in_inspector = false; - inputs[| 26].show_in_inspector = false; - inputs[| 28].show_in_inspector = _scatt == 2; + inputs[| 25].setVisible(false); + inputs[| 26].setVisible(false); + inputs[| 28].setVisible(_scatt == 2); if(is_array(_inSurf)) { - inputs[| 25].show_in_inspector = true; + inputs[| 25].setVisible(true); var _type = inputs[| 25].getValue(); if(_type == 2) { - inputs[| 26].show_in_inspector = true; + inputs[| 26].setVisible(true); } } diff --git a/scripts/node_particle_effector/node_particle_effector.gml b/scripts/node_particle_effector/node_particle_effector.gml index 4db6f7bac..65b2505b5 100644 --- a/scripts/node_particle_effector/node_particle_effector.gml +++ b/scripts/node_particle_effector/node_particle_effector.gml @@ -66,26 +66,26 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor { var _type = inputs[| 5].getValue(); switch(_type) { case FORCE_TYPE.Wind : - node_input_visible(inputs[| 6], true); - node_input_visible(inputs[| 10], false); + inputs[| 6].setVisible(true); + inputs[| 10].setVisible(false); break; case FORCE_TYPE.Accelerate : - node_input_visible(inputs[| 6], true); - node_input_visible(inputs[| 10], false); + inputs[| 6].setVisible(true); + inputs[| 10].setVisible(false); break; case FORCE_TYPE.Turbulence : - node_input_visible(inputs[| 6], true); - node_input_visible(inputs[| 10], true); + inputs[| 6].setVisible(true); + inputs[| 10].setVisible(true); break; case FORCE_TYPE.Destroy : - node_input_visible(inputs[| 6], false); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], false); - node_input_visible(inputs[| 10], false); + inputs[| 6].setVisible(false); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(false); + inputs[| 10].setVisible(false); break; default : - node_input_visible(inputs[| 6], false); - node_input_visible(inputs[| 10], false); + inputs[| 6].setVisible(false); + inputs[| 10].setVisible(false); break; } } diff --git a/scripts/node_posterize/node_posterize.gml b/scripts/node_posterize/node_posterize.gml index c21d0d4cf..7df4a5132 100644 --- a/scripts/node_posterize/node_posterize.gml +++ b/scripts/node_posterize/node_posterize.gml @@ -35,9 +35,9 @@ function Node_Posterize(_x, _y) : Node_Processor(_x, _y) constructor { static step = function() { var _use_pal = inputs[| 2].getValue(); - inputs[| 1].show_in_inspector = _use_pal; - inputs[| 3].show_in_inspector = !_use_pal; - inputs[| 4].show_in_inspector = !_use_pal; + inputs[| 1].setVisible(_use_pal); + inputs[| 3].setVisible(!_use_pal); + inputs[| 4].setVisible(!_use_pal); } static process_data = function(_outSurf, _data, _output_index) { diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 04080aa16..2668adec7 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -127,7 +127,7 @@ function NodeObject(_name, _spr, _create, tags = []) constructor { var number = ds_list_create(); addNodeCatagory("Number", number); addNodeObject(number, "Math", s_node_math, "Node_Math", Node_create_Math); - //addNodeObject(number, "Array", s_node_array, "Node_Array", Node_create_Array); + addNodeObject(number, "Array", s_node_array, "Node_Array", Node_create_Array); addNodeObject(number, "Array length", s_node_array_length, "Node_Array_Length", Node_create_Array_Length); addNodeObject(number, "Number", s_node_number, "Node_Number", Node_create_Number); addNodeObject(number, "Vector2", s_node_vec2, "Node_Vector2", Node_create_Vector2); @@ -194,7 +194,7 @@ function NodeObject(_name, _spr, _create, tags = []) constructor { NODE_CREATE_FUCTION[? "Node_Group"] = Node_create_Group; #endregion -#region node load +#region node function function nodeLoad(_data, scale = false) { if(!ds_exists(_data, ds_type_map)) return noone; @@ -218,11 +218,24 @@ function NodeObject(_name, _spr, _create, tags = []) constructor { return _node; } - function node_delete(node) { + function nodeDelete(node) { var list = node.group == -1? NODES : node.group.nodes; ds_list_delete(list, ds_list_find_index(list, node)); node.destroy(); - recordAction(ACTION_TYPE.node_deleted, node); + recordAction(ACTION_TYPE.node_delete, node); + } + + function nodeCleanUp() { + var key = ds_map_find_first(NODE_MAP); + repeat(ds_map_size(NODE_MAP)) { + if(NODE_MAP[? key]) { + NODE_MAP[? key].cleanUp(); + delete NODE_MAP[? key]; + } + key = ds_map_find_next(NODE_MAP, key); + } + ds_map_clear(NODE_MAP); + ds_list_clear(NODES); } #endregion \ No newline at end of file diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index c7c8a69a2..cafa4dc66 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -91,6 +91,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor { shader_set(sh_seperate_shape_counter); texture_set_stage(shader_get_sampler_index(sh_seperate_shape_counter, "surface"), surface_get_texture(temp_surf[res_index])); shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]); + shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "maxShape"), PREF_MAP[? "shape_separation_max"]); draw_sprite_ext(s_fx_pixel, 0, 0, 0, PREF_MAP[? "shape_separation_max"], 1, 0, c_white, 1); shader_reset(); BLEND_NORMAL diff --git a/scripts/node_simple_shape/node_simple_shape.gml b/scripts/node_simple_shape/node_simple_shape.gml index 1244b60d3..6dd5d4c38 100644 --- a/scripts/node_simple_shape/node_simple_shape.gml +++ b/scripts/node_simple_shape/node_simple_shape.gml @@ -95,39 +95,39 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor { switch(_shape) { case NODE_SHAPE_TYPE.rectangle : case NODE_SHAPE_TYPE.elipse : - node_input_visible(inputs[| 4], false); - node_input_visible(inputs[| 5], false); - node_input_visible(inputs[| 7], false); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], false); + inputs[| 4].setVisible(false); + inputs[| 5].setVisible(false); + inputs[| 7].setVisible(false); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(false); break; case NODE_SHAPE_TYPE.regular : - node_input_visible(inputs[| 4], true); - node_input_visible(inputs[| 5], false); - node_input_visible(inputs[| 7], true); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], true); + inputs[| 4].setVisible(true); + inputs[| 5].setVisible(false); + inputs[| 7].setVisible(true); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(true); shader_set_uniform_i(uniform_side, _data[4]); shader_set_uniform_f(uniform_angle, degtorad(_data[7])); break; case NODE_SHAPE_TYPE.star : - node_input_visible(inputs[| 4], true); - node_input_visible(inputs[| 5], true); - node_input_visible(inputs[| 7], true); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], true); + inputs[| 4].setVisible(true); + inputs[| 5].setVisible(true); + inputs[| 7].setVisible(true); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(true); shader_set_uniform_i(uniform_side, _data[4]); shader_set_uniform_f(uniform_angle, degtorad(_data[7])); shader_set_uniform_f(uniform_inner, _data[5]); break; case NODE_SHAPE_TYPE.arc : - node_input_visible(inputs[| 4], false); - node_input_visible(inputs[| 5], true); - node_input_visible(inputs[| 7], false); - node_input_visible(inputs[| 8], true); - node_input_visible(inputs[| 9], true); + inputs[| 4].setVisible(false); + inputs[| 5].setVisible(true); + inputs[| 7].setVisible(false); + inputs[| 8].setVisible(true); + inputs[| 9].setVisible(true); var ar = _data[8]; var center = degtorad(ar[0] + ar[1]) / 2; @@ -137,11 +137,11 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor { shader_set_uniform_f(uniform_inner, _data[5] / 2); break; case NODE_SHAPE_TYPE.capsule : - node_input_visible(inputs[| 4], false); - node_input_visible(inputs[| 5], false); - node_input_visible(inputs[| 7], false); - node_input_visible(inputs[| 8], false); - node_input_visible(inputs[| 9], true); + inputs[| 4].setVisible(false); + inputs[| 5].setVisible(false); + inputs[| 7].setVisible(false); + inputs[| 8].setVisible(false); + inputs[| 9].setVisible(true); break; } diff --git a/scripts/node_sprite_sheet/node_sprite_sheet.gml b/scripts/node_sprite_sheet/node_sprite_sheet.gml index 233888016..5f1e47c17 100644 --- a/scripts/node_sprite_sheet/node_sprite_sheet.gml +++ b/scripts/node_sprite_sheet/node_sprite_sheet.gml @@ -47,8 +47,8 @@ function Node_Render_Sprite_Sheet(_x, _y) : Node(_x, _y) constructor { var pack = inputs[| 3].getValue(); var alig = inputs[| 5].getValue(); - inputs[| 2].show_in_inspector = grup == SPRITE_ANIM_GROUP.animation; - inputs[| 4].show_in_inspector = pack == SPRITE_STACK.grid; + inputs[| 2].setVisible(grup == SPRITE_ANIM_GROUP.animation); + inputs[| 4].setVisible(pack == SPRITE_STACK.grid); if(grup != SPRITE_ANIM_GROUP.animation) return; if(safe_mod(ANIMATOR.current_frame, skip) != 0) return; diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index af07d4992..b753cf83a 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -76,7 +76,7 @@ function Node_Text(_x, _y) : Node_Processor(_x, _y) constructor { var _col = _data[5]; var _dim_type = _data[9]; - inputs[| 6].show_in_inspector = !_dim_type; + inputs[| 6].setVisible(!_dim_type); var _dim = _data[6]; var ww, hh; diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 797fccdaa..96fe2e4b6 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -152,15 +152,15 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor { switch(out_type) { case OUTPUT_SCALING.same_as_input : - node_input_visible(inputs[| 1], false); + inputs[| 1].setVisible(false); break; case OUTPUT_SCALING.constant : - node_input_visible(inputs[| 1], true); + inputs[| 1].setVisible(true); _ww = out[0]; _hh = out[1]; break; case OUTPUT_SCALING.relative : - node_input_visible(inputs[| 1], true); + inputs[| 1].setVisible(true); _ww = ww * out[0]; _hh = hh * out[1]; break; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 8e98d0929..ac56ed5a1 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -989,4 +989,11 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T log_warning("LOAD", "[Connect] " + txt); return false; } + + static cleanUp = function() { + ds_list_destroy(value_to); + ds_list_destroy(extra_data); + value.cleanUp(); + delete value; + } } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index b13b48a12..941e8e503 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -594,7 +594,7 @@ function Panel_Graph(_panel) : PanelContent(_panel) constructor { while(!ds_list_empty(node_focus.nodes)) { node_focus.remove(node_focus.nodes[| 0]); } - node_delete(node_focus); + nodeDelete(node_focus); } } @@ -630,10 +630,10 @@ function Panel_Graph(_panel) : PanelContent(_panel) constructor { function doDelete() { if(node_focus != noone) - node_delete(node_focus); + nodeDelete(node_focus); for(var i = 0; i < ds_list_size(nodes_select_list); i++) { - node_delete(nodes_select_list[| i]); + nodeDelete(nodes_select_list[| i]); } ds_list_clear(nodes_select_list); } diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 604b10883..3aa969553 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -1,21 +1,10 @@ function NEW() { - clearNodes(); + nodeCleanUp(); setPanel(); room_restart(); gc_collect(); - setPath(""); -} - -function clearNodes() { - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - if(NODE_MAP[? key]) - delete NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); - } - ds_map_clear(NODE_MAP); - ds_list_clear(NODES); + SET_PATH(""); } function save_serialize() { diff --git a/shaders/sh_color_adjust/sh_color_adjust.fsh b/shaders/sh_color_adjust/sh_color_adjust.fsh index dd34a34be..e8998b51c 100644 --- a/shaders/sh_color_adjust/sh_color_adjust.fsh +++ b/shaders/sh_color_adjust/sh_color_adjust.fsh @@ -37,7 +37,7 @@ void main() { //contrast float cont = contrast * contrast; - float c_factor = (1.004 * (1. + cont)) / (1.004 - cont); + float c_factor = (1. + cont) / (1. - cont); vec4 col_c = c_factor * (col - .5) + .5; col_c = clamp(col_c, vec4(0.), vec4(1.)); diff --git a/shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.fsh b/shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.fsh index d260adcf5..2a689ce48 100644 --- a/shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.fsh +++ b/shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.fsh @@ -6,17 +6,18 @@ varying vec4 v_vColour; uniform vec2 dimension; uniform sampler2D surface; +uniform int maxShape; void main() { vec4 zero = vec4(0.); - vec2 pxPos = v_vTexcoord * vec2(32., 1.); + vec2 pxPos = v_vTexcoord * vec2(float(maxShape), 1.); int amo = 0; - vec4 list[32]; + vec4 list[1024]; for(float i = 0.; i <= dimension.x; i++) for(float j = 0.; j <= dimension.y; j++) { - if(amo > 32) break; + if(amo > maxShape) break; vec4 col = texture2D( surface, vec2(i, j) / dimension ); if(col != zero) {