Fluid sim output group.

This commit is contained in:
MakhamDev 2023-10-07 21:23:40 +07:00
parent 08bc0fc19f
commit 51d8abb01f
62 changed files with 550 additions and 322 deletions

View file

@ -190,6 +190,7 @@
{"name":"color","order":53,"path":"folders/shader/filter/color.yy",}, {"name":"color","order":53,"path":"folders/shader/filter/color.yy",},
{"name":"shadow caster","order":46,"path":"folders/shader/filter/shadow caster.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":"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":"generator","order":1,"path":"folders/shader/generator.yy",},
{"name":"blinker","order":30,"path":"folders/shader/generator/blinker.yy",}, {"name":"blinker","order":30,"path":"folders/shader/generator/blinker.yy",},
{"name":"cell","order":31,"path":"folders/shader/generator/cell.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":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
{"name":"widgets","order":5,"path":"folders/widgets.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"fluid","order":20,"path":"folders/shader/fluid.yy",},
], ],
"ResourceOrderSettings": [ "ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, {"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":"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":"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":"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":"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":"sh_greyscale","order":13,"path":"shaders/sh_greyscale/sh_greyscale.yy",},
{"name":"gameframe_native","order":2,"path":"extensions/gameframe_native/gameframe_native.yy",}, {"name":"gameframe_native","order":2,"path":"extensions/gameframe_native/gameframe_native.yy",},

View file

@ -221,6 +221,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"color","folderPath":"folders/shader/filter/color.yy",}, {"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":"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":"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":"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":"blinker","folderPath":"folders/shader/generator/blinker.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"cell","folderPath":"folders/shader/generator/cell.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":"biterator","folderPath":"folders/VCT/biterator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.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":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluid","folderPath":"folders/shader/fluid.yy",},
], ],
"IncludedFiles": [ "IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, {"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":"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":"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":"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":"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":"sh_greyscale","path":"shaders/sh_greyscale/sh_greyscale.yy",},},
{"id":{"name":"gameframe_native","path":"extensions/gameframe_native/gameframe_native.yy",},}, {"id":{"name":"gameframe_native","path":"extensions/gameframe_native/gameframe_native.yy",},},

View file

@ -79,9 +79,7 @@
gameframe_set_fullscreen(2); gameframe_set_fullscreen(2);
}); });
addHotkey("", "Render all", vk_f5, MOD_KEY.none, function() { addHotkey("", "Render all", vk_f5, MOD_KEY.none, function() { RENDER_ALL_REORDER });
RENDER_ALL_REORDER
});
addHotkey("", "Close file", "Q", MOD_KEY.ctrl, function() { PANEL_GRAPH.close(); }); addHotkey("", "Close file", "Q", MOD_KEY.ctrl, function() { PANEL_GRAPH.close(); });
addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close); addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close);

View file

@ -80,7 +80,10 @@ _HOVERING_ELEMENT = noone;
//physics_pause_enable(true); //physics_pause_enable(true);
DEF_SURFACE_RESET(); DEF_SURFACE_RESET();
if(UPDATE_RENDER_ORDER) ResetAllNodesRender(); if(UPDATE_RENDER_ORDER) {
ResetAllNodesRender();
NodeTopoSort();
}
UPDATE_RENDER_ORDER = false; UPDATE_RENDER_ORDER = false;
if(PROJECT.active) { if(PROJECT.active) {

View file

@ -506,7 +506,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
} }
} }
static postConnect = function() { static postLoad = function() {
generateMesh(); generateMesh();
} }
} }

View file

@ -119,7 +119,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) {
try { try {
for(var i = 0; i < ds_list_size(appended_list); i++) for(var i = 0; i < ds_list_size(appended_list); i++)
appended_list[| i].postConnect(); appended_list[| i].postLoad();
} catch(e) { } catch(e) {
log_warning("APPEND, connect", exception_print(e)); log_warning("APPEND, connect", exception_print(e));
} }

View file

@ -29,6 +29,7 @@
nodes = ds_list_create(); nodes = ds_list_create();
nodeMap = ds_map_create(); nodeMap = ds_map_create();
nodeNameMap = ds_map_create(); nodeNameMap = ds_map_create();
nodeTopo = ds_list_create();
animator = new AnimationManager(); animator = new AnimationManager();

View file

@ -193,18 +193,20 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
create_list[| i].preConnect(); create_list[| i].preConnect();
for(var i = 0; i < ds_list_size(create_list); i++) for(var i = 0; i < ds_list_size(create_list); i++)
create_list[| i].connect(); create_list[| i].connect();
for(var i = 0; i < ds_list_size(create_list); i++)
create_list[| i].postConnect();
} catch(e) { } catch(e) {
log_warning("LOAD, connect", exception_print(e)); log_warning("LOAD, connect", exception_print(e));
} }
try { //try {
for(var i = 0; i < ds_list_size(create_list); i++) // for(var i = 0; i < ds_list_size(create_list); i++)
create_list[| i].doUpdate(); // create_list[| i].doUpdate();
} catch(e) { //} catch(e) {
log_warning("LOAD, update", exception_print(e)); // log_warning("LOAD, update", exception_print(e));
} //}
Render(); //Render();
if(!ds_queue_empty(CONNECTION_CONFLICT)) { if(!ds_queue_empty(CONNECTION_CONFLICT)) {
var pass = 0; var pass = 0;
@ -227,7 +229,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
try { try {
for(var i = 0; i < ds_list_size(create_list); i++) for(var i = 0; i < ds_list_size(create_list); i++)
create_list[| i].postConnect(); create_list[| i].postLoad();
} catch(e) { } catch(e) {
log_warning("LOAD, connect", exception_print(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)); log_warning("LOAD, connect", exception_print(e));
} }
Render(, true); RENDER_ALL_REORDER
LOADING = false; LOADING = false;
PROJECT.modified = false; PROJECT.modified = false;

View file

@ -149,7 +149,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
static update = function(frame = PROJECT.animator.current_frame) { static update = function(frame = PROJECT.animator.current_frame) {
var _typ = getType(); var _typ = getType();
outputs[| 0].type = _typ; outputs[| 0].setType(_typ);
var res = []; var res = [];
var ind = 0; var ind = 0;
var spd = getInputData(1); var spd = getInputData(1);
@ -162,10 +162,10 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
else else
array_push(res, val); 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) 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); 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; if(_typ == VALUE_TYPE.any) return;
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
inputs[| i].type = _typ; inputs[| i].setType(_typ);
inputs[| i].resetDisplay(); inputs[| i].resetDisplay();
} }
} }

View file

