From 51d8abb01fb030b99ade5b9146bb1ca930cd5a26 Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Sat, 7 Oct 2023 21:23:40 +0700 Subject: [PATCH] Fluid sim output group. --- PixelComposer.resource_order | 3 +- PixelComposer.yyp | 3 +- objects/o_main/Create_0.gml | 4 +- objects/o_main/Step_1.gml | 5 +- .../__node_3d_extrude/__node_3d_extrude.gml | 2 +- scripts/append_function/append_function.gml | 2 +- scripts/globals/globals.gml | 1 + scripts/load_function/load_function.gml | 20 +- scripts/node_array/node_array.gml | 8 +- scripts/node_array_add/node_array_add.gml | 10 +- scripts/node_array_copy/node_array_copy.gml | 4 +- scripts/node_array_find/node_array_find.gml | 8 +- scripts/node_array_get/node_array_get.gml | 8 +- .../node_array_insert/node_array_insert.gml | 12 +- .../node_array_length/node_array_length.gml | 2 +- .../node_array_remove/node_array_remove.gml | 12 +- .../node_array_reverse/node_array_reverse.gml | 8 +- scripts/node_array_set/node_array_set.gml | 12 +- scripts/node_array_shift/node_array_shift.gml | 8 +- .../node_array_shuffle/node_array_shuffle.gml | 8 +- scripts/node_array_sort/node_array_sort.gml | 8 +- scripts/node_array_zip/node_array_zip.gml | 10 +- .../node_color_from_hsv.gml | 12 +- .../node_color_from_rgb.gml | 12 +- scripts/node_condition/node_condition.gml | 8 +- .../node_csv_file_read/node_csv_file_read.gml | 2 +- scripts/node_data/node_data.gml | 39 ++-- .../node_fluid_render_output.gml | 117 +++++++++++ .../node_fluid_render_output.yy | 11 ++ scripts/node_fluid_sim/node_fluid_sim.gml | 12 +- scripts/node_global/node_global.gml | 2 +- scripts/node_group_input/node_group_input.gml | 10 +- .../node_group_output/node_group_output.gml | 26 +-- scripts/node_hlsl/node_hlsl.gml | 20 +- .../node_iterate_each/node_iterate_each.gml | 2 +- .../node_iterate_filter.gml | 2 +- .../node_iterate_sort/node_iterate_sort.gml | 16 +- .../node_iterator_each_input.gml | 2 +- .../node_iterator_each_output.gml | 6 +- .../node_iterator_filter_input.gml | 2 +- .../node_iterator_filter_output.gml | 4 +- .../node_iterator_sort_input.gml | 2 +- .../node_json_file_read.gml | 8 +- .../node_json_file_write.gml | 4 +- scripts/node_lua_compute/node_lua_compute.gml | 22 +-- scripts/node_lua_surface/node_lua_surface.gml | 16 +- scripts/node_math/node_math.gml | 6 +- scripts/node_number/node_number.gml | 20 +- .../node_pb_draw_roundrectangle.gml | 8 +- scripts/node_pin/node_pin.gml | 4 +- scripts/node_registry/node_registry.gml | 5 +- scripts/node_string_trim/node_string_trim.gml | 4 +- scripts/node_struct/node_struct.gml | 2 +- scripts/node_struct_get/node_struct_get.gml | 12 +- scripts/node_switch/node_switch.gml | 10 +- scripts/node_tunnel_in/node_tunnel_in.gml | 13 +- scripts/node_tunnel_out/node_tunnel_out.gml | 14 +- scripts/node_value/node_value.gml | 44 +++-- scripts/node_wrap_mesh/node_wrap_mesh.gml | 2 +- scripts/panel_animation/panel_animation.gml | 2 +- scripts/pcx_ast/pcx_ast.gml | 26 +-- scripts/render_data/render_data.gml | 185 +++++++++++++----- 62 files changed, 550 insertions(+), 322 deletions(-) create mode 100644 scripts/node_fluid_render_output/node_fluid_render_output.gml create mode 100644 scripts/node_fluid_render_output/node_fluid_render_output.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index f79dcb78e..c96515321 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -190,6 +190,7 @@ {"name":"color","order":53,"path":"folders/shader/filter/color.yy",}, {"name":"shadow caster","order":46,"path":"folders/shader/filter/shadow caster.yy",}, {"name":"flood fill","order":11,"path":"folders/shader/flood fill.yy",}, + {"name":"fluid","order":20,"path":"folders/shader/fluid.yy",}, {"name":"generator","order":1,"path":"folders/shader/generator.yy",}, {"name":"blinker","order":30,"path":"folders/shader/generator/blinker.yy",}, {"name":"cell","order":31,"path":"folders/shader/generator/cell.yy",}, @@ -215,7 +216,6 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, - {"name":"fluid","order":20,"path":"folders/shader/fluid.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -940,6 +940,7 @@ {"name":"o_dialog_fontscrollbox","order":4,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",}, {"name":"sh_d3d_normal_blur","order":25,"path":"shaders/sh_d3d_normal_blur/sh_d3d_normal_blur.yy",}, {"name":"d3d_vertex","order":10,"path":"scripts/d3d_vertex/d3d_vertex.yy",}, + {"name":"node_fluid_render_output","order":11,"path":"scripts/node_fluid_render_output/node_fluid_render_output.yy",}, {"name":"s_node_vfx_output","order":11,"path":"sprites/s_node_vfx_output/s_node_vfx_output.yy",}, {"name":"sh_greyscale","order":13,"path":"shaders/sh_greyscale/sh_greyscale.yy",}, {"name":"gameframe_native","order":2,"path":"extensions/gameframe_native/gameframe_native.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 607d29742..c5fef4ec5 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -221,6 +221,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"color","folderPath":"folders/shader/filter/color.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"shadow caster","folderPath":"folders/shader/filter/shadow caster.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"flood fill","folderPath":"folders/shader/flood fill.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluid","folderPath":"folders/shader/fluid.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"generator","folderPath":"folders/shader/generator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"blinker","folderPath":"folders/shader/generator/blinker.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"cell","folderPath":"folders/shader/generator/cell.yy",}, @@ -249,7 +250,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluid","folderPath":"folders/shader/fluid.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -1578,6 +1578,7 @@ {"id":{"name":"o_dialog_fontscrollbox","path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},}, {"id":{"name":"sh_d3d_normal_blur","path":"shaders/sh_d3d_normal_blur/sh_d3d_normal_blur.yy",},}, {"id":{"name":"d3d_vertex","path":"scripts/d3d_vertex/d3d_vertex.yy",},}, + {"id":{"name":"node_fluid_render_output","path":"scripts/node_fluid_render_output/node_fluid_render_output.yy",},}, {"id":{"name":"s_node_vfx_output","path":"sprites/s_node_vfx_output/s_node_vfx_output.yy",},}, {"id":{"name":"sh_greyscale","path":"shaders/sh_greyscale/sh_greyscale.yy",},}, {"id":{"name":"gameframe_native","path":"extensions/gameframe_native/gameframe_native.yy",},}, diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 7b28838b5..0bd9b7a3a 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -79,9 +79,7 @@ gameframe_set_fullscreen(2); }); - addHotkey("", "Render all", vk_f5, MOD_KEY.none, function() { - RENDER_ALL_REORDER - }); + addHotkey("", "Render all", vk_f5, MOD_KEY.none, function() { RENDER_ALL_REORDER }); addHotkey("", "Close file", "Q", MOD_KEY.ctrl, function() { PANEL_GRAPH.close(); }); addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 102729446..903e43a3b 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -80,7 +80,10 @@ _HOVERING_ELEMENT = noone; //physics_pause_enable(true); DEF_SURFACE_RESET(); - if(UPDATE_RENDER_ORDER) ResetAllNodesRender(); + if(UPDATE_RENDER_ORDER) { + ResetAllNodesRender(); + NodeTopoSort(); + } UPDATE_RENDER_ORDER = false; if(PROJECT.active) { diff --git a/scripts/__node_3d_extrude/__node_3d_extrude.gml b/scripts/__node_3d_extrude/__node_3d_extrude.gml index 8a7c66661..6ccf0b1ff 100644 --- a/scripts/__node_3d_extrude/__node_3d_extrude.gml +++ b/scripts/__node_3d_extrude/__node_3d_extrude.gml @@ -506,7 +506,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro } } - static postConnect = function() { + static postLoad = function() { generateMesh(); } } \ No newline at end of file diff --git a/scripts/append_function/append_function.gml b/scripts/append_function/append_function.gml index 900440344..8370855e5 100644 --- a/scripts/append_function/append_function.gml +++ b/scripts/append_function/append_function.gml @@ -119,7 +119,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { try { for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].postConnect(); + appended_list[| i].postLoad(); } catch(e) { log_warning("APPEND, connect", exception_print(e)); } diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index a1a25131e..683c41f4a 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -29,6 +29,7 @@ nodes = ds_list_create(); nodeMap = ds_map_create(); nodeNameMap = ds_map_create(); + nodeTopo = ds_list_create(); animator = new AnimationManager(); diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index d8ff4b800..ea98cca5f 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -193,18 +193,20 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false create_list[| i].preConnect(); for(var i = 0; i < ds_list_size(create_list); i++) create_list[| i].connect(); + for(var i = 0; i < ds_list_size(create_list); i++) + create_list[| i].postConnect(); } catch(e) { log_warning("LOAD, connect", exception_print(e)); } - try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].doUpdate(); - } catch(e) { - log_warning("LOAD, update", exception_print(e)); - } + //try { + // for(var i = 0; i < ds_list_size(create_list); i++) + // create_list[| i].doUpdate(); + //} catch(e) { + // log_warning("LOAD, update", exception_print(e)); + //} - Render(); + //Render(); if(!ds_queue_empty(CONNECTION_CONFLICT)) { var pass = 0; @@ -227,7 +229,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false try { for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].postConnect(); + create_list[| i].postLoad(); } catch(e) { log_warning("LOAD, connect", exception_print(e)); } @@ -239,7 +241,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false log_warning("LOAD, connect", exception_print(e)); } - Render(, true); + RENDER_ALL_REORDER LOADING = false; PROJECT.modified = false; diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index 25bf2c430..5bee9b672 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -149,7 +149,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static update = function(frame = PROJECT.animator.current_frame) { var _typ = getType(); - outputs[| 0].type = _typ; + outputs[| 0].setType(_typ); var res = []; var ind = 0; var spd = getInputData(1); @@ -162,10 +162,10 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { else array_push(res, val); - inputs[| i].type = inputs[| i].value_from? inputs[| i].value_from.type : _typ; + inputs[| i].setType(inputs[| i].value_from? inputs[| i].value_from.type : _typ); if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from) - outputs[| 0].type = inputs[| i].value_from.type; + outputs[| 0].setType(inputs[| i].value_from.type); } outputs[| 0].setValue(res); @@ -176,7 +176,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(_typ == VALUE_TYPE.any) return; for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { - inputs[| i].type = _typ; + inputs[| i].setType(_typ); inputs[| i].resetDisplay(); } } diff --git a/scripts/node_array_add/node_array_add.gml b/scripts/node_array_add/node_array_add.gml index 562e03688..5347f0e15 100644 --- a/scripts/node_array_add/node_array_add.gml +++ b/scripts/node_array_add/node_array_add.gml @@ -55,8 +55,8 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _arr = getInputData(0); if(inputs[| 0].value_from == noone) { - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); return; } @@ -64,13 +64,13 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _type = inputs[| 0].value_from.type; var spd = getInputData(1); - inputs[| 0].type = _type; - outputs[| 0].type = _type; + inputs[| 0].setType(_type); + outputs[| 0].setType(_type); var _out = array_clone(_arr); for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _val = getInputData(i); - inputs[| i].type = _type; + inputs[| i].setType(_type); if(is_array(_val) && spd) array_append(_out, _val); diff --git a/scripts/node_array_copy/node_array_copy.gml b/scripts/node_array_copy/node_array_copy.gml index b17efda7b..117af9986 100644 --- a/scripts/node_array_copy/node_array_copy.gml +++ b/scripts/node_array_copy/node_array_copy.gml @@ -21,8 +21,8 @@ function Node_Array_Copy(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _typ = VALUE_TYPE.any; if(inputs[| 0].value_from != noone) _typ = inputs[| 0].value_from.type; - inputs[| 0].type = _typ; - outputs[| 0].type = _typ; + inputs[| 0].setType(_typ); + outputs[| 0].setType(_typ); } static update = function(frame = PROJECT.animator.current_frame) { diff --git a/scripts/node_array_find/node_array_find.gml b/scripts/node_array_find/node_array_find.gml index dbfef4c91..8aa298128 100644 --- a/scripts/node_array_find/node_array_find.gml +++ b/scripts/node_array_find/node_array_find.gml @@ -18,8 +18,8 @@ function Node_Array_Find(_x, _y, _group = noone) : Node(_x, _y, _group) construc static update = function(frame = PROJECT.animator.current_frame) { var _arr = getInputData(0); - inputs[| 0].type = VALUE_TYPE.any; - inputs[| 1].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + inputs[| 1].setType(VALUE_TYPE.any); if(!is_array(_arr)) return; @@ -27,8 +27,8 @@ function Node_Array_Find(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - inputs[| 1].type = type; + inputs[| 0].setType(type); + inputs[| 1].setType(type); } outputs[| 0].setValue(array_find(_arr, value)); diff --git a/scripts/node_array_get/node_array_get.gml b/scripts/node_array_get/node_array_get.gml index 33d0ae860..f506b0435 100644 --- a/scripts/node_array_get/node_array_get.gml +++ b/scripts/node_array_get/node_array_get.gml @@ -19,12 +19,12 @@ function Node_Array_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); static step = function() { - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(inputs[| 0].value_from != noone) { - inputs[| 0].type = inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].type; + inputs[| 0].setType(inputs[| 0].value_from.type); + outputs[| 0].setType(inputs[| 0].type); } } diff --git a/scripts/node_array_insert/node_array_insert.gml b/scripts/node_array_insert/node_array_insert.gml index 575383b17..684893a84 100644 --- a/scripts/node_array_insert/node_array_insert.gml +++ b/scripts/node_array_insert/node_array_insert.gml @@ -22,9 +22,9 @@ function Node_Array_Insert(_x, _y, _group = noone) : Node(_x, _y, _group) constr static update = function(frame = PROJECT.animator.current_frame) { var _arr = getInputData(0); - inputs[| 0].type = VALUE_TYPE.any; - inputs[| 2].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + inputs[| 2].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(_arr)) return; @@ -35,9 +35,9 @@ function Node_Array_Insert(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - inputs[| 2].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + inputs[| 2].setType(type); + outputs[| 0].setType(type); } var arr = array_clone(_arr); diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index a0ed66895..63b44cc66 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -13,7 +13,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr static update = function(frame = PROJECT.animator.current_frame) { var _arr = getInputData(0); - inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; + inputs[| 0].setType(inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type); if(!is_array(_arr) || array_length(_arr) == 0) { outputs[| 0].setValue(0); diff --git a/scripts/node_array_remove/node_array_remove.gml b/scripts/node_array_remove/node_array_remove.gml index 4289f5976..3f03b9999 100644 --- a/scripts/node_array_remove/node_array_remove.gml +++ b/scripts/node_array_remove/node_array_remove.gml @@ -29,15 +29,15 @@ function Node_Array_Remove(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 2].setVisible(type == 0, type == 0); inputs[| 3].setVisible(type == 1, type == 1); - inputs[| 0].type = VALUE_TYPE.any; - inputs[| 3].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + inputs[| 3].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - inputs[| 3].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + inputs[| 3].setType(type); + outputs[| 0].setType(type); } } diff --git a/scripts/node_array_reverse/node_array_reverse.gml b/scripts/node_array_reverse/node_array_reverse.gml index bc367ef91..440f3a8c6 100644 --- a/scripts/node_array_reverse/node_array_reverse.gml +++ b/scripts/node_array_reverse/node_array_reverse.gml @@ -14,15 +14,15 @@ function Node_Array_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) const static update = function(frame = PROJECT.animator.current_frame) { var _arr = getInputData(0); - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(_arr)) return; if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + outputs[| 0].setType(type); } _arr = array_reverse(_arr); diff --git a/scripts/node_array_set/node_array_set.gml b/scripts/node_array_set/node_array_set.gml index 8680cf51e..5624e6b4b 100644 --- a/scripts/node_array_set/node_array_set.gml +++ b/scripts/node_array_set/node_array_set.gml @@ -19,9 +19,9 @@ function Node_Array_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct static update = function(frame = PROJECT.animator.current_frame) { var _arr = getInputData(0); - inputs[| 0].type = VALUE_TYPE.any; - inputs[| 2].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + inputs[| 2].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(_arr)) return; @@ -31,9 +31,9 @@ function Node_Array_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - inputs[| 2].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + inputs[| 2].setType(type); + outputs[| 0].setType(type); } var arr = array_clone(_arr); diff --git a/scripts/node_array_shift/node_array_shift.gml b/scripts/node_array_shift/node_array_shift.gml index 00737bfd3..3ca5b016f 100644 --- a/scripts/node_array_shift/node_array_shift.gml +++ b/scripts/node_array_shift/node_array_shift.gml @@ -17,15 +17,15 @@ function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _arr = getInputData(0); var _shf = getInputData(1); - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(_arr)) return; if(inputs[| 0].value_from != noone) { var type = inputs[| 0].value_from.type; - inputs[| 0].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + outputs[| 0].setType(type); } var arr = []; diff --git a/scripts/node_array_shuffle/node_array_shuffle.gml b/scripts/node_array_shuffle/node_array_shuffle.gml index 4c0c31c68..2051b81a5 100644 --- a/scripts/node_array_shuffle/node_array_shuffle.gml +++ b/scripts/node_array_shuffle/node_array_shuffle.gml @@ -16,15 +16,15 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const var arr = getInputData(0); var sed = getInputData(1); - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(arr)) return; arr = array_clone(arr); if(inputs[| 0].value_from != noone) { - inputs[| 0].type = inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].value_from.type; + inputs[| 0].setType(inputs[| 0].value_from.type); + outputs[| 0].setType(inputs[| 0].value_from.type); } random_set_seed(sed); diff --git a/scripts/node_array_sort/node_array_sort.gml b/scripts/node_array_sort/node_array_sort.gml index 06825e37b..7e93a107a 100644 --- a/scripts/node_array_sort/node_array_sort.gml +++ b/scripts/node_array_sort/node_array_sort.gml @@ -22,14 +22,14 @@ function Node_Array_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) construc var arr = getInputData(0); var asc = getInputData(1); - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); if(!is_array(arr)) return; if(inputs[| 0].value_from != noone) { - inputs[| 0].type = inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].value_from.type; + inputs[| 0].setType(inputs[| 0].value_from.type); + outputs[| 0].setType(inputs[| 0].value_from.type); } var _arr = []; diff --git a/scripts/node_array_zip/node_array_zip.gml b/scripts/node_array_zip/node_array_zip.gml index 322a5bf61..efb632664 100644 --- a/scripts/node_array_zip/node_array_zip.gml +++ b/scripts/node_array_zip/node_array_zip.gml @@ -52,21 +52,21 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _arr = getInputData(0); if(inputs[| 0].value_from == noone) { - inputs[| 0].type = VALUE_TYPE.any; - outputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); + outputs[| 0].setType(VALUE_TYPE.any); return; } if(!is_array(_arr)) return; var _type = inputs[| 0].value_from.type; - inputs[| 0].type = _type; - outputs[| 0].type = _type; + inputs[| 0].setType(_type); + outputs[| 0].setType(_type); var len = 1; var val = []; for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) { val[i] = getInputData(i); - inputs[| i].type = inputs[| i].value_from == noone? inputs[| i].value_from.type : VALUE_TYPE.any; + inputs[| i].setType(inputs[| i].value_from == noone? inputs[| i].value_from.type : VALUE_TYPE.any); if(!is_array(val[i])) { val[i] = [ val[i] ]; continue; diff --git a/scripts/node_color_from_hsv/node_color_from_hsv.gml b/scripts/node_color_from_hsv/node_color_from_hsv.gml index cb1c937c2..183ae2ebc 100644 --- a/scripts/node_color_from_hsv/node_color_from_hsv.gml +++ b/scripts/node_color_from_hsv/node_color_from_hsv.gml @@ -37,22 +37,22 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _nor = getInputData(3); if(_nor) { - inputs[| 0].type = VALUE_TYPE.integer; + inputs[| 0].setType(VALUE_TYPE.float); inputs[| 0].setDisplay(VALUE_DISPLAY.slider); - inputs[| 1].type = VALUE_TYPE.integer; + inputs[| 1].setType(VALUE_TYPE.float); inputs[| 1].setDisplay(VALUE_DISPLAY.slider); - inputs[| 2].type = VALUE_TYPE.integer; + inputs[| 2].setType(VALUE_TYPE.float); inputs[| 2].setDisplay(VALUE_DISPLAY.slider); } else { - inputs[| 0].type = VALUE_TYPE.integer; + inputs[| 0].setType(VALUE_TYPE.integer); inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 360, 1] }); - inputs[| 1].type = VALUE_TYPE.integer; + inputs[| 1].setType(VALUE_TYPE.integer); inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); - inputs[| 2].type = VALUE_TYPE.integer; + inputs[| 2].setType(VALUE_TYPE.integer); inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); } } diff --git a/scripts/node_color_from_rgb/node_color_from_rgb.gml b/scripts/node_color_from_rgb/node_color_from_rgb.gml index ebfd80751..62f8160e8 100644 --- a/scripts/node_color_from_rgb/node_color_from_rgb.gml +++ b/scripts/node_color_from_rgb/node_color_from_rgb.gml @@ -27,22 +27,22 @@ function Node_Color_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _nor = getInputData(3); if(_nor) { - inputs[| 0].type = VALUE_TYPE.float; + inputs[| 0].setType(VALUE_TYPE.float); inputs[| 0].setDisplay(VALUE_DISPLAY.slider); - inputs[| 1].type = VALUE_TYPE.float; + inputs[| 1].setType(VALUE_TYPE.float); inputs[| 1].setDisplay(VALUE_DISPLAY.slider); - inputs[| 2].type = VALUE_TYPE.float; + inputs[| 2].setType(VALUE_TYPE.float); inputs[| 2].setDisplay(VALUE_DISPLAY.slider); } else { - inputs[| 0].type = VALUE_TYPE.integer; + inputs[| 0].setType(VALUE_TYPE.integer); inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); - inputs[| 1].type = VALUE_TYPE.integer; + inputs[| 1].setType(VALUE_TYPE.integer); inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); - inputs[| 2].type = VALUE_TYPE.integer; + inputs[| 2].setType(VALUE_TYPE.integer); inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); } } diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index aed3b8fef..2caca1476 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -64,8 +64,8 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _txt1 = getInputData(7); var _txt2 = getInputData(8); - inputs[| 3].type = inputs[| 3].value_from == noone? VALUE_TYPE.any : inputs[| 3].value_from.type; - inputs[| 4].type = inputs[| 4].value_from == noone? VALUE_TYPE.any : inputs[| 4].value_from.type; + inputs[| 3].setType(inputs[| 3].value_from == noone? VALUE_TYPE.any : inputs[| 3].value_from.type); + inputs[| 4].setType(inputs[| 4].value_from == noone? VALUE_TYPE.any : inputs[| 4].value_from.type); var res = false; @@ -86,11 +86,11 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(res) { outputs[| 0].setValue(_true); - outputs[| 0].type = inputs[| 3].type; + outputs[| 0].setType(inputs[| 3].type); outputs[| 0].display_type = inputs[| 3].display_type; } else { outputs[| 0].setValue(_fals); - outputs[| 0].type = inputs[| 4].type; + outputs[| 0].setType(inputs[| 4].type); outputs[| 0].display_type = inputs[| 4].display_type; } diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index f3ff5e196..e8293f40d 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -70,7 +70,7 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const content = file_text_read_all_lines(path); var convert = getInputData(1); - outputs[| 0].type = convert? VALUE_TYPE.float : VALUE_TYPE.text; + outputs[| 0].setType(convert? VALUE_TYPE.float : VALUE_TYPE.text); if(convert) { for( var i = 0, n = array_length(content); i < n; i++ ) { var c = content[i]; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 63bf4b53d..188003545 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -102,10 +102,16 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x inspectInput1 = nodeValue("Toggle execution", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true); inspectInput2 = nodeValue("Toggle execution", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true); + inspectInput1.index = -1; + inspectInput2.index = -1; + autoUpdatedTrigger = true; updatedInTrigger = nodeValue("Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false).setVisible(true, true); updatedOutTrigger = nodeValue("Updated", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false).setVisible(true, true); + updatedInTrigger.index = -1; + updatedOutTrigger.index = -1; + updatedInTrigger.tags = VALUE_TAG.updateInTrigger; updatedOutTrigger.tags = VALUE_TAG.updateOutTrigger; @@ -123,8 +129,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x inputs_data = []; input_hash = ""; input_hash_raw = ""; - - anim_last_step = false; #endregion #region --- attributes ---- @@ -168,6 +172,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x render_cached = false; auto_render_time = true; updated = false; + passiveDynamic = false; + topoSorted = false; use_cache = CACHE_USE.none; cached_manual = false; @@ -327,11 +333,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x targ.setFrom(junctionFrom); } #endregion - static isAnimated = function() { #region + static isActiveDynamic = function() { #region + //if(passiveDynamic) return false; if(update_on_frame) return true; for(var i = 0; i < ds_list_size(inputs); i++) - if(inputs[| i].isAnimated()) return true; + if(inputs[| i].isActiveDynamic()) return true; return false; } #endregion @@ -453,18 +460,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } else { render_cached = false; var sBase = surface_get_target(); - //var _hash = input_hash; getInputs(); - //input_hash = md5_string_unicode(input_hash_raw); - anim_last_step = isAnimated() || /*_hash != input_hash || */!rendered; LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} [{anim_last_step}] <<<<<<<<<<"); + LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} <<<<<<<<<<"); if(!is_instanceof(self, Node_Collection)) setRenderStatus(true); try { - if(anim_last_step) update(); // Update only if input hash differs from previous. + update(); // Update only if input hash differs from previous. } catch(exception) { var sCurr = surface_get_target(); while(surface_get_target() != sBase) @@ -532,18 +536,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x LOG_BLOCK_END(); } #endregion - static resetRenderForward = function() { #region - setRenderStatus(false); + static forwardPassiveDynamic = function() { #region for( var i = 0, n = ds_list_size(outputs); i < n; i++ ) { var _outp = outputs[| i]; for(var j = 0; j < ds_list_size(_outp.value_to); j++) { var _to = _outp.value_to[| j]; - if(!_to.node.active || _to.value_from == noone) continue; - if(_to.value_from != self) continue; - if(!_to.node.rendered) continue; + if(!_to.node.active || _to.value_from != _outp) continue; - _to.node.resetRenderForward(); + _to.node.passiveDynamic = true; } } } #endregion @@ -565,7 +566,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if( val_from == noone) continue; if(!val_from.node.active) continue; if(!val_from.node.isRenderActive()) continue; - if!(val_from.node.rendered || val_from.node.update_on_frame) { + if(!val_from.node.rendered) { LOG_LINE_IF(global.FLAG.render == 1, $"Node {INAME} is not renderable because input {val_from.node.internalName} is not rendered ({val_from.node.rendered})"); return false; } @@ -1022,7 +1023,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x draw_set_color(COLORS.speed[0]); } - if(render_cached || !anim_last_step) draw_set_color(COLORS._main_text_sub); + if(render_cached) draw_set_color(COLORS._main_text_sub); draw_text(round(tx), round(ty), string(rt) + " " + unit); } @@ -1106,6 +1107,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static drawAnimationTimeline = function(_w, _h, _s) {} + static getAnimationCacheExist = function(frame) { return cacheExist(frame); } + static enable = function() { active = true; } static disable = function() { active = false; } @@ -1665,6 +1668,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static preConnect = function() {} static postConnect = function() {} + static postLoad = function() {} + static resetAnimation = function() {} static cleanUp = function() { #region diff --git a/scripts/node_fluid_render_output/node_fluid_render_output.gml b/scripts/node_fluid_render_output/node_fluid_render_output.gml new file mode 100644 index 000000000..4bc06107a --- /dev/null +++ b/scripts/node_fluid_render_output/node_fluid_render_output.gml @@ -0,0 +1,117 @@ +function Node_Fluid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y, _group) constructor { + name = "Render Domain"; + color = COLORS.node_blend_fluid; + icon = THEME.fluid_sim; + use_cache = CACHE_USE.auto; + + w = 128; + h = 128; + min_h = h; + previewable = true; + + inputs[| 0] = nodeValue("Fluid Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 2] = nodeValue("Interpolate", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 3] = nodeValue("Draw Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 4] = nodeValue("Auto Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + + input_display_list = [ + ["Domain", false], 0, + ["Render", false], 4, 1, 2, 3, + ]; + + attribute_surface_depth(); + + onSetDisplayName = noone; + + insp2UpdateTooltip = "Clear cache"; + insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ]; + + static onInspector2Update = function() { clearCache(); } + + static createOutput = function(override_order = true) { #region + if(group == noone) return; + if(!is_struct(group)) return; + + if(override_order) + attributes.input_priority = ds_list_size(group.outputs); + + if(!is_undefined(outParent)) + ds_list_remove(group.outputs, outParent); + + outParent = nodeValue("Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone) + .uncache() + .setVisible(true, true); + outParent.from = self; + + ds_list_add(group.outputs, outParent); + group.setHeight(); + group.sortIO(); + } if(!LOADING && !APPENDING) createOutput(); #endregion + + static step = function() { #region + if(!is_instanceof(outParent, NodeValue)) return noone; + outParent.name = display_name; + } #endregion + + static recoverCache = function(frame = PROJECT.animator.current_frame) { #region + if(!is_instanceof(outParent, NodeValue)) return false; + if(!cacheExist(frame)) return false; + + var _s = cached_output[PROJECT.animator.current_frame]; + outParent.setValue(_s); + + return true; + } #endregion + + static update = function(frame = PROJECT.animator.current_frame) { #region + if(!is_instanceof(outParent, NodeValue)) return noone; + if(recoverCache() || !PROJECT.animator.is_playing) return; + + var _dim = inputs[| 1].getValue(frame); + var _outSurf = outParent.getValue(); + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); + outParent.setValue(_outSurf); + + var _dom = inputs[| 0].getValue(frame); + var _int = inputs[| 2].getValue(frame); + var _drw = inputs[| 3].getValue(frame); + var _upd = inputs[| 4].getValue(frame); + + FLUID_DOMAIN_CHECK + + var fSurf = _dom.sf_material_0; + if(!is_surface(fSurf)) return; + + if(_upd) fd_rectangle_update(_dom); + texture_set_interpolation(false); + + surface_set_shader(_outSurf, sh_fd_visualize_colorize_glsl); + gpu_set_texfilter(_int); + draw_surface_stretched_safe(fSurf, 0, 0, _dim[0], _dim[1]); + gpu_set_texfilter(false); + + if(_drw && is_surface(_dom.sf_world)) + draw_surface_stretched_safe(_dom.sf_world, 0, 0, _dim[0], _dim[1]); + surface_reset_shader(); + + group.outputNode = self; + var frm = cacheCurrentFrame(_outSurf); + } #endregion + + static getGraphPreviewSurface = function() { #region + if(!is_instanceof(outParent, NodeValue)) return noone; + return outParent.getValue(); + } #endregion + + static getPreviewValues = function() { #region + if(!is_instanceof(outParent, NodeValue)) return noone; + return outParent.getValue(); + } #endregion +} \ No newline at end of file diff --git a/scripts/node_fluid_render_output/node_fluid_render_output.yy b/scripts/node_fluid_render_output/node_fluid_render_output.yy new file mode 100644 index 000000000..16c7f2ab2 --- /dev/null +++ b/scripts/node_fluid_render_output/node_fluid_render_output.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_fluid_render_output", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "fluidSim", + "path": "folders/nodes/data/simulation/fluidSim.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_fluid_sim/node_fluid_sim.gml b/scripts/node_fluid_sim/node_fluid_sim.gml index 9a2f14dad..f0bc17e3f 100644 --- a/scripts/node_fluid_sim/node_fluid_sim.gml +++ b/scripts/node_fluid_sim/node_fluid_sim.gml @@ -8,6 +8,8 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro ungroupable = false; update_on_frame = true; + outputNode = noone; + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF) .setDisplay(VALUE_DISPLAY.vector); @@ -57,10 +59,9 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro if(!LOADING && !APPENDING && !CLONING) { //var _domain = nodeBuild("Node_Fluid_Domain", -384, -32, self); - var _render = nodeBuild("Node_Fluid_Render", 128, -32, self); - var _output = nodeBuild("Node_Group_Output", 384, -32, self); + var _render = nodeBuild("Node_Fluid_Render_Output", 128, -32, self); - _output.inputs[| 0].setFrom(_render.outputs[| 0]); + //_output.inputs[| 0].setFrom(_render.outputs[| 0]); //_render.inputs[| 0].setFrom(_domain.outputs[| 0]); } @@ -118,5 +119,10 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro fd_rectangle_set_repeat(domain, wrap); } + static getAnimationCacheExist = function(frame) { + if(outputNode == noone) return false; + return outputNode.cacheExist(frame); + } + PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index 49f9d67aa..06a39b9f9 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -62,7 +62,7 @@ function variable_editor(nodeVal) constructor { slider_step = 0.01; static refreshInput = function() { - value.type = val_type[type_index]; + value.setType(val_type[type_index]); value.name = value_name; if(_type_index != type_index || _disp_index != disp_index) { diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 21d857c94..8fafcfedb 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -129,7 +129,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(ind == inputs[| 2].getValue()) return; - outputs[| 0].type = juncTo.type; + outputs[| 0].setType(juncTo.type); inputs[| 2].setValue(ind); } @@ -165,8 +165,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru _dtype = array_safe_get(array_safe_get(display_list, _val_type, []), _dtype); - inParent.type = _val_type; - outputs[| 0].type = _val_type; + inParent.setType(_val_type); + outputs[| 0].setType(_val_type); var _val = inParent.getValue(); switch(_dtype) { @@ -235,8 +235,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru break; case "Gradient": - inParent.type = VALUE_TYPE.gradient; - outputs[| 0].type = inParent.type; + inParent.setType(VALUE_TYPE.gradient); + outputs[| 0].setType(inParent.type); inParent.animator = new valueAnimator(new gradientObject(c_white), inParent); inParent.setDisplay(VALUE_DISPLAY._default); diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 5ae44ea03..2cce26ba9 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -21,10 +21,6 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr .uncache() .setVisible(true, true); - inputs[| 1] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .uncache() - .rejectArray(); - attributes.inherit_name = !LOADING && !APPENDING; outParent = undefined; output_index = -1; @@ -98,23 +94,20 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr group.sortIO(); outParent.setFrom(inputs[| 0]); - } - - if(!LOADING && !APPENDING) - createOutput(); + } if(!LOADING && !APPENDING) createOutput(); static step = function() { if(is_undefined(outParent)) return; outParent.name = display_name; - inputs[| 0].type = VALUE_TYPE.any; + inputs[| 0].setType(VALUE_TYPE.any); if(inputs[| 0].value_from != noone) { - inputs[| 0].type = inputs[| 0].value_from.type; + inputs[| 0].setType(inputs[| 0].value_from.type); inputs[| 0].display_type = inputs[| 0].value_from.display_type; } - outParent.type = inputs[| 0].type; + outParent.setType(inputs[| 0].type); outParent.display_type = inputs[| 0].display_type; onSetDisplayName = _onSetDisplayName; @@ -126,20 +119,9 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr } } - //static triggerRender = function() { - // if(is_undefined(outParent)) return; - - // for(var j = 0; j < ds_list_size(outParent.value_to); j++) { - // if(outParent.value_to[| j].value_from == outParent) - // outParent.value_to[| j].node.triggerRender(); - // } - //} - static postDeserialize = function() { createOutput(false); - var _inputs = load_map.inputs; - inputs[| 1].applyDeserialize(_inputs[1], load_scale); if(PROJECT.version < 11520) attributes.input_priority = getInputData(1); group.sortIO(); } diff --git a/scripts/node_hlsl/node_hlsl.gml b/scripts/node_hlsl/node_hlsl.gml index 0027f6091..652e2713b 100644 --- a/scripts/node_hlsl/node_hlsl.gml +++ b/scripts/node_hlsl/node_hlsl.gml @@ -100,50 +100,50 @@ output.color = surfaceColor;") switch(type) { case 1 : if(is_array(cur_valu)) inp_valu.overrideValue(0); - inp_valu.type = VALUE_TYPE.integer; + inp_valu.setType(VALUE_TYPE.integer); inp_valu.setDisplay(VALUE_DISPLAY._default); break; case 0 : if(is_array(cur_valu)) inp_valu.overrideValue(0); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY._default); break; case 2 : if(!is_array(cur_valu) || array_length(cur_valu) != 2) inp_valu.overrideValue([ 0, 0 ]); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 3 : if(!is_array(cur_valu) || array_length(cur_valu) != 3) inp_valu.overrideValue([ 0, 0, 0 ]); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 4 : if(!is_array(cur_valu) || array_length(cur_valu) != 4) inp_valu.overrideValue([ 0, 0, 0, 0 ]); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 5 : if(!is_array(cur_valu) || array_length(cur_valu) != 9) inp_valu.overrideValue(array_create(9)); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 3 }); break; case 6 : if(!is_array(cur_valu) || array_length(cur_valu) != 16) inp_valu.overrideValue(array_create(16)); - inp_valu.type = VALUE_TYPE.float; + inp_valu.setType(VALUE_TYPE.float); inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 4 }); break; case 7 : - inp_valu.type = VALUE_TYPE.surface; + inp_valu.setType(VALUE_TYPE.surface); inp_valu.setDisplay(VALUE_DISPLAY._default); break; case 8 : - inp_valu.type = VALUE_TYPE.color; + inp_valu.setType(VALUE_TYPE.color); inp_valu.setDisplay(VALUE_DISPLAY._default); break; } @@ -365,7 +365,7 @@ struct PixelShaderOutput { return _output; } #endregion - static postConnect = function() { + static postLoad = function() { refreshShader(); refreshDynamicInput(); } diff --git a/scripts/node_iterate_each/node_iterate_each.gml b/scripts/node_iterate_each/node_iterate_each.gml index 3f75c5b30..874021a63 100644 --- a/scripts/node_iterate_each/node_iterate_each.gml +++ b/scripts/node_iterate_each/node_iterate_each.gml @@ -26,7 +26,7 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou static onStep = function() { var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - inputs[| 0].type = type; + inputs[| 0].setType(type); } static doInitLoop = function() { diff --git a/scripts/node_iterate_filter/node_iterate_filter.gml b/scripts/node_iterate_filter/node_iterate_filter.gml index 0b52415df..ea92f0e21 100644 --- a/scripts/node_iterate_filter/node_iterate_filter.gml +++ b/scripts/node_iterate_filter/node_iterate_filter.gml @@ -28,7 +28,7 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr static onStep = function() { var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - inputs[| 0].type = type; + inputs[| 0].setType(type); } static doInitLoop = function() { diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index ee1a22999..b4103deef 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -11,6 +11,8 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone ); + topoList = ds_list_create(); + custom_input_index = ds_list_size(inputs); custom_output_index = ds_list_size(inputs); loop_start_time = 0; @@ -36,10 +38,12 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr static onStep = function() { var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - inputs[| 0].type = type; + inputs[| 0].setType(type); } static update = function(frame = PROJECT.animator.current_frame) { + if(frame == 0) NodeListSort(topoList, nodes); + initLoop(); } @@ -79,7 +83,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr inputNodes[0].setValue(val1); inputNodes[1].setValue(val2); - RenderList(nodes); + RenderList(topoList); var res = outputNode.getValue(); //print("Comparing " + string(val1) + ", " + string(val2) + ": " + string(res)); return res; @@ -87,8 +91,8 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr static initLoop = function() { if(inputs[| 0].value_from) { - inputs[| 0].type = inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].value_from.type; + inputs[| 0].setType(inputs[| 0].value_from.type); + outputs[| 0].setType(inputs[| 0].value_from.type); } resetRender(); @@ -101,11 +105,11 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr for( var i = 0; i < ds_list_size(nodes); i++ ) { if(nodes[| i].display_name == "Value 1") { inputNodes[0] = nodes[| i].inputs[| 0]; - inputNodes[0].type = inputs[| 0].type; + inputNodes[0].setType(inputs[| 0].type); inputReady++; } else if(nodes[| i].display_name == "Value 2") { inputNodes[1] = nodes[| i].inputs[| 0]; - inputNodes[1].type = inputs[| 0].type; + inputNodes[1].setType(inputs[| 0].type); inputReady++; } else if(nodes[| i].name == "Swap result") { outputNode = nodes[| i].inputs[| 0]; diff --git a/scripts/node_iterator_each_input/node_iterator_each_input.gml b/scripts/node_iterator_each_input/node_iterator_each_input.gml index 656ffe68f..3109a2ff5 100644 --- a/scripts/node_iterator_each_input/node_iterator_each_input.gml +++ b/scripts/node_iterator_each_input/node_iterator_each_input.gml @@ -19,7 +19,7 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group) static step = function() { if(!variable_struct_exists(group, "iterated")) return; - outputs[| 0].type = group.inputs[| 0].type; + outputs[| 0].setType(group.inputs[| 0].type); } } \ No newline at end of file diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.gml b/scripts/node_iterator_each_output/node_iterator_each_output.gml index 7d7612b29..8cc885166 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -19,9 +19,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group if(!variable_struct_exists(group, "iterated")) return; var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - inputs[| 0].type = type; - group.outputs[| 0].type = type; - outputs[| 0].type = type; + inputs[| 0].setType(type); + group.outputs[| 0].setType(type); + outputs[| 0].setType(type); } static cloneValue = function(_prev_val, _val) { diff --git a/scripts/node_iterator_filter_input/node_iterator_filter_input.gml b/scripts/node_iterator_filter_input/node_iterator_filter_input.gml index 1d938690f..bf3575542 100644 --- a/scripts/node_iterator_filter_input/node_iterator_filter_input.gml +++ b/scripts/node_iterator_filter_input/node_iterator_filter_input.gml @@ -19,7 +19,7 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou static step = function() { if(!variable_struct_exists(group, "iterated")) return; - outputs[| 0].type = group.inputs[| 0].type; + outputs[| 0].setType(group.inputs[| 0].type); } } \ No newline at end of file diff --git a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml index 342ba5d50..ecbd9239b 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -19,8 +19,8 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro if(!variable_struct_exists(group, "iterated")) return; var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - inputs[| 0].type = type; - group.outputs[| 0].type = type; + inputs[| 0].setType(type); + group.outputs[| 0].setType(type); } static update = function(frame = PROJECT.animator.current_frame) { diff --git a/scripts/node_iterator_sort_input/node_iterator_sort_input.gml b/scripts/node_iterator_sort_input/node_iterator_sort_input.gml index 7ac8e6692..4b573f9af 100644 --- a/scripts/node_iterator_sort_input/node_iterator_sort_input.gml +++ b/scripts/node_iterator_sort_input/node_iterator_sort_input.gml @@ -10,7 +10,7 @@ function Node_Iterator_Sort_Input(_x, _y, _group = noone) : Node(_x, _y, _group) outputs[| 0] = nodeValue("Value in", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 ); static update = function() { - outputs[| 0].type = inputs[| 0].type; + outputs[| 0].setType(inputs[| 0].type); var val = getInputData(0); outputs[| 0].setValue(val); 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 924720ecf..b33129d25 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -159,18 +159,18 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons if(!variable_struct_exists(_str, k)) { out.setValue(0); - out.type = VALUE_TYPE.float; + out.setType(VALUE_TYPE.float); break; } var val = variable_struct_get(_str, k); if(j == array_length(keys) - 1) { if(is_struct(val)) - out.type = VALUE_TYPE.struct; + out.setType(VALUE_TYPE.struct); else if(is_array(val) && array_length(val)) - out.type = is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float; + out.setType(is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float); else - out.type = is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float; + out.setType(is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float); out.setValue(val); } 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 71884cf5c..37d3e280d 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -91,7 +91,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con var _key = getInputData(i + 0); var _val = getInputData(i + 1); - inputs[| i + 1].type = inputs[| i + 1].value_from? inputs[| i + 1].value_from.type : VALUE_TYPE.any; + inputs[| i + 1].setType(inputs[| i + 1].value_from? inputs[| i + 1].value_from.type : VALUE_TYPE.any); variable_struct_set(cont, _key, _val); } @@ -105,7 +105,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con 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.type = typ; + inp.setType(typ); } } diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 510c40a87..456cf08de 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -73,9 +73,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _type = getInputData(1); switch(_type) { - case 0 : outputs[| 1].type = VALUE_TYPE.float; break; - case 1 : outputs[| 1].type = VALUE_TYPE.text; break; - case 2 : outputs[| 1].type = VALUE_TYPE.struct; break; + case 0 : outputs[| 1].setType(VALUE_TYPE.float); break; + case 1 : outputs[| 1].setType(VALUE_TYPE.text); break; + case 2 : outputs[| 1].setType(VALUE_TYPE.struct); break; } } @@ -105,10 +105,10 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru var type = getInputData(i + 1); switch(type) { - case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; - case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; - case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; - case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; + 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); @@ -248,10 +248,10 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| i + 2].name = name; switch(type) { - case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; - case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; - case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; - case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; + 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); diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index 330448eb6..71f5fcbc2 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -99,10 +99,10 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru var type = getInputData(i + 1); switch(type) { - case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; - case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; - case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; - case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; + 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); @@ -243,10 +243,10 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| i + 2].name = name; switch(type) { - case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; - case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; - case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; - case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; + 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); diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index 0c7fe9902..83fdbde46 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -129,13 +129,13 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| 4].setVisible(true); var int = getInputData(4); - if(int) outputs[| 0].type = VALUE_TYPE.integer; - else outputs[| 0].type = VALUE_TYPE.float; + if(int) outputs[| 0].setType(VALUE_TYPE.integer); + else outputs[| 0].setType(VALUE_TYPE.float); break; default: inputs[| 4].setVisible(false); - outputs[| 0].type = VALUE_TYPE.float; + outputs[| 0].setType(VALUE_TYPE.float); break; } diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index 92fa2f0b3..4e333d216 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -67,11 +67,11 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co } for( var i = 0; i < 1; i++ ) { - inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + inputs[| i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); inputs[| i].editWidget.slide_speed = int? 1 : 0.1; } - outputs[| 0].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); } static processData = function(_output, _data, _output_index, _array_index = 0) { @@ -232,12 +232,12 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var disp = inputs[| 3].getValueCached(); for( var i = 0; i < 2; i++ ) { - inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + inputs[| i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); inputs[| i].editWidget.slide_speed = int? 1 : 0.1; } inputs[| 4].setVisible(disp == 1, disp == 1); - outputs[| 0].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); w = 96; min_h = 80; @@ -414,11 +414,11 @@ function Node_Vector3(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c static step = function() { var int = inputs[| 3].getValueCached(); for( var i = 0; i < 3; i++ ) { - inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + inputs[| i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); inputs[| i].editWidget.slide_speed = int? 1 : 0.1; } - outputs[| 0].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); } static processData = function(_output, _data, _output_index, _array_index = 0) { @@ -469,11 +469,11 @@ function Node_Vector4(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c static step = function() { var int = inputs[| 4].getValueCached(); for( var i = 0; i < 4; i++ ) { - inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + inputs[| i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); inputs[| i].editWidget.slide_speed = int? 1 : 0.1; } - outputs[| 0].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; + outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); } static processData = function(_output, _data, _output_index, _array_index = 0) { @@ -519,9 +519,9 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro if(inputs[| 0].value_from.type == VALUE_TYPE.integer) type = VALUE_TYPE.integer; - inputs[| 0].type = type; + inputs[| 0].setType(type); for( var i = 0; i < 4; i++ ) - outputs[| i].type = type; + outputs[| i].setType(type); } static processData = function(_output, _data, _output_index, _array_index = 0) { diff --git a/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml b/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml index 76262bc09..fbaabca03 100644 --- a/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml +++ b/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml @@ -44,14 +44,14 @@ function Node_PB_Draw_Round_Rectangle(_x, _y, _group = noone) : Node_PB_Draw(_x, inputs[| 5].setVisible(_type == 1); if(_rela) { - inputs[| 4].type = VALUE_TYPE.float; - inputs[| 5].type = VALUE_TYPE.float; + inputs[| 4].setType(VALUE_TYPE.float); + inputs[| 5].setType(VALUE_TYPE.float); inputs[| 4].editWidget.slide_speed = 0.01; inputs[| 5].editWidget.setSlideSpeed(0.01); } else { - inputs[| 4].type = VALUE_TYPE.integer; - inputs[| 5].type = VALUE_TYPE.integer; + inputs[| 4].setType(VALUE_TYPE.integer); + inputs[| 5].setType(VALUE_TYPE.integer); inputs[| 4].editWidget.slide_speed = 1; inputs[| 5].editWidget.setSlideSpeed(1); diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index a164da0f0..bae81244b 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -21,8 +21,8 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); static update = function(frame = PROJECT.animator.current_frame) { - inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].type; + inputs[| 0].setType(inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type); + outputs[| 0].setType(inputs[| 0].type); outputs[| 0].value_from = inputs[| 0].value_from; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 1036f6fa7..2e4c63d9e 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -202,8 +202,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio var fluidSim = ds_list_create(); #region addNodeCatagory("FluidSim", fluidSim, ["Node_Fluid_Group"]); ds_list_add(fluidSim, "Group"); - addNodeObject(fluidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); - addNodeObject(fluidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); + addNodeObject(fluidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); + addNodeObject(fluidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); + addNodeObject(fluidSim, "Render Domain", s_node_fluidSim_render, "Node_Fluid_Render_Output", [1, Node_Fluid_Render_Output]).setVersion(11540); ds_list_add(fluidSim, "Domain"); addNodeObject(fluidSim, "Fluid Domain", s_node_fluidSim_domain, "Node_Fluid_Domain", [1, Node_Fluid_Domain]).setVersion(1120); diff --git a/scripts/node_string_trim/node_string_trim.gml b/scripts/node_string_trim/node_string_trim.gml index 1a9a0e2cc..5b7244796 100644 --- a/scripts/node_string_trim/node_string_trim.gml +++ b/scripts/node_string_trim/node_string_trim.gml @@ -28,8 +28,8 @@ function Node_String_Trim(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou static step = function() { var mode = getInputData(4); - inputs[| 1].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer; - inputs[| 2].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer; + inputs[| 1].setType(mode? VALUE_TYPE.float : VALUE_TYPE.integer); + inputs[| 2].setType(mode? VALUE_TYPE.float : VALUE_TYPE.integer); } static processData = function(_output, _data, _index = 0) { diff --git a/scripts/node_struct/node_struct.gml b/scripts/node_struct/node_struct.gml index 9f5e437f8..8dd4c4c11 100644 --- a/scripts/node_struct/node_struct.gml +++ b/scripts/node_struct/node_struct.gml @@ -57,7 +57,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor 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.type = typ; + inp.setType(typ); } } diff --git a/scripts/node_struct_get/node_struct_get.gml b/scripts/node_struct_get/node_struct_get.gml index a93f86cda..3856acfbe 100644 --- a/scripts/node_struct_get/node_struct_get.gml +++ b/scripts/node_struct_get/node_struct_get.gml @@ -25,7 +25,7 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(!variable_struct_exists(_str, k)) { out.setValue(0); - out.type = VALUE_TYPE.float; + out.setType(VALUE_TYPE.float); break; } @@ -33,17 +33,17 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(j == array_length(keys) - 1) { if(is_struct(val)) { if(is_instanceof(val, Surface)) { - out.type = VALUE_TYPE.surface; + out.setType(VALUE_TYPE.surface); val = val.get(); } else if(is_instanceof(val, Buffer)) { - out.type = VALUE_TYPE.buffer; + out.setType(VALUE_TYPE.buffer); val = val.buffer; } else - out.type = VALUE_TYPE.struct; + out.setType(VALUE_TYPE.struct); } else if(is_array(val) && array_length(val)) - out.type = is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float; + out.setType(is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float); else - out.type = is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float; + out.setType(is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float); out.setValue(val); } diff --git a/scripts/node_switch/node_switch.gml b/scripts/node_switch/node_switch.gml index 7bccedf30..23835937c 100644 --- a/scripts/node_switch/node_switch.gml +++ b/scripts/node_switch/node_switch.gml @@ -66,12 +66,12 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor static onValueFromUpdate = function(index) { if(LOADING || APPENDING) return; - inputs[| 1].type = inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any; + inputs[| 1].setType(inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any); for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { - inputs[| i + 1].type = VALUE_TYPE.any; + inputs[| i + 1].setType(VALUE_TYPE.any); if(inputs[| i + 1].value_from != noone) - inputs[| i + 1].type = inputs[| i + 1].value_from.type; + inputs[| i + 1].setType(inputs[| i + 1].value_from.type); } } @@ -89,7 +89,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var sele = getInputData(0); var _res = getInputData(1); - outputs[| 0].type = inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any; + outputs[| 0].setType(inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any); for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { var _cas = getInputData(i + 0); @@ -97,7 +97,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(sele == _cas) { _res = _val; - outputs[| 0].type = inputs[| i + 1].type; + outputs[| 0].setType(inputs[| i + 1].type); } } diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index 43cc65f7c..b6dca0f94 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -52,7 +52,6 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static onClone = function() { onValueUpdate(); } static update = function(frame = PROJECT.animator.current_frame) { onValueUpdate(); } static resetMap = function() { @@ -83,7 +82,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static onValueUpdate = function(index = 0) { + static onValueUpdate = function(index = -1) { var _key = getInputData(0); resetMap(); @@ -102,7 +101,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct k = ds_map_find_next(TUNNELS_IN_MAP, k); } - RENDER_ALL + if(index == 0) { RENDER_ALL_REORDER } } static step = function() { @@ -111,10 +110,10 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct value_validation[VALIDATION.error] = error_notification != noone; if(inputs[| 1].value_from == noone) { - inputs[| 1].type = VALUE_TYPE.any; + inputs[| 1].setType(VALUE_TYPE.any); inputs[| 1].display_type = VALUE_DISPLAY._default; } else { - inputs[| 1].type = inputs[| 1].value_from.type; + inputs[| 1].setType(inputs[| 1].value_from.type); inputs[| 1].display_type = inputs[| 1].value_from.display_type; } } @@ -155,7 +154,9 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } - static postConnect = function() { onValueUpdate(); } + static onClone = function() { onValueUpdate(0); } + + static postConnect = function() { onValueUpdate(0); } static onDestroy = function() { if(error_notification != noone) diff --git a/scripts/node_tunnel_out/node_tunnel_out.gml b/scripts/node_tunnel_out/node_tunnel_out.gml index 02e09f829..e1f28eed2 100644 --- a/scripts/node_tunnel_out/node_tunnel_out.gml +++ b/scripts/node_tunnel_out/node_tunnel_out.gml @@ -53,23 +53,21 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc draw_set_alpha(1); } - static onClone = function() { onValueUpdate(); } - - static onValueUpdate = function() { + static onValueUpdate = function(index = -1) { var _key = getInputData(0); TUNNELS_OUT[? node_id] = _key; - RENDER_ALL + if(index == 0) { RENDER_ALL_REORDER } } static step = function() { var _key = getInputData(0); if(ds_map_exists(TUNNELS_IN, _key)) { - outputs[| 0].type = TUNNELS_IN[? _key].type; + outputs[| 0].setType(TUNNELS_IN[? _key].type); outputs[| 0].display_type = TUNNELS_IN[? _key].display_type; } else { - outputs[| 0].type = VALUE_TYPE.any; + outputs[| 0].setType(VALUE_TYPE.any); outputs[| 0].display_type = VALUE_DISPLAY._default; } } @@ -90,5 +88,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } - static postConnect = function() { onValueUpdate(); } + static onClone = function() { onValueUpdate(0); } + + static postConnect = function() { onValueUpdate(0); } } \ No newline at end of file diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 41c5c9740..a0c52025f 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1129,6 +1129,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } #endregion resetDisplay(); + static setType = function(_type) { #region + if(type == _type) return false; + + type = _type; + draw_junction_index = type; + + return true; + } #endregion + static expressionUpdate = function() { #region expTree = evaluateFunctionList(expression); resetCache(); @@ -1303,7 +1312,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru global.cache_call++; if(useCache && use_cache) { var cache_hit = cache_value[0]; - cache_hit &= !isAnimated() || cache_value[1] == _time; + cache_hit &= !isActiveDynamic() || cache_value[1] == _time; cache_hit &= cache_value[2] != undefined; cache_hit &= cache_value[3] == applyUnit; cache_hit &= connect_type == JUNCTION_CONNECT.input; @@ -1319,7 +1328,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var val = _getValue(_time, applyUnit, arrIndex, log); draw_junction_index = type; - if(type == VALUE_TYPE.surface) { + if(type == VALUE_TYPE.surface || type == VALUE_TYPE.any) { var _sval = val; if(is_array(_sval) && !array_empty(_sval)) _sval = _sval[0]; @@ -1472,12 +1481,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru PANEL_ANIMATION.updatePropertyList(); } #endregion - static __anim = function() { #region - if(node.update_on_frame) return true; + static isActiveDynamic = function() { #region + gml_pragma("forceinline"); + + if(value_from != noone) return false; if(expUse) { if(!is_struct(expTree)) return false; - var res = expTree.isAnimated(); + var res = expTree.isDynamic(); switch(res) { case EXPRESS_TREE_ANIM.none : return false; @@ -1489,18 +1500,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return is_anim; } #endregion - static isAnimated = function() { #region - gml_pragma("forceinline"); - - if(value_from == noone) return __anim(); - - var from_anim = value_from.isAnimated(); - var from_self_anim = value_from.__anim(); - var from_node_anim = value_from.node.anim_last_step; - - return from_anim || from_self_anim || from_node_anim; - } #endregion - static showValue = function() { #region var useCache = true; if(display_type == VALUE_DISPLAY.area) @@ -1747,7 +1746,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru PROJECT.modified = true; } - UPDATE_RENDER_ORDER = true; + RENDER_ALL_REORDER if(onSetFrom != noone) onSetFrom(_valueFrom); if(_valueFrom.onSetTo != noone) _valueFrom.onSetTo(self); @@ -1767,7 +1766,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru PROJECT.modified = true; - UPDATE_RENDER_ORDER = true; + RENDER_ALL_REORDER return false; } #endregion @@ -1871,7 +1870,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static drawJunction = function(_s, _mx, _my, sca = 1) { #region if(!isVisible()) return false; - var ss = max(0.25, _s / 2); + var ss = max(0.25, _s / 2); var is_hover = false; if(PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, x, y, 10 * _s * sca)) { @@ -2347,6 +2346,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(APPENDING) def_val = getValue(0); + if(connect_type == JUNCTION_CONNECT.input && index >= 0) { + node.inputs_data[index] = animator.getValue(0); + //print($"Set input {node.name} - {index} = {node.inputs_data[index]} | {node.inputs_data}"); + } + onValidate(); } #endregion diff --git a/scripts/node_wrap_mesh/node_wrap_mesh.gml b/scripts/node_wrap_mesh/node_wrap_mesh.gml index 359c5a87e..3cd57a215 100644 --- a/scripts/node_wrap_mesh/node_wrap_mesh.gml +++ b/scripts/node_wrap_mesh/node_wrap_mesh.gml @@ -729,7 +729,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(struct_has(attr, "mesh_bound")) attributes.mesh_bound = attr.mesh_bound;; } - static postConnect = function() { + static postLoad = function() { setTriangle(); if(loadPin == noone) return; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index d5fd8922c..a24aa17c9 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -478,7 +478,7 @@ function Panel_Animation() : PanelContent() constructor { var x0 = (i + 0) * ui(timeline_scale) + timeline_shift; var x1 = (i + 1) * ui(timeline_scale) + timeline_shift; - draw_set_color(inspecting.cacheExist(i)? c_lime : c_red); + draw_set_color(inspecting.getAnimationCacheExist(i)? c_lime : c_red); draw_set_alpha(0.5); draw_rectangle(x0, bar_h - ui(4), x1, bar_h, false); draw_set_alpha(1); diff --git a/scripts/pcx_ast/pcx_ast.gml b/scripts/pcx_ast/pcx_ast.gml index 8f3eb5d7d..389e25a8f 100644 --- a/scripts/pcx_ast/pcx_ast.gml +++ b/scripts/pcx_ast/pcx_ast.gml @@ -131,10 +131,10 @@ return true; } - static isAnimated = function() { + static isDynamic = function() { var anim = EXPRESS_TREE_ANIM.none; for( var i = 0, n = array_length(funcTrees); i < n; i++ ) - anim = max(anim, funcTrees[i].isAnimated()); + anim = max(anim, funcTrees[i].isDynamic()); return anim; } @@ -161,12 +161,12 @@ return true; } - static isAnimated = function() { + static isDynamic = function() { var anim = EXPRESS_TREE_ANIM.none; - if(condition != noone) anim = max(anim, condition.isAnimated()); - if(if_true != noone) anim = max(anim, if_true.isAnimated()); - if(if_false != noone) anim = max(anim, if_false.isAnimated()); + if(condition != noone) anim = max(anim, condition.isDynamic()); + if(if_true != noone) anim = max(anim, if_true.isDynamic()); + if(if_false != noone) anim = max(anim, if_false.isDynamic()); return anim; } @@ -208,17 +208,17 @@ return true; } - static isAnimated = function() { + static isDynamic = function() { var anim = EXPRESS_TREE_ANIM.none; if(itr_array) { - if(cond_arr == noone) anim = max(anim, cond_arr.isAnimated()) + if(cond_arr == noone) anim = max(anim, cond_arr.isDynamic()) } else { - if(cond_init == noone) anim = max(anim, cond_init.isAnimated()) - if(cond_term == noone) anim = max(anim, cond_term.isAnimated()) + if(cond_init == noone) anim = max(anim, cond_init.isDynamic()) + if(cond_term == noone) anim = max(anim, cond_term.isDynamic()) } - if(action != noone) anim = max(anim, action.isAnimated()) + if(action != noone) anim = max(anim, action.isDynamic()) return anim; } @@ -324,7 +324,7 @@ static _isAnimated = function(val) { #region if(is_real(val)) return EXPRESS_TREE_ANIM.none; - if(is_struct(val)) return val.isAnimated(); + if(is_struct(val)) return val.isDynamic(); if(is_array(val)) { var anim = EXPRESS_TREE_ANIM.none; for( var i = 0, n = array_length(val); i < n; i++ ) @@ -339,7 +339,7 @@ return anim[0]; } #endregion - static isAnimated = function() { #region + static isDynamic = function() { #region if(anim_cache && anim_stat != undefined) return anim_stat; anim_stat = EXPRESS_TREE_ANIM.none; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 5280ab2cb..ae324c6e6 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -7,13 +7,14 @@ enum RENDER_TYPE { #region globalvar globalvar UPDATE, RENDER_QUEUE, RENDER_ORDER, UPDATE_RENDER_ORDER; UPDATE_RENDER_ORDER = false; - global.FLAG.render = 1; + global.FLAG.render = 0; global.group_io = [ "Node_Group_Input", "Node_Group_Output", "Node_Feedback_Input", "Node_Feedback_Output", "Node_Iterator_Input", "Node_Iterator_Output", "Node_Iterator_Each_Input", "Node_Iterator_Each_Output", "Node_Iterator_Filter_Input", "Node_Iterator_Filter_Output", + "Node_Tunnel_In", "Node_Tunnel_Out" ]; #macro RENDER_ALL_REORDER UPDATE_RENDER_ORDER = true; UPDATE |= RENDER_TYPE.full; @@ -63,6 +64,7 @@ function __nodeInLoop(_node) { #region function ResetAllNodesRender() { #region LOG_IF(global.FLAG.render == 1, $"XXXXXXXXXXXXXXXXXXXX RESETTING ALL NODES [frame {PROJECT.animator.current_frame}] XXXXXXXXXXXXXXXXXXXX"); + var _key = ds_map_find_first(PROJECT.nodeMap); var amo = ds_map_size(PROJECT.nodeMap); @@ -77,6 +79,72 @@ function ResetAllNodesRender() { #region } } #endregion +function NodeTopoSort() { #region + var _key = ds_map_find_first(PROJECT.nodeMap); + var amo = ds_map_size(PROJECT.nodeMap); + + repeat(amo) { + var _node = PROJECT.nodeMap[? _key]; + _node.topoSorted = false; + _key = ds_map_find_next(PROJECT.nodeMap, _key); + } + + ds_list_clear(PROJECT.nodeTopo); + __sortGraph(PROJECT.nodeTopo, PROJECT.nodes); +} #endregion + +function __sortGraph(_list, _nodeList) { #region + var _root = []; + + for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ ) { + var _node = _nodeList[| i]; + var _isRoot = true; + + for( var j = 0, m = ds_list_size(_node.outputs); j < m; j++ ) { + if(!array_empty(_node.outputs[| j].getJunctionTo())) { + _isRoot = false; + break; + } + } + + if(_isRoot) array_push(_root, _node); + } + + var _st = ds_stack_create(); + + for( var i = 0, n = array_length(_root); i < n; i++ ) + ds_stack_push(_st, _root[i]); + + while(!ds_stack_empty(_st)) { + var _node = ds_stack_pop(_st); + if(_node.topoSorted) continue; + + var _isLeaf = true; + var _childs = []; + + for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ ) { + var _in = _node.inputs[| i]; + if(_in.value_from == noone) continue; + if(_in.value_from.node.topoSorted) continue; + + array_push(_childs, _in.value_from.node); + _isLeaf = false; + } + + if(_isLeaf) { + ds_list_add(_list, _node); + _node.topoSorted = true; + + if(is_instanceof(_node, Node_Collection)) + __sortGraph(_list, _node.nodes); + } else { + ds_stack_push(_st, _node); + for( var i = 0, n = array_length(_childs); i < n; i++ ) + ds_stack_push(_st, _childs[i]); + } + } +} #endregion + function Render(partial = false, runAction = false) { #region LOG_BLOCK_START(); LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {PROJECT.animator.current_frame}] =============================="); @@ -105,44 +173,34 @@ function Render(partial = false, runAction = false) { #region // get leaf node RENDER_QUEUE.clear(); - var key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); - repeat(amo) { - var _node = PROJECT.nodeMap[? key]; - key = ds_map_find_next(PROJECT.nodeMap, key); - - if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend {_node}"); continue; } - if(!is_struct(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-struct {_node}"); continue; } - if(array_exists(global.group_io, instanceof(_node))) { - LOG_IF(global.FLAG.render == 1, $"Skip group IO {_node.internalName}"); - continue; - } + for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) { + var _node = PROJECT.nodeTopo[| i]; + _node.passiveDynamic = false; + } + + for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) { + var _node = PROJECT.nodeTopo[| i]; + if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend [{_node}]"); continue; } + if(!is_instanceof(_node, Node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-node [{_node}]"); continue; } _node.render_time = 0; - if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; } - if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; } - if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; } + if(array_exists(global.group_io, instanceof(_node))) { + LOG_IF(global.FLAG.render == 1, $"Skip group IO [{_node.internalName}]"); continue; } - if(_node.rendered && !_node.isAnimated()) { - _node.anim_last_step = false; - LOG_IF(global.FLAG.render == 1, $"Skip rendered {_node.internalName}"); - continue; - } + if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive [{_node.internalName}]"); continue; } + if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive [{_node.internalName}]"); continue; } + if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update [{_node.internalName}]"); continue; } + if(__nodeInLoop(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop [{_node.internalName}]"); continue; } - if(__nodeInLoop(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop {_node.internalName}"); continue; } + if(_node.passiveDynamic) { + _node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); continue; } - LOG_BLOCK_START(); + if(_node.rendered && !_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); continue; } - var _startNode = _node.isRenderable(global.FLAG.render); - if(_startNode) { - LOG_IF(global.FLAG.render == 1, $"Found leaf {_node.internalName}"); - //if(!reset_all) _node.resetRenderForward(); - RENDER_QUEUE.enqueue(_node); - } else - LOG_IF(global.FLAG.render == 1, $"Skip non-leaf {_node.internalName}"); - - LOG_BLOCK_END(); + LOG_IF(global.FLAG.render == 1, $" Found leaf [{_node.internalName}]"); + RENDER_QUEUE.enqueue(_node); + _node.forwardPassiveDynamic(); } _leaf_time = get_timer() - t; @@ -153,6 +211,7 @@ function Render(partial = false, runAction = false) { #region while(!RENDER_QUEUE.empty()) { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] "); + rendering = RENDER_QUEUE.dequeue(); var renderable = rendering.isRenderable(); @@ -192,6 +251,14 @@ function Render(partial = false, runAction = false) { #region LOG_END(); } #endregion +function NodeListSort(_list, _nodeList) { #region + for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ ) + _nodeList[| i].topoSorted = false; + + ds_list_clear(_list); + __sortGraph(_list, _nodeList); +} #endregion + function __renderListReset(list) { #region for( var i = 0; i < ds_list_size(list); i++ ) { list[| i].setRenderStatus(false); @@ -214,18 +281,45 @@ function RenderList(list) { #region __renderListReset(list); // get leaf node - for( var i = 0; i < ds_list_size(list); i++ ) { + for( var i = 0, n = ds_list_size(list); i < n; i++ ) { + var _node = list[| i]; + _node.passiveDynamic = false; + } + + for( var i = 0, n = ds_list_size(list); i < n; i++ ) { var _node = list[| i]; - if(is_undefined(_node)) continue; - if(!is_struct(_node)) continue; + if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend {_node}"); continue; } + if(!is_instanceof(_node, Node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-node {_node}"); continue; } + _node.render_time = 0; - if(!_node.active) continue; - if(!_node.isRenderActive()) continue; - if(_node.rendered) continue; - - if(_node.isRenderable()) - ds_queue_enqueue(queue, _node); + if(array_exists(global.group_io, instanceof(_node))) { + LOG_IF(global.FLAG.render == 1, $"Skip group IO {_node.internalName}"); + continue; + } + + if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; } + if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; } + if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; } + + if(__nodeInLoop(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop {_node.internalName}"); continue; } + + if(_node.passiveDynamic) { + _node.forwardPassiveDynamic(); + LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic {_node.internalName}"); + continue; + } + + if(_node.rendered && !_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static {_node.internalName}"); continue; } + //if() { LOG_IF(global.FLAG.render == 1, $"Skip static {_node.internalName}"); continue; } + + LOG_BLOCK_START(); + + LOG_IF(global.FLAG.render == 1, $"Found leaf {_node.internalName}"); + ds_queue_enqueue(queue, _node); + _node.forwardPassiveDynamic(); + + LOG_BLOCK_END(); } LOG_IF(global.FLAG.render == 1, "Get leaf complete: found " + string(ds_queue_size(queue)) + " leaves."); @@ -234,8 +328,7 @@ function RenderList(list) { #region // render forward while(!ds_queue_empty(queue)) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE}"); - rendering = RENDER_QUEUE.dequeue(); + rendering = ds_queue_dequeue(queue) if(!ds_list_exist(list, rendering)) continue; var renderable = rendering.isRenderable(); @@ -246,13 +339,11 @@ function RenderList(list) { #region var nextNodes = rendering.getNextNodes(); for( var i = 0, n = array_length(nextNodes); i < n; i++ ) - RENDER_QUEUE.enqueue(nextNodes[i]); + ds_queue_enqueue(queue, nextNodes[i]); if(runAction && rendering.hasInspector1Update()) rendering.inspector1Update(); - } else if(rendering.isRenderActive()) { - RENDER_QUEUE.enqueue(rendering); - } + } LOG_BLOCK_END(); }