@ -55,8 +55,8 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _arr = getInputData(0); var _arr = getInputData(0);
if(inputs[| 0].value_from == noone) { if(inputs[| 0].value_from == noone) {
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
return; 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 _type = inputs[| 0].value_from.type;
var spd = getInputData(1); var spd = getInputData(1);
inputs[| 0].type = _type; inputs[| 0].setType(_type);
outputs[| 0].type = _type; outputs[| 0].setType(_type);
var _out = array_clone(_arr); var _out = array_clone(_arr);
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _val = getInputData(i); var _val = getInputData(i);
inputs[| i].type = _type; inputs[| i].setType(_type);
if(is_array(_val) && spd) if(is_array(_val) && spd)
array_append(_out, _val); array_append(_out, _val);

View file

@ -21,8 +21,8 @@ function Node_Array_Copy(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var _typ = VALUE_TYPE.any; var _typ = VALUE_TYPE.any;
if(inputs[| 0].value_from != noone) _typ = inputs[| 0].value_from.type; if(inputs[| 0].value_from != noone) _typ = inputs[| 0].value_from.type;
inputs[| 0].type = _typ; inputs[| 0].setType(_typ);
outputs[| 0].type = _typ; outputs[| 0].setType(_typ);
} }
static update = function(frame = PROJECT.animator.current_frame) { static update = function(frame = PROJECT.animator.current_frame) {

View file

@ -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) { static update = function(frame = PROJECT.animator.current_frame) {
var _arr = getInputData(0); var _arr = getInputData(0);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
inputs[| 1].type = VALUE_TYPE.any; inputs[| 1].setType(VALUE_TYPE.any);
if(!is_array(_arr)) return; 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) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
inputs[| 1].type = type; inputs[| 1].setType(type);
} }
outputs[| 0].setValue(array_find(_arr, value)); outputs[| 0].setValue(array_find(_arr, value));

View file

@ -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); outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
static step = function() { static step = function() {
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
inputs[| 0].type = inputs[| 0].value_from.type; inputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].type = inputs[| 0].type; outputs[| 0].setType(inputs[| 0].type);
} }
} }

View file

@ -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) { static update = function(frame = PROJECT.animator.current_frame) {
var _arr = getInputData(0); var _arr = getInputData(0);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
inputs[| 2].type = VALUE_TYPE.any; inputs[| 2].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(_arr)) return; 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) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
inputs[| 2].type = type; inputs[| 2].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
var arr = array_clone(_arr); var arr = array_clone(_arr);

View file

@ -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) { static update = function(frame = PROJECT.animator.current_frame) {
var _arr = getInputData(0); 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) { if(!is_array(_arr) || array_length(_arr) == 0) {
outputs[| 0].setValue(0); outputs[| 0].setValue(0);

View file

@ -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[| 2].setVisible(type == 0, type == 0);
inputs[| 3].setVisible(type == 1, type == 1); inputs[| 3].setVisible(type == 1, type == 1);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
inputs[| 3].type = VALUE_TYPE.any; inputs[| 3].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
inputs[| 3].type = type; inputs[| 3].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
} }

View file

@ -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) { static update = function(frame = PROJECT.animator.current_frame) {
var _arr = getInputData(0); var _arr = getInputData(0);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(_arr)) return; if(!is_array(_arr)) return;
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
_arr = array_reverse(_arr); _arr = array_reverse(_arr);

View file

@ -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) { static update = function(frame = PROJECT.animator.current_frame) {
var _arr = getInputData(0); var _arr = getInputData(0);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
inputs[| 2].type = VALUE_TYPE.any; inputs[| 2].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(_arr)) return; 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) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
inputs[| 2].type = type; inputs[| 2].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
var arr = array_clone(_arr); var arr = array_clone(_arr);

View file

@ -17,15 +17,15 @@ function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var _arr = getInputData(0); var _arr = getInputData(0);
var _shf = getInputData(1); var _shf = getInputData(1);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(_arr)) return; if(!is_array(_arr)) return;
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
var type = inputs[| 0].value_from.type; var type = inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
var arr = []; var arr = [];

View file

@ -16,15 +16,15 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const
var arr = getInputData(0); var arr = getInputData(0);
var sed = getInputData(1); var sed = getInputData(1);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(arr)) return; if(!is_array(arr)) return;
arr = array_clone(arr); arr = array_clone(arr);
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
inputs[| 0].type = inputs[| 0].value_from.type; inputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].type = inputs[| 0].value_from.type; outputs[| 0].setType(inputs[| 0].value_from.type);
} }
random_set_seed(sed); random_set_seed(sed);

View file

@ -22,14 +22,14 @@ function Node_Array_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var arr = getInputData(0); var arr = getInputData(0);
var asc = getInputData(1); var asc = getInputData(1);
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
if(!is_array(arr)) return; if(!is_array(arr)) return;
if(inputs[| 0].value_from != noone) { if(inputs[| 0].value_from != noone) {
inputs[| 0].type = inputs[| 0].value_from.type; inputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].type = inputs[| 0].value_from.type; outputs[| 0].setType(inputs[| 0].value_from.type);
} }
var _arr = []; var _arr = [];

View file

@ -52,21 +52,21 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _arr = getInputData(0); var _arr = getInputData(0);
if(inputs[| 0].value_from == noone) { if(inputs[| 0].value_from == noone) {
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
return; return;
} }
if(!is_array(_arr)) return; if(!is_array(_arr)) return;
var _type = inputs[| 0].value_from.type; var _type = inputs[| 0].value_from.type;
inputs[| 0].type = _type; inputs[| 0].setType(_type);
outputs[| 0].type = _type; outputs[| 0].setType(_type);
var len = 1; var len = 1;
var val = []; var val = [];
for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) { for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) {
val[i] = getInputData(i); 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])) { if(!is_array(val[i])) {
val[i] = [ val[i] ]; val[i] = [ val[i] ];
continue; continue;

View file

@ -37,22 +37,22 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _nor = getInputData(3); var _nor = getInputData(3);
if(_nor) { if(_nor) {
inputs[| 0].type = VALUE_TYPE.integer; inputs[| 0].setType(VALUE_TYPE.float);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider); 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[| 1].setDisplay(VALUE_DISPLAY.slider);
inputs[| 2].type = VALUE_TYPE.integer; inputs[| 2].setType(VALUE_TYPE.float);
inputs[| 2].setDisplay(VALUE_DISPLAY.slider); inputs[| 2].setDisplay(VALUE_DISPLAY.slider);
} else { } else {
inputs[| 0].type = VALUE_TYPE.integer; inputs[| 0].setType(VALUE_TYPE.integer);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 360, 1] }); 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[| 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] }); inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
} }
} }

View file

@ -27,22 +27,22 @@ function Node_Color_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _nor = getInputData(3); var _nor = getInputData(3);
if(_nor) { if(_nor) {
inputs[| 0].type = VALUE_TYPE.float; inputs[| 0].setType(VALUE_TYPE.float);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider); 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[| 1].setDisplay(VALUE_DISPLAY.slider);
inputs[| 2].type = VALUE_TYPE.float; inputs[| 2].setType(VALUE_TYPE.float);
inputs[| 2].setDisplay(VALUE_DISPLAY.slider); inputs[| 2].setDisplay(VALUE_DISPLAY.slider);
} else { } else {
inputs[| 0].type = VALUE_TYPE.integer; inputs[| 0].setType(VALUE_TYPE.integer);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] }); 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[| 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] }); inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
} }
} }

View file

@ -64,8 +64,8 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _txt1 = getInputData(7); var _txt1 = getInputData(7);
var _txt2 = getInputData(8); var _txt2 = getInputData(8);
inputs[| 3].type = inputs[| 3].value_from == noone? VALUE_TYPE.any : inputs[| 3].value_from.type; inputs[| 3].setType(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[| 4].setType(inputs[| 4].value_from == noone? VALUE_TYPE.any : inputs[| 4].value_from.type);
var res = false; var res = false;
@ -86,11 +86,11 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(res) { if(res) {
outputs[| 0].setValue(_true); outputs[| 0].setValue(_true);
outputs[| 0].type = inputs[| 3].type; outputs[| 0].setType(inputs[| 3].type);
outputs[| 0].display_type = inputs[| 3].display_type; outputs[| 0].display_type = inputs[| 3].display_type;
} else { } else {
outputs[| 0].setValue(_fals); outputs[| 0].setValue(_fals);
outputs[| 0].type = inputs[| 4].type; outputs[| 0].setType(inputs[| 4].type);
outputs[| 0].display_type = inputs[| 4].display_type; outputs[| 0].display_type = inputs[| 4].display_type;
} }

View file

@ -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); content = file_text_read_all_lines(path);
var convert = getInputData(1); 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) { if(convert) {
for( var i = 0, n = array_length(content); i < n; i++ ) { for( var i = 0, n = array_length(content); i < n; i++ ) {
var c = content[i]; var c = content[i];

View file

@ -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); 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); inspectInput2 = nodeValue("Toggle execution", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true);
inspectInput1.index = -1;
inspectInput2.index = -1;
autoUpdatedTrigger = true; autoUpdatedTrigger = true;
updatedInTrigger = nodeValue("Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false).setVisible(true, 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); 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; updatedInTrigger.tags = VALUE_TAG.updateInTrigger;
updatedOutTrigger.tags = VALUE_TAG.updateOutTrigger; updatedOutTrigger.tags = VALUE_TAG.updateOutTrigger;
@ -123,8 +129,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
inputs_data = []; inputs_data = [];
input_hash = ""; input_hash = "";
input_hash_raw = ""; input_hash_raw = "";
anim_last_step = false;
#endregion #endregion
#region --- attributes ---- #region --- attributes ----
@ -168,6 +172,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
render_cached = false; render_cached = false;
auto_render_time = true; auto_render_time = true;
updated = false; updated = false;
passiveDynamic = false;
topoSorted = false;
use_cache = CACHE_USE.none; use_cache = CACHE_USE.none;
cached_manual = false; cached_manual = false;
@ -327,11 +333,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
targ.setFrom(junctionFrom); targ.setFrom(junctionFrom);
} #endregion } #endregion
static isAnimated = function() { #region static isActiveDynamic = function() { #region
//if(passiveDynamic) return false;
if(update_on_frame) return true; if(update_on_frame) return true;
for(var i = 0; i < ds_list_size(inputs); i++) for(var i = 0; i < ds_list_size(inputs); i++)
if(inputs[| i].isAnimated()) return true; if(inputs[| i].isActiveDynamic()) return true;
return false; return false;
} #endregion } #endregion
@ -453,18 +460,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
} else { } else {
render_cached = false; render_cached = false;
var sBase = surface_get_target(); var sBase = surface_get_target();
//var _hash = input_hash;
getInputs(); getInputs();
//input_hash = md5_string_unicode(input_hash_raw);
anim_last_step = isAnimated() || /*_hash != input_hash || */!rendered;
LOG_BLOCK_START(); 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); if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
try { 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) { } catch(exception) {
var sCurr = surface_get_target(); var sCurr = surface_get_target();
while(surface_get_target() != sBase) while(surface_get_target() != sBase)
@ -532,18 +536,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
LOG_BLOCK_END(); LOG_BLOCK_END();
} #endregion } #endregion
static resetRenderForward = function() { #region static forwardPassiveDynamic = function() { #region
setRenderStatus(false);
for( var i = 0, n = ds_list_size(outputs); i < n; i++ ) { for( var i = 0, n = ds_list_size(outputs); i < n; i++ ) {
var _outp = outputs[| i]; var _outp = outputs[| i];
for(var j = 0; j < ds_list_size(_outp.value_to); j++) { for(var j = 0; j < ds_list_size(_outp.value_to); j++) {
var _to = _outp.value_to[| j]; var _to = _outp.value_to[| j];
if(!_to.node.active || _to.value_from == noone) continue; if(!_to.node.active || _to.value_from != _outp) continue;
if(_to.value_from != self) continue;
if(!_to.node.rendered) continue;
_to.node.resetRenderForward(); _to.node.passiveDynamic = true;
} }
} }
} #endregion } #endregion
@ -565,7 +566,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if( val_from == noone) continue; if( val_from == noone) continue;
if(!val_from.node.active) continue; if(!val_from.node.active) continue;
if(!val_from.node.isRenderActive()) 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})"); 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; return false;
} }
@ -1022,7 +1023,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
draw_set_color(COLORS.speed[0]); 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); 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 drawAnimationTimeline = function(_w, _h, _s) {}
static getAnimationCacheExist = function(frame) { return cacheExist(frame); }
static enable = function() { active = true; } static enable = function() { active = true; }
static disable = function() { active = false; } static disable = function() { active = false; }
@ -1665,6 +1668,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
static preConnect = function() {} static preConnect = function() {}
static postConnect = function() {} static postConnect = function() {}
static postLoad = function() {}
static resetAnimation = function() {} static resetAnimation = function() {}
static cleanUp = function() { #region static cleanUp = function() { #region

View file

@ -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
}

View file

@ -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",
},
}

View file

@ -8,6 +8,8 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
ungroupable = false; ungroupable = false;
update_on_frame = true; update_on_frame = true;
outputNode = noone;
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF) inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector); .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) { if(!LOADING && !APPENDING && !CLONING) {
//var _domain = nodeBuild("Node_Fluid_Domain", -384, -32, self); //var _domain = nodeBuild("Node_Fluid_Domain", -384, -32, self);
var _render = nodeBuild("Node_Fluid_Render", 128, -32, self); var _render = nodeBuild("Node_Fluid_Render_Output", 128, -32, self);
var _output = nodeBuild("Node_Group_Output", 384, -32, self);
_output.inputs[| 0].setFrom(_render.outputs[| 0]); //_output.inputs[| 0].setFrom(_render.outputs[| 0]);
//_render.inputs[| 0].setFrom(_domain.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); fd_rectangle_set_repeat(domain, wrap);
} }
static getAnimationCacheExist = function(frame) {
if(outputNode == noone) return false;
return outputNode.cacheExist(frame);
}
PATCH_STATIC PATCH_STATIC
} }

View file

@ -62,7 +62,7 @@ function variable_editor(nodeVal) constructor {
slider_step = 0.01; slider_step = 0.01;
static refreshInput = function() { static refreshInput = function() {
value.type = val_type[type_index]; value.setType(val_type[type_index]);
value.name = value_name; value.name = value_name;
if(_type_index != type_index || _disp_index != disp_index) { if(_type_index != type_index || _disp_index != disp_index) {

View file

@ -129,7 +129,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
if(ind == inputs[| 2].getValue()) return; if(ind == inputs[| 2].getValue()) return;
outputs[| 0].type = juncTo.type; outputs[| 0].setType(juncTo.type);
inputs[| 2].setValue(ind); 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); _dtype = array_safe_get(array_safe_get(display_list, _val_type, []), _dtype);
inParent.type = _val_type; inParent.setType(_val_type);
outputs[| 0].type = _val_type; outputs[| 0].setType(_val_type);
var _val = inParent.getValue(); var _val = inParent.getValue();
switch(_dtype) { switch(_dtype) {
@ -235,8 +235,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
break; break;
case "Gradient": case "Gradient":
inParent.type = VALUE_TYPE.gradient; inParent.setType(VALUE_TYPE.gradient);
outputs[| 0].type = inParent.type; outputs[| 0].setType(inParent.type);
inParent.animator = new valueAnimator(new gradientObject(c_white), inParent); inParent.animator = new valueAnimator(new gradientObject(c_white), inParent);
inParent.setDisplay(VALUE_DISPLAY._default); inParent.setDisplay(VALUE_DISPLAY._default);

View file

@ -21,10 +21,6 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
.uncache() .uncache()
.setVisible(true, true); .setVisible(true, true);
inputs[| 1] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.uncache()
.rejectArray();
attributes.inherit_name = !LOADING && !APPENDING; attributes.inherit_name = !LOADING && !APPENDING;
outParent = undefined; outParent = undefined;
output_index = -1; output_index = -1;
@ -98,23 +94,20 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
group.sortIO(); group.sortIO();
outParent.setFrom(inputs[| 0]); outParent.setFrom(inputs[| 0]);
} } if(!LOADING && !APPENDING) createOutput();
if(!LOADING && !APPENDING)
createOutput();
static step = function() { static step = function() {
if(is_undefined(outParent)) return; if(is_undefined(outParent)) return;
outParent.name = display_name; outParent.name = display_name;
inputs[| 0].type = VALUE_TYPE.any; inputs[| 0].setType(VALUE_TYPE.any);
if(inputs[| 0].value_from != noone) { 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; 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; outParent.display_type = inputs[| 0].display_type;
onSetDisplayName = _onSetDisplayName; 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() { static postDeserialize = function() {
createOutput(false); createOutput(false);
var _inputs = load_map.inputs;
inputs[| 1].applyDeserialize(_inputs[1], load_scale);
if(PROJECT.version < 11520) attributes.input_priority = getInputData(1); if(PROJECT.version < 11520) attributes.input_priority = getInputData(1);
group.sortIO(); group.sortIO();
} }

View file

@ -100,50 +100,50 @@ output.color = surfaceColor;")
switch(type) { switch(type) {
case 1 : case 1 :
if(is_array(cur_valu)) inp_valu.overrideValue(0); 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); inp_valu.setDisplay(VALUE_DISPLAY._default);
break; break;
case 0 : case 0 :
if(is_array(cur_valu)) inp_valu.overrideValue(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); inp_valu.setDisplay(VALUE_DISPLAY._default);
break; break;
case 2 : case 2 :
if(!is_array(cur_valu) || array_length(cur_valu) != 2) if(!is_array(cur_valu) || array_length(cur_valu) != 2)
inp_valu.overrideValue([ 0, 0 ]); inp_valu.overrideValue([ 0, 0 ]);
inp_valu.type = VALUE_TYPE.float; inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.vector); inp_valu.setDisplay(VALUE_DISPLAY.vector);
break; break;
case 3 : case 3 :
if(!is_array(cur_valu) || array_length(cur_valu) != 3) if(!is_array(cur_valu) || array_length(cur_valu) != 3)
inp_valu.overrideValue([ 0, 0, 0 ]); inp_valu.overrideValue([ 0, 0, 0 ]);
inp_valu.type = VALUE_TYPE.float; inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.vector); inp_valu.setDisplay(VALUE_DISPLAY.vector);
break; break;
case 4 : case 4 :
if(!is_array(cur_valu) || array_length(cur_valu) != 4) if(!is_array(cur_valu) || array_length(cur_valu) != 4)
inp_valu.overrideValue([ 0, 0, 0, 0 ]); 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); inp_valu.setDisplay(VALUE_DISPLAY.vector);
break; break;
case 5 : case 5 :
if(!is_array(cur_valu) || array_length(cur_valu) != 9) if(!is_array(cur_valu) || array_length(cur_valu) != 9)
inp_valu.overrideValue(array_create(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 }); inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 3 });
break; break;
case 6 : case 6 :
if(!is_array(cur_valu) || array_length(cur_valu) != 16) if(!is_array(cur_valu) || array_length(cur_valu) != 16)
inp_valu.overrideValue(array_create(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 }); inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 4 });
break; break;
case 7 : case 7 :
inp_valu.type = VALUE_TYPE.surface; inp_valu.setType(VALUE_TYPE.surface);
inp_valu.setDisplay(VALUE_DISPLAY._default); inp_valu.setDisplay(VALUE_DISPLAY._default);
break; break;
case 8 : case 8 :
inp_valu.type = VALUE_TYPE.color; inp_valu.setType(VALUE_TYPE.color);
inp_valu.setDisplay(VALUE_DISPLAY._default); inp_valu.setDisplay(VALUE_DISPLAY._default);
break; break;
} }
@ -365,7 +365,7 @@ struct PixelShaderOutput {
return _output; return _output;
} #endregion } #endregion
static postConnect = function() { static postLoad = function() {
refreshShader(); refreshShader();
refreshDynamicInput(); refreshDynamicInput();
} }

View file

@ -26,7 +26,7 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou
static onStep = function() { static onStep = function() {
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; 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() { static doInitLoop = function() {

View file

@ -28,7 +28,7 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr
static onStep = function() { static onStep = function() {
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; 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() { static doInitLoop = function() {

View file

@ -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 ); outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone );
topoList = ds_list_create();
custom_input_index = ds_list_size(inputs); custom_input_index = ds_list_size(inputs);
custom_output_index = ds_list_size(inputs); custom_output_index = ds_list_size(inputs);
loop_start_time = 0; loop_start_time = 0;
@ -36,10 +38,12 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
static onStep = function() { static onStep = function() {
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; 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) { static update = function(frame = PROJECT.animator.current_frame) {
if(frame == 0) NodeListSort(topoList, nodes);
initLoop(); initLoop();
} }
@ -79,7 +83,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
inputNodes[0].setValue(val1); inputNodes[0].setValue(val1);
inputNodes[1].setValue(val2); inputNodes[1].setValue(val2);
RenderList(nodes); RenderList(topoList);
var res = outputNode.getValue(); var res = outputNode.getValue();
//print("Comparing " + string(val1) + ", " + string(val2) + ": " + string(res)); //print("Comparing " + string(val1) + ", " + string(val2) + ": " + string(res));
return res; return res;
@ -87,8 +91,8 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
static initLoop = function() { static initLoop = function() {
if(inputs[| 0].value_from) { if(inputs[| 0].value_from) {
inputs[| 0].type = inputs[| 0].value_from.type; inputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].type = inputs[| 0].value_from.type; outputs[| 0].setType(inputs[| 0].value_from.type);
} }
resetRender(); 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++ ) { for( var i = 0; i < ds_list_size(nodes); i++ ) {
if(nodes[| i].display_name == "Value 1") { if(nodes[| i].display_name == "Value 1") {
inputNodes[0] = nodes[| i].inputs[| 0]; inputNodes[0] = nodes[| i].inputs[| 0];
inputNodes[0].type = inputs[| 0].type; inputNodes[0].setType(inputs[| 0].type);
inputReady++; inputReady++;
} else if(nodes[| i].display_name == "Value 2") { } else if(nodes[| i].display_name == "Value 2") {
inputNodes[1] = nodes[| i].inputs[| 0]; inputNodes[1] = nodes[| i].inputs[| 0];
inputNodes[1].type = inputs[| 0].type; inputNodes[1].setType(inputs[| 0].type);
inputReady++; inputReady++;
} else if(nodes[| i].name == "Swap result") { } else if(nodes[| i].name == "Swap result") {
outputNode = nodes[| i].inputs[| 0]; outputNode = nodes[| i].inputs[| 0];

View file

@ -19,7 +19,7 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
static step = function() { static step = function() {
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
outputs[| 0].type = group.inputs[| 0].type; outputs[| 0].setType(group.inputs[| 0].type);
} }
} }

View file

@ -19,9 +19,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
group.outputs[| 0].type = type; group.outputs[| 0].setType(type);
outputs[| 0].type = type; outputs[| 0].setType(type);
} }
static cloneValue = function(_prev_val, _val) { static cloneValue = function(_prev_val, _val) {

View file

@ -19,7 +19,7 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
static step = function() { static step = function() {
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
outputs[| 0].type = group.inputs[| 0].type; outputs[| 0].setType(group.inputs[| 0].type);
} }
} }

View file

@ -19,8 +19,8 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].type = type; inputs[| 0].setType(type);
group.outputs[| 0].type = type; group.outputs[| 0].setType(type);
} }
static update = function(frame = PROJECT.animator.current_frame) { static update = function(frame = PROJECT.animator.current_frame) {

View file

@ -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 ); outputs[| 0] = nodeValue("Value in", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 );
static update = function() { static update = function() {
outputs[| 0].type = inputs[| 0].type; outputs[| 0].setType(inputs[| 0].type);
var val = getInputData(0); var val = getInputData(0);
outputs[| 0].setValue(val); outputs[| 0].setValue(val);

View file

@ -159,18 +159,18 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
if(!variable_struct_exists(_str, k)) { if(!variable_struct_exists(_str, k)) {
out.setValue(0); out.setValue(0);
out.type = VALUE_TYPE.float; out.setType(VALUE_TYPE.float);
break; break;
} }
var val = variable_struct_get(_str, k); var val = variable_struct_get(_str, k);
if(j == array_length(keys) - 1) { if(j == array_length(keys) - 1) {
if(is_struct(val)) if(is_struct(val))
out.type = VALUE_TYPE.struct; out.setType(VALUE_TYPE.struct);
else if(is_array(val) && array_length(val)) 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 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); out.setValue(val);
} }

View file

@ -91,7 +91,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
var _key = getInputData(i + 0); var _key = getInputData(i + 0);
var _val = getInputData(i + 1); 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); 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) { for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1]; var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type; var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
inp.type = typ; inp.setType(typ);
} }
} }

View file

@ -73,9 +73,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var _type = getInputData(1); var _type = getInputData(1);
switch(_type) { switch(_type) {
case 0 : outputs[| 1].type = VALUE_TYPE.float; break; case 0 : outputs[| 1].setType(VALUE_TYPE.float); break;
case 1 : outputs[| 1].type = VALUE_TYPE.text; break; case 1 : outputs[| 1].setType(VALUE_TYPE.text); break;
case 2 : outputs[| 1].type = VALUE_TYPE.struct; 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); var type = getInputData(i + 1);
switch(type) { switch(type) {
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break;
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break;
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break;
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break;
} }
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); 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; inputs[| i + 2].name = name;
switch(type) { switch(type) {
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break;
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break;
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break;
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break;
} }
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);

View file

@ -99,10 +99,10 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var type = getInputData(i + 1); var type = getInputData(i + 1);
switch(type) { switch(type) {
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break;
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break;
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break;
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break;
} }
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); 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; inputs[| i + 2].name = name;
switch(type) { switch(type) {
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; case 0 : inputs[| i + 2].setType(VALUE_TYPE.float); break;
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; case 1 : inputs[| i + 2].setType(VALUE_TYPE.text); break;
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; case 2 : inputs[| i + 2].setType(VALUE_TYPE.surface); break;
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break; case 3 : inputs[| i + 2].setType(VALUE_TYPE.struct); break;
} }
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);

View file

@ -129,13 +129,13 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
inputs[| 4].setVisible(true); inputs[| 4].setVisible(true);
var int = getInputData(4); var int = getInputData(4);
if(int) outputs[| 0].type = VALUE_TYPE.integer; if(int) outputs[| 0].setType(VALUE_TYPE.integer);
else outputs[| 0].type = VALUE_TYPE.float; else outputs[| 0].setType(VALUE_TYPE.float);
break; break;
default: default:
inputs[| 4].setVisible(false); inputs[| 4].setVisible(false);
outputs[| 0].type = VALUE_TYPE.float; outputs[| 0].setType(VALUE_TYPE.float);
break; break;
} }

View file

@ -67,11 +67,11 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
} }
for( var i = 0; i < 1; i++ ) { 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; 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) { 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(); var disp = inputs[| 3].getValueCached();
for( var i = 0; i < 2; i++ ) { 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[| i].editWidget.slide_speed = int? 1 : 0.1;
} }
inputs[| 4].setVisible(disp == 1, disp == 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; w = 96;
min_h = 80; min_h = 80;
@ -414,11 +414,11 @@ function Node_Vector3(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
static step = function() { static step = function() {
var int = inputs[| 3].getValueCached(); var int = inputs[| 3].getValueCached();
for( var i = 0; i < 3; i++ ) { 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; 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) { 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() { static step = function() {
var int = inputs[| 4].getValueCached(); var int = inputs[| 4].getValueCached();
for( var i = 0; i < 4; i++ ) { 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; 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) { 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) if(inputs[| 0].value_from.type == VALUE_TYPE.integer)
type = VALUE_TYPE.integer; type = VALUE_TYPE.integer;
inputs[| 0].type = type; inputs[| 0].setType(type);
for( var i = 0; i < 4; i++ ) 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) { static processData = function(_output, _data, _output_index, _array_index = 0) {

View file

@ -44,14 +44,14 @@ function Node_PB_Draw_Round_Rectangle(_x, _y, _group = noone) : Node_PB_Draw(_x,
inputs[| 5].setVisible(_type == 1); inputs[| 5].setVisible(_type == 1);
if(_rela) { if(_rela) {
inputs[| 4].type = VALUE_TYPE.float; inputs[| 4].setType(VALUE_TYPE.float);
inputs[| 5].type = VALUE_TYPE.float; inputs[| 5].setType(VALUE_TYPE.float);
inputs[| 4].editWidget.slide_speed = 0.01; inputs[| 4].editWidget.slide_speed = 0.01;
inputs[| 5].editWidget.setSlideSpeed(0.01); inputs[| 5].editWidget.setSlideSpeed(0.01);
} else { } else {
inputs[| 4].type = VALUE_TYPE.integer; inputs[| 4].setType(VALUE_TYPE.integer);
inputs[| 5].type = VALUE_TYPE.integer; inputs[| 5].setType(VALUE_TYPE.integer);
inputs[| 4].editWidget.slide_speed = 1; inputs[| 4].editWidget.slide_speed = 1;
inputs[| 5].editWidget.setSlideSpeed(1); inputs[| 5].editWidget.setSlideSpeed(1);

View file

@ -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); outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
static update = function(frame = PROJECT.animator.current_frame) { static update = function(frame = PROJECT.animator.current_frame) {
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);
outputs[| 0].type = inputs[| 0].type; outputs[| 0].setType(inputs[| 0].type);
outputs[| 0].value_from = inputs[| 0].value_from; outputs[| 0].value_from = inputs[| 0].value_from;
} }

View file

@ -202,8 +202,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
var fluidSim = ds_list_create(); #region var fluidSim = ds_list_create(); #region
addNodeCatagory("FluidSim", fluidSim, ["Node_Fluid_Group"]); addNodeCatagory("FluidSim", fluidSim, ["Node_Fluid_Group"]);
ds_list_add(fluidSim, "Group"); ds_list_add(fluidSim, "Group");
addNodeObject(fluidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); 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, "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"); ds_list_add(fluidSim, "Domain");
addNodeObject(fluidSim, "Fluid Domain", s_node_fluidSim_domain, "Node_Fluid_Domain", [1, Node_Fluid_Domain]).setVersion(1120); addNodeObject(fluidSim, "Fluid Domain", s_node_fluidSim_domain, "Node_Fluid_Domain", [1, Node_Fluid_Domain]).setVersion(1120);

View file

@ -28,8 +28,8 @@ function Node_String_Trim(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
static step = function() { static step = function() {
var mode = getInputData(4); var mode = getInputData(4);
inputs[| 1].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer; inputs[| 1].setType(mode? VALUE_TYPE.float : VALUE_TYPE.integer);
inputs[| 2].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer; inputs[| 2].setType(mode? VALUE_TYPE.float : VALUE_TYPE.integer);
} }
static processData = function(_output, _data, _index = 0) { static processData = function(_output, _data, _index = 0) {

View file

@ -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) { for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1]; var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type; var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
inp.type = typ; inp.setType(typ);
} }
} }

View file

@ -25,7 +25,7 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc
if(!variable_struct_exists(_str, k)) { if(!variable_struct_exists(_str, k)) {
out.setValue(0); out.setValue(0);
out.type = VALUE_TYPE.float; out.setType(VALUE_TYPE.float);
break; 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(j == array_length(keys) - 1) {
if(is_struct(val)) { if(is_struct(val)) {
if(is_instanceof(val, Surface)) { if(is_instanceof(val, Surface)) {
out.type = VALUE_TYPE.surface; out.setType(VALUE_TYPE.surface);
val = val.get(); val = val.get();
} else if(is_instanceof(val, Buffer)) { } else if(is_instanceof(val, Buffer)) {
out.type = VALUE_TYPE.buffer; out.setType(VALUE_TYPE.buffer);
val = val.buffer; val = val.buffer;
} else } else
out.type = VALUE_TYPE.struct; out.setType(VALUE_TYPE.struct);
} else if(is_array(val) && array_length(val)) } 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 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); out.setValue(val);
} }

View file

@ -66,12 +66,12 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static onValueFromUpdate = function(index) { static onValueFromUpdate = function(index) {
if(LOADING || APPENDING) return; 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 ) { 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) 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 sele = getInputData(0);
var _res = getInputData(1); 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 ) { for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
var _cas = getInputData(i + 0); var _cas = getInputData(i + 0);
@ -97,7 +97,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(sele == _cas) { if(sele == _cas) {
_res = _val; _res = _val;
outputs[| 0].type = inputs[| i + 1].type; outputs[| 0].setType(inputs[| i + 1].type);
} }
} }

View file

@ -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 update = function(frame = PROJECT.animator.current_frame) { onValueUpdate(); }
static resetMap = function() { 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); var _key = getInputData(0);
resetMap(); 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); k = ds_map_find_next(TUNNELS_IN_MAP, k);
} }
RENDER_ALL if(index == 0) { RENDER_ALL_REORDER }
} }
static step = function() { 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; value_validation[VALIDATION.error] = error_notification != noone;
if(inputs[| 1].value_from == 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; inputs[| 1].display_type = VALUE_DISPLAY._default;
} else { } 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; 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); 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() { static onDestroy = function() {
if(error_notification != noone) if(error_notification != noone)

View file

@ -53,23 +53,21 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
draw_set_alpha(1); draw_set_alpha(1);
} }
static onClone = function() { onValueUpdate(); } static onValueUpdate = function(index = -1) {
static onValueUpdate = function() {
var _key = getInputData(0); var _key = getInputData(0);
TUNNELS_OUT[? node_id] = _key; TUNNELS_OUT[? node_id] = _key;
RENDER_ALL if(index == 0) { RENDER_ALL_REORDER }
} }
static step = function() { static step = function() {
var _key = getInputData(0); var _key = getInputData(0);
if(ds_map_exists(TUNNELS_IN, _key)) { 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; outputs[| 0].display_type = TUNNELS_IN[? _key].display_type;
} else { } else {
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].display_type = VALUE_DISPLAY._default; 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); 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); }
} }

View file

@ -1129,6 +1129,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion } #endregion
resetDisplay(); resetDisplay();
static setType = function(_type) { #region
if(type == _type) return false;
type = _type;
draw_junction_index = type;
return true;
} #endregion
static expressionUpdate = function() { #region static expressionUpdate = function() { #region
expTree = evaluateFunctionList(expression); expTree = evaluateFunctionList(expression);
resetCache(); resetCache();
@ -1303,7 +1312,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
global.cache_call++; global.cache_call++;
if(useCache && use_cache) { if(useCache && use_cache) {
var cache_hit = cache_value[0]; 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[2] != undefined;
cache_hit &= cache_value[3] == applyUnit; cache_hit &= cache_value[3] == applyUnit;
cache_hit &= connect_type == JUNCTION_CONNECT.input; 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); var val = _getValue(_time, applyUnit, arrIndex, log);
draw_junction_index = type; draw_junction_index = type;
if(type == VALUE_TYPE.surface) { if(type == VALUE_TYPE.surface || type == VALUE_TYPE.any) {
var _sval = val; var _sval = val;
if(is_array(_sval) && !array_empty(_sval)) if(is_array(_sval) && !array_empty(_sval))
_sval = _sval[0]; _sval = _sval[0];
@ -1472,12 +1481,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
PANEL_ANIMATION.updatePropertyList(); PANEL_ANIMATION.updatePropertyList();
} #endregion } #endregion
static __anim = function() { #region static isActiveDynamic = function() { #region
if(node.update_on_frame) return true; gml_pragma("forceinline");
if(value_from != noone) return false;
if(expUse) { if(expUse) {
if(!is_struct(expTree)) return false; if(!is_struct(expTree)) return false;
var res = expTree.isAnimated(); var res = expTree.isDynamic();
switch(res) { switch(res) {
case EXPRESS_TREE_ANIM.none : return false; case EXPRESS_TREE_ANIM.none : return false;
@ -1489,18 +1500,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return is_anim; return is_anim;
} #endregion } #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 static showValue = function() { #region
var useCache = true; var useCache = true;
if(display_type == VALUE_DISPLAY.area) if(display_type == VALUE_DISPLAY.area)
@ -1747,7 +1746,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
PROJECT.modified = true; PROJECT.modified = true;
} }
UPDATE_RENDER_ORDER = true; RENDER_ALL_REORDER
if(onSetFrom != noone) onSetFrom(_valueFrom); if(onSetFrom != noone) onSetFrom(_valueFrom);
if(_valueFrom.onSetTo != noone) _valueFrom.onSetTo(self); if(_valueFrom.onSetTo != noone) _valueFrom.onSetTo(self);
@ -1767,7 +1766,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
PROJECT.modified = true; PROJECT.modified = true;
UPDATE_RENDER_ORDER = true; RENDER_ALL_REORDER
return false; return false;
} #endregion } #endregion
@ -1871,7 +1870,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static drawJunction = function(_s, _mx, _my, sca = 1) { #region static drawJunction = function(_s, _mx, _my, sca = 1) { #region
if(!isVisible()) return false; if(!isVisible()) return false;
var ss = max(0.25, _s / 2); var ss = max(0.25, _s / 2);
var is_hover = false; var is_hover = false;
if(PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, x, y, 10 * _s * sca)) { 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(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(); onValidate();
} #endregion } #endregion

View file

@ -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;; if(struct_has(attr, "mesh_bound")) attributes.mesh_bound = attr.mesh_bound;;
} }
static postConnect = function() { static postLoad = function() {
setTriangle(); setTriangle();
if(loadPin == noone) return; if(loadPin == noone) return;

View file

@ -478,7 +478,7 @@ function Panel_Animation() : PanelContent() constructor {
var x0 = (i + 0) * ui(timeline_scale) + timeline_shift; var x0 = (i + 0) * ui(timeline_scale) + timeline_shift;
var x1 = (i + 1) * 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_set_alpha(0.5);
draw_rectangle(x0, bar_h - ui(4), x1, bar_h, false); draw_rectangle(x0, bar_h - ui(4), x1, bar_h, false);
draw_set_alpha(1); draw_set_alpha(1);

View file

@ -131,10 +131,10 @@
return true; return true;
} }
static isAnimated = function() { static isDynamic = function() {
var anim = EXPRESS_TREE_ANIM.none; var anim = EXPRESS_TREE_ANIM.none;
for( var i = 0, n = array_length(funcTrees); i < n; i++ ) 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; return anim;
} }
@ -161,12 +161,12 @@
return true; return true;
} }
static isAnimated = function() { static isDynamic = function() {
var anim = EXPRESS_TREE_ANIM.none; var anim = EXPRESS_TREE_ANIM.none;
if(condition != noone) anim = max(anim, condition.isAnimated()); if(condition != noone) anim = max(anim, condition.isDynamic());
if(if_true != noone) anim = max(anim, if_true.isAnimated()); if(if_true != noone) anim = max(anim, if_true.isDynamic());
if(if_false != noone) anim = max(anim, if_false.isAnimated()); if(if_false != noone) anim = max(anim, if_false.isDynamic());
return anim; return anim;
} }
@ -208,17 +208,17 @@
return true; return true;
} }
static isAnimated = function() { static isDynamic = function() {
var anim = EXPRESS_TREE_ANIM.none; var anim = EXPRESS_TREE_ANIM.none;
if(itr_array) { if(itr_array) {
if(cond_arr == noone) anim = max(anim, cond_arr.isAnimated()) if(cond_arr == noone) anim = max(anim, cond_arr.isDynamic())
} else { } else {
if(cond_init == noone) anim = max(anim, cond_init.isAnimated()) if(cond_init == noone) anim = max(anim, cond_init.isDynamic())
if(cond_term == noone) anim = max(anim, cond_term.isAnimated()) 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; return anim;
} }
@ -324,7 +324,7 @@
static _isAnimated = function(val) { #region static _isAnimated = function(val) { #region
if(is_real(val)) return EXPRESS_TREE_ANIM.none; 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)) { if(is_array(val)) {
var anim = EXPRESS_TREE_ANIM.none; var anim = EXPRESS_TREE_ANIM.none;
for( var i = 0, n = array_length(val); i < n; i++ ) for( var i = 0, n = array_length(val); i < n; i++ )
@ -339,7 +339,7 @@
return anim[0]; return anim[0];
} #endregion } #endregion
static isAnimated = function() { #region static isDynamic = function() { #region
if(anim_cache && anim_stat != undefined) return anim_stat; if(anim_cache && anim_stat != undefined) return anim_stat;
anim_stat = EXPRESS_TREE_ANIM.none; anim_stat = EXPRESS_TREE_ANIM.none;

View file

@ -7,13 +7,14 @@ enum RENDER_TYPE {
#region globalvar #region globalvar
globalvar UPDATE, RENDER_QUEUE, RENDER_ORDER, UPDATE_RENDER_ORDER; globalvar UPDATE, RENDER_QUEUE, RENDER_ORDER, UPDATE_RENDER_ORDER;
UPDATE_RENDER_ORDER = false; UPDATE_RENDER_ORDER = false;
global.FLAG.render = 1; global.FLAG.render = 0;
global.group_io = [ global.group_io = [
"Node_Group_Input", "Node_Group_Output", "Node_Group_Input", "Node_Group_Output",
"Node_Feedback_Input", "Node_Feedback_Output", "Node_Feedback_Input", "Node_Feedback_Output",
"Node_Iterator_Input", "Node_Iterator_Output", "Node_Iterator_Input", "Node_Iterator_Output",
"Node_Iterator_Each_Input", "Node_Iterator_Each_Output", "Node_Iterator_Each_Input", "Node_Iterator_Each_Output",
"Node_Iterator_Filter_Input", "Node_Iterator_Filter_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; #macro RENDER_ALL_REORDER UPDATE_RENDER_ORDER = true; UPDATE |= RENDER_TYPE.full;
@ -63,6 +64,7 @@ function __nodeInLoop(_node) { #region
function ResetAllNodesRender() { #region function ResetAllNodesRender() { #region
LOG_IF(global.FLAG.render == 1, $"XXXXXXXXXXXXXXXXXXXX RESETTING ALL NODES [frame {PROJECT.animator.current_frame}] XXXXXXXXXXXXXXXXXXXX"); 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 _key = ds_map_find_first(PROJECT.nodeMap);
var amo = ds_map_size(PROJECT.nodeMap); var amo = ds_map_size(PROJECT.nodeMap);
@ -77,6 +79,72 @@ function ResetAllNodesRender() { #region
} }
} #endregion } #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 function Render(partial = false, runAction = false) { #region
LOG_BLOCK_START(); LOG_BLOCK_START();
LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {PROJECT.animator.current_frame}] =============================="); 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 // get leaf node
RENDER_QUEUE.clear(); RENDER_QUEUE.clear();
var key = ds_map_find_first(PROJECT.nodeMap); for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) {
var amo = ds_map_size(PROJECT.nodeMap); var _node = PROJECT.nodeTopo[| i];
repeat(amo) { _node.passiveDynamic = false;
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; } for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) {
if(!is_struct(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-struct {_node}"); continue; } var _node = PROJECT.nodeTopo[| i];
if(array_exists(global.group_io, instanceof(_node))) {
LOG_IF(global.FLAG.render == 1, $"Skip group IO {_node.internalName}");
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; _node.render_time = 0;
if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; } if(array_exists(global.group_io, instanceof(_node))) {
if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; } LOG_IF(global.FLAG.render == 1, $"Skip group IO [{_node.internalName}]"); continue; }
if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; }
if(_node.rendered && !_node.isAnimated()) { if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive [{_node.internalName}]"); continue; }
_node.anim_last_step = false; if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive [{_node.internalName}]"); continue; }
LOG_IF(global.FLAG.render == 1, $"Skip rendered {_node.internalName}"); if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update [{_node.internalName}]"); continue; }
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); LOG_IF(global.FLAG.render == 1, $" Found leaf [{_node.internalName}]");
if(_startNode) { RENDER_QUEUE.enqueue(_node);
LOG_IF(global.FLAG.render == 1, $"Found leaf {_node.internalName}"); _node.forwardPassiveDynamic();
//if(!reset_all) _node.resetRenderForward();
RENDER_QUEUE.enqueue(_node);
} else
LOG_IF(global.FLAG.render == 1, $"Skip non-leaf {_node.internalName}");
LOG_BLOCK_END();
} }
_leaf_time = get_timer() - t; _leaf_time = get_timer() - t;
@ -153,6 +211,7 @@ function Render(partial = false, runAction = false) { #region
while(!RENDER_QUEUE.empty()) { while(!RENDER_QUEUE.empty()) {
LOG_BLOCK_START(); LOG_BLOCK_START();
LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] "); LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] ");
rendering = RENDER_QUEUE.dequeue(); rendering = RENDER_QUEUE.dequeue();
var renderable = rendering.isRenderable(); var renderable = rendering.isRenderable();
@ -192,6 +251,14 @@ function Render(partial = false, runAction = false) { #region
LOG_END(); LOG_END();
} #endregion } #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 function __renderListReset(list) { #region
for( var i = 0; i < ds_list_size(list); i++ ) { for( var i = 0; i < ds_list_size(list); i++ ) {
list[| i].setRenderStatus(false); list[| i].setRenderStatus(false);
@ -214,18 +281,45 @@ function RenderList(list) { #region
__renderListReset(list); __renderListReset(list);
// get leaf node // 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]; var _node = list[| i];
if(is_undefined(_node)) continue; if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend {_node}"); continue; }
if(!is_struct(_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(array_exists(global.group_io, instanceof(_node))) {
if(!_node.isRenderActive()) continue; LOG_IF(global.FLAG.render == 1, $"Skip group IO {_node.internalName}");
if(_node.rendered) continue; continue;
}
if(_node.isRenderable()) if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; }
ds_queue_enqueue(queue, _node); 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."); 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 // render forward
while(!ds_queue_empty(queue)) { while(!ds_queue_empty(queue)) {
LOG_BLOCK_START(); LOG_BLOCK_START();
LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE}"); rendering = ds_queue_dequeue(queue)
rendering = RENDER_QUEUE.dequeue();
if(!ds_list_exist(list, rendering)) continue; if(!ds_list_exist(list, rendering)) continue;
var renderable = rendering.isRenderable(); var renderable = rendering.isRenderable();
@ -246,12 +339,10 @@ function RenderList(list) { #region
var nextNodes = rendering.getNextNodes(); var nextNodes = rendering.getNextNodes();
for( var i = 0, n = array_length(nextNodes); i < n; i++ ) 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()) if(runAction && rendering.hasInspector1Update())
rendering.inspector1Update(); rendering.inspector1Update();
} else if(rendering.isRenderActive()) {
RENDER_QUEUE.enqueue(rendering);
} }
LOG_BLOCK_END(); LOG_BLOCK_END();