From c566ca84badbf664a414bca28d5c9f0936f0f771 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 8 Jun 2024 18:31:27 +0700 Subject: [PATCH] use array for project nodes instead of list --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_add_node/Create_0.gml | 15 +- objects/o_main/Step_0.gml | 2 +- objects/o_main/Step_1.gml | 2 +- objects/o_main/o_main.yy | 14 +- scripts/__node_iterator/__node_iterator.gml | 20 +- .../animation_controller.gml | 9 +- scripts/append_function/append_function.gml | 51 +++--- scripts/globals/globals.gml | 2 +- scripts/load_function/load_function.gml | 31 ++-- scripts/node_VFX_group/node_VFX_group.gml | 26 +-- .../node_VFX_group_inline.gml | 10 +- .../node_anim_priority/node_anim_priority.gml | 6 +- scripts/node_collection/node_collection.gml | 74 ++++---- .../node_collection_inline.gml | 22 +-- scripts/node_data/node_data.gml | 16 +- scripts/node_dynasurf/node_dynasurf.gml | 8 +- scripts/node_export/node_export.gml | 8 +- scripts/node_functions/node_functions.gml | 23 +-- .../node_iterate_each_inline.gml | 6 +- .../node_iterate_filter.gml | 4 +- .../node_iterate_filter_inline.gml | 6 +- .../node_iterate_sort/node_iterate_sort.gml | 12 +- .../node_iterate_sort_inline.gml | 14 +- .../node_pixel_builder/node_pixel_builder.gml | 8 +- .../node_rigid_object/node_rigid_object.gml | 4 +- .../node_rigid_object_spawner.gml | 4 +- .../node_rigid_render/node_rigid_render.gml | 4 +- .../node_rigid_render_output.gml | 4 +- scripts/node_smoke_group/node_smoke_group.gml | 4 +- scripts/panel_animation/panel_animation.gml | 6 +- .../panel_animation_scaler.gml | 9 +- scripts/panel_collection/panel_collection.gml | 18 +- scripts/panel_graph/panel_graph.gml | 171 ++++++++---------- scripts/panel_menu/panel_menu.gml | 6 +- scripts/panel_nodes/panel_nodes.gml | 6 +- scripts/panel_tunnels/panel_tunnels.gml | 10 +- scripts/project_data/project_data.gml | 25 ++- scripts/render_data/render_data.gml | 108 +++++------ scripts/save_function/save_function.gml | 39 ++-- .../2d1796d8-b49c-4323-88ed-3801bd585e7a.png | Bin 0 -> 1950 bytes .../40d37a1c-23eb-4c00-887e-7c10c5dd5ad1.png | Bin 0 -> 1950 bytes sprites/s_node_svg/s_node_svg.yy | 90 +++++++++ 44 files changed, 461 insertions(+), 438 deletions(-) create mode 100644 sprites/s_node_svg/2d1796d8-b49c-4323-88ed-3801bd585e7a.png create mode 100644 sprites/s_node_svg/layers/2d1796d8-b49c-4323-88ed-3801bd585e7a/40d37a1c-23eb-4c00-887e-7c10c5dd5ad1.png create mode 100644 sprites/s_node_svg/s_node_svg.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 3aa5ebded..d445524f6 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1989,6 +1989,7 @@ {"name":"s_node_struct","order":1,"path":"sprites/s_node_struct/s_node_struct.yy",}, {"name":"s_node_surface_from_buffer","order":2,"path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",}, {"name":"s_node_surface_to_buffer","order":3,"path":"sprites/s_node_surface_to_buffer/s_node_surface_to_buffer.yy",}, + {"name":"s_node_svg","order":38,"path":"sprites/s_node_svg/s_node_svg.yy",}, {"name":"s_node_switch","order":20,"path":"sprites/s_node_switch/s_node_switch.yy",}, {"name":"s_node_terminal_trigger","order":41,"path":"sprites/s_node_terminal_trigger/s_node_terminal_trigger.yy",}, {"name":"s_node_text_char_get","order":2,"path":"sprites/s_node_text_char_get/s_node_text_char_get.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 47aafccf9..9f9956279 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -2570,6 +2570,7 @@ {"id":{"name":"s_node_struct","path":"sprites/s_node_struct/s_node_struct.yy",},}, {"id":{"name":"s_node_surface_from_buffer","path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",},}, {"id":{"name":"s_node_surface_to_buffer","path":"sprites/s_node_surface_to_buffer/s_node_surface_to_buffer.yy",},}, + {"id":{"name":"s_node_svg","path":"sprites/s_node_svg/s_node_svg.yy",},}, {"id":{"name":"s_node_switch","path":"sprites/s_node_switch/s_node_switch.yy",},}, {"id":{"name":"s_node_terminal_trigger","path":"sprites/s_node_terminal_trigger/s_node_terminal_trigger.yy",},}, {"id":{"name":"s_node_text_char_get","path":"sprites/s_node_text_char_get/s_node_text_char_get.yy",},}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 4ab805be7..29e2b6781 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -220,17 +220,18 @@ event_inherited(); //try to connect if(node_called != noone) { //dragging from junction var _call_input = node_called.connect_type == JUNCTION_CONNECT.input; - var _node_list = _call_input? _outputs : _inputs; - for(var i = 0; i < ds_list_size(_node_list); i++) { - var _target = _node_list[| i]; + var _junc_list = _call_input? _outputs : _inputs; + + for(var i = 0; i < ds_list_size(_junc_list); i++) { + var _target = _junc_list[| i]; if(!_target.visible) continue; if(_target.auto_connect) { - if(_call_input && node_called.isConnectable(_node_list[| i])) { - node_called.setFrom(_node_list[| i]); + if(_call_input && node_called.isConnectable(_junc_list[| i])) { + node_called.setFrom(_junc_list[| i]); _new_node.x -= _new_node.w; - } else if(!_call_input && _node_list[| i].isConnectable(node_called)) - _node_list[| i].setFrom(node_called); + } else if(!_call_input && _junc_list[| i].isConnectable(node_called)) + _junc_list[| i].setFrom(node_called); break; } } diff --git a/objects/o_main/Step_0.gml b/objects/o_main/Step_0.gml index 271a3282e..cca901953 100644 --- a/objects/o_main/Step_0.gml +++ b/objects/o_main/Step_0.gml @@ -11,7 +11,7 @@ if(PROJECT.active && !PROJECT.safeMode) { #region node step try { if(PANEL_MAIN != 0) PANEL_MAIN.step(); - array_foreach(PROJECT.nodeArray, function(_node) { + array_foreach(PROJECT.allNodes, function(_node) { if(!_node.active) return; _node.triggerCheck(); _node.step(); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 50dcc5abe..636da9d89 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -126,7 +126,7 @@ _HOVERING_ELEMENT = noone; if(PROJECT.active) { PROJECT.animator.is_simulating = false; - array_foreach(PROJECT.nodeArray, function(_node) { if(!_node.active) return; _node.stepBegin(); }); + array_foreach(PROJECT.allNodes, function(_node) { if(!_node.active) return; _node.stepBegin(); }); if(PROGRAM_ARGUMENTS._run) { if(PROJECT != noone && PROJECT.path != "") { diff --git a/objects/o_main/o_main.yy b/objects/o_main/o_main.yy index 5031680f0..c26819bb9 100644 --- a/objects/o_main/o_main.yy +++ b/objects/o_main/o_main.yy @@ -3,16 +3,16 @@ "%Name":"o_main", "eventList":[ {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml index 751599402..cdd9f64b9 100644 --- a/scripts/__node_iterator/__node_iterator.gml +++ b/scripts/__node_iterator/__node_iterator.gml @@ -17,8 +17,8 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) iterated = 0; static isActiveDynamic = function(frame = CURRENT_FRAME) { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) - if(nodes[| i].isActiveDynamic(frame)) return true; + for( var i = 0, n = array_length(nodes); i < n; i++ ) + if(nodes[i].isActiveDynamic(frame)) return true; return false; } #endregion @@ -51,9 +51,9 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) var _nodes = []; - for( var i = 0; i < ds_list_size(nodes); i++ ) { // check if every node is updated - if(!nodes[| i].rendered) { - LOG_IF(global.FLAG.render == 1, $"Skipped due to node {nodes[| i].internalName} not rendered."); + for( var i = 0; i < array_length(nodes); i++ ) { // check if every node is updated + if(!nodes[i].rendered) { + LOG_IF(global.FLAG.render == 1, $"Skipped due to node {nodes[i].internalName} not rendered."); LOG_BLOCK_END(); return _nodes; } @@ -92,16 +92,16 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) static iterationUpdate = function() { #region var maxIter = getIterationCount(); - for( var i = 0; i < ds_list_size(nodes); i++ ) // check if every node is updated - if(!nodes[| i].rendered) { - LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [RENDER FAILED by {nodes[| i]}] >------------------"); + for( var i = 0; i < array_length(nodes); i++ ) // check if every node is updated + if(!nodes[i].rendered) { + LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [RENDER FAILED by {nodes[i]}] >------------------"); return; } iterated++; - for( var i = 0; i < ds_list_size(nodes); i++ ) - nodes[| i].clearInputCache(); + for( var i = 0; i < array_length(nodes); i++ ) + nodes[i].clearInputCache(); if(iterated == maxIter) { LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [COMPLETE] >------------------"); diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index 94451837a..3ee873d55 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -64,14 +64,7 @@ static resetAnimation = function() { #region INLINE - var _key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); - - repeat(amo) { - var _node = PROJECT.nodeMap[? _key]; - _node.resetAnimation(); - _key = ds_map_find_next(PROJECT.nodeMap, _key); - } + array_foreach(PROJECT.allNodes, function(node) { node.resetAnimation(); }); } #endregion static toggle = function() { #region diff --git a/scripts/append_function/append_function.gml b/scripts/append_function/append_function.gml index 1c190650c..0ca2522c5 100644 --- a/scripts/append_function/append_function.gml +++ b/scripts/append_function/append_function.gml @@ -10,13 +10,13 @@ function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { #region } var node_create = __APPEND_MAP(_map, context); - recordAction(ACTION_TYPE.collection_loaded, array_create_from_list(node_create), _path); + recordAction(ACTION_TYPE.collection_loaded, array_clone(node_create), _path); log_message("FILE", "append file " + _path, THEME.noti_icon_file_load); return node_create; } #endregion -function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_list = ds_list_create()) { #region +function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_list = []) { #region static log = false; UNDO_HOLDING = true; @@ -32,7 +32,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_ if(!struct_has(_map, "nodes")) return noone; var _node_list = _map.nodes; - var node_create = ds_list_create(); + var node_create = []; APPENDING = true; @@ -44,17 +44,17 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_ var ex = ds_map_exists(APPEND_MAP, _node_list[i].id); var _node = nodeLoad(_node_list[i], true, context); - if(_node && !ex) ds_list_add(appended_list, _node); + if(_node && !ex) array_push(appended_list, _node); } printIf(log, "Load time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) { - var _node = appended_list[| i]; + for(var i = 0; i < array_length(appended_list); i++) { + var _node = appended_list[i]; _node.loadGroup(context); if(_node.group == context) - ds_list_add(node_create, _node); + array_push(node_create, _node); } } catch(e) { log_warning("APPEND, node", exception_print(e)); @@ -62,38 +62,38 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_ printIf(log, "Load group time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].postDeserialize(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].postDeserialize(); } catch(e) { log_warning("APPEND, deserialize", exception_print(e)); } printIf(log, "Deserialize time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].applyDeserialize(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].applyDeserialize(); } catch(e) { log_warning("LOAD, apply deserialize", exception_print(e)); } printIf(log, "Apply deserialize time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].preConnect(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].preConnect(); - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].connect(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].connect(); - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].postConnect(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].postConnect(); } catch(e) { log_warning("APPEND, connect", exception_print(e)); } printIf(log, "Connect time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].doUpdate(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].doUpdate(); } catch(e) { log_warning("APPEND, update", exception_print(e)); } @@ -126,22 +126,19 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_ printIf(log, "Conflict time: " + string(current_time - t)); t = current_time; try { - for(var i = 0; i < ds_list_size(appended_list); i++) - appended_list[| i].postLoad(); + for(var i = 0; i < array_length(appended_list); i++) + appended_list[i].postLoad(); } catch(e) { log_warning("APPEND, connect", exception_print(e)); } UNDO_HOLDING = false; - - ds_list_destroy(appended_list); - - APPENDING = false; + APPENDING = false; if(struct_has(_map, "metadata")) { var meta = _map.metadata; - for( var i = 0; i < ds_list_size(node_create); i++ ) { - var _node = node_create[| i]; + for( var i = 0; i < array_length(node_create); i++ ) { + var _node = node_create[i]; if(!struct_has(_node, "metadata")) continue; _node.metadata.deserialize(meta, true); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 42f25b7cc..f077f024d 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -5,7 +5,7 @@ globalvar APPENDING, APPEND_MAP, APPEND_LIST; APPEND_MAP = ds_map_create(); - APPEND_LIST = ds_list_create(); + APPEND_LIST = []; LOADING = false; LOADING_VERSION = 0; diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index d1d3bf218..c2595cf82 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -136,14 +136,14 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Load meta : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); - var create_list = ds_list_create(); + var create_list = []; if(struct_has(_load_content, "nodes")) { try { var _node_list = _load_content.nodes; for(var i = 0, n = array_length(_node_list); i < n; i++) { // printIf(log, $" >> Loading nodes : {_node_list[i].type}"); var _node = nodeLoad(_node_list[i]); - if(_node) ds_list_add(create_list, _node); + if(_node) array_push(create_list, _node); } } catch(e) { log_warning("LOAD", exception_print(e)); @@ -216,8 +216,8 @@ function LOAD_AT(path, readonly = false, override = false) { #region ds_queue_clear(CONNECTION_CONFLICT); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].loadGroup(); + array_foreach(create_list, function(node) { node.loadGroup(); } ); + } catch(e) { log_warning("LOAD, group", exception_print(e)); return false; @@ -226,8 +226,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Load group : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].postDeserialize(); + array_foreach(create_list, function(node) { node.postDeserialize(); } ); } catch(e) { log_warning("LOAD, deserialize", exception_print(e)); } @@ -235,8 +234,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Deserialize: {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].applyDeserialize(); + array_foreach(create_list, function(node) { node.applyDeserialize(); } ); } catch(e) { log_warning("LOAD, apply deserialize", exception_print(e)); } @@ -244,12 +242,9 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Apply deserialize : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].preConnect(); - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].connect(); - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].postConnect(); + array_foreach(create_list, function(node) { node.preConnect(); } ); + array_foreach(create_list, function(node) { node.connect(); } ); + array_foreach(create_list, function(node) { node.postConnect(); } ); } catch(e) { log_warning("LOAD, connect", exception_print(e)); } @@ -278,8 +273,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Conflict : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].postLoad(); + array_foreach(create_list, function(node) { node.postLoad(); } ); } catch(e) { log_warning("LOAD, connect", exception_print(e)); } @@ -287,8 +281,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region printIf(log, $" > Post load : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); try { - for(var i = 0; i < ds_list_size(create_list); i++) - create_list[| i].clearInputCache(); + array_foreach(create_list, function(node) { node.clearInputCache(); } ); } catch(e) { log_warning("LOAD, connect", exception_print(e)); } @@ -316,7 +309,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region if(!IS_CMD) run_in(1, PANEL_GRAPH.toCenterNode); - printIf(log, $"========== Load {ds_map_size(PROJECT.nodeMap)} nodes completed in {(get_timer() - t0) / 1000} ms =========="); + printIf(log, $"========== Load {array_length(PROJECT.allNodes)} nodes completed in {(get_timer() - t0) / 1000} ms =========="); return true; } #endregion diff --git a/scripts/node_VFX_group/node_VFX_group.gml b/scripts/node_VFX_group/node_VFX_group.gml index 1683faa2d..5b0afee1d 100644 --- a/scripts/node_VFX_group/node_VFX_group.gml +++ b/scripts/node_VFX_group/node_VFX_group.gml @@ -10,7 +10,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group update_on_frame = true; managedRenderOrder = true; - topoList = ds_list_create(); + topoList = []; ungroupable = false; preview_node = noone; allCached = false; @@ -34,15 +34,15 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ]; static onInspector2Update = function() { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; node.clearCache(); } } #endregion static reset = function() { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(!struct_has(node, "reset")) continue; node.reset(); } @@ -65,8 +65,8 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group node.doUpdate(i); } - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(!struct_has(node, "resetSeed")) continue; node.resetSeed(); } @@ -77,8 +77,8 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group NodeListSort(topoList, nodes); allCached = true; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(!node.recoverCache()) allCached = false; } @@ -86,8 +86,8 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group reset(); if(allCached) { - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) - nodes[| i].setRenderStatus(true); + for( var i = 0, n = array_length(nodes); i < n; i++ ) + nodes[i].setRenderStatus(true); setRenderStatus(true); } } #endregion @@ -95,8 +95,8 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group static ononDoubleClick = function(panel) { #region preview_node = noone; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(is_instanceof(node, Node_VFX_Renderer_Output) || is_instanceof(node, Node_VFX_Renderer)) { preview_node = node; diff --git a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml index a2c036e80..179860f67 100644 --- a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml +++ b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml @@ -4,7 +4,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( icon = THEME.vfx; is_root = false; - topoList = ds_list_create(); + topoList = []; inputs[| 0] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ) .rejectArray(); @@ -38,8 +38,8 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( static getNextNodes = function() { return __nodeLeafList(nodes); } static reset = function() { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(!struct_has(node, "reset")) continue; node.reset(); } @@ -61,8 +61,8 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( node.doUpdate(i); } - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(!struct_has(node, "resetSeed")) continue; node.resetSeed(); } diff --git a/scripts/node_anim_priority/node_anim_priority.gml b/scripts/node_anim_priority/node_anim_priority.gml index b90a89632..dac89854b 100644 --- a/scripts/node_anim_priority/node_anim_priority.gml +++ b/scripts/node_anim_priority/node_anim_priority.gml @@ -2,13 +2,11 @@ function rearrange_priority(node, newpri) { if(node.anim_priority == floor(newpri)) return; node.anim_priority = newpri; - var amo = ds_map_size(PROJECT.nodeMap); var k = ds_map_find_first(PROJECT.nodeMap); var pr = ds_priority_create(); - repeat(amo) { - var _node = PROJECT.nodeMap[? k]; - k = ds_map_find_next(PROJECT.nodeMap, k); + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var _node = PROJECT.allNodes[i]; if(!_node.active) continue; ds_priority_add(pr, _node, _node.anim_priority); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 6ceccc7f2..f545d2467 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -121,8 +121,7 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr function upgroupNode(collection, record = true) { #region UNDO_HOLDING = true; var _content = [], _deleted = []; - var node_list = collection.getNodeList(); - var _node_arr = ds_list_to_array(node_list); + var _node_arr = collection.getNodeList(); var _conn_to = collection.getJunctionTos(); var _cx = 0, _cy = 0; @@ -169,8 +168,8 @@ function upgroupNode(collection, record = true) { #region } #endregion function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { - nodes = ds_list_create(); - node_length = ds_list_size(nodes); + nodes = []; + node_length = 0; ungroupable = true; auto_render_time = false; @@ -239,9 +238,9 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static onInspector2Update = function() { #region var i = 0; - repeat(ds_list_size(nodes)) { - if(nodes[| i].hasInspector2Update()) - nodes[| i].inspector2Update(); + repeat(array_length(nodes)) { + if(nodes[i].hasInspector2Update()) + nodes[i].inspector2Update(); i++; } } #endregion @@ -254,12 +253,12 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc hasInsp1 = false; hasInsp2 = false; - node_length = ds_list_size(nodes); + node_length = array_length(nodes); var i = 0; repeat(node_length) { - hasInsp1 |= nodes[| i].hasInspector1Update(); - hasInsp2 |= nodes[| i].hasInspector2Update(); + hasInsp1 |= nodes[i].hasInspector1Update(); + hasInsp2 |= nodes[i].hasInspector2Update(); i++; } @@ -361,7 +360,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc return nextNodes; } #endregion - static clearTopoSorted = function() { INLINE topoSorted = false; for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { nodes[| i].clearTopoSorted(); } } + static clearTopoSorted = function() { INLINE topoSorted = false; for( var i = 0, n = array_length(nodes); i < n; i++ ) { nodes[i].clearTopoSorted(); } } static setRenderStatus = function(result) { #region LOG_BLOCK_START(); @@ -402,15 +401,15 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static exitGroup = function() {} static add = function(_node) { #region - ds_list_add(getNodeList(), _node); + array_push(getNodeList(), _node); var list = _node.group == noone? PANEL_GRAPH.nodes_list : _node.group.getNodeList(); - ds_list_remove(list, _node); + array_remove(list, _node); recordAction(ACTION_TYPE.group_added, self, _node); _node.group = self; will_refresh = true; - node_length = ds_list_size(nodes); + node_length = array_length(nodes); } #endregion static remove = function(_node) { #region @@ -420,8 +419,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc var node_list = getNodeList(); var list = group == noone? PANEL_GRAPH.nodes_list : group.getNodeList(); - ds_list_remove(node_list, _node); - ds_list_add(list, _node); + array_remove(node_list, _node); + array_push(list, _node); } recordAction(ACTION_TYPE.group_removed, self, _node); @@ -433,14 +432,11 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc else _node.group = group; will_refresh = true; - node_length = ds_list_size(nodes); + node_length = array_length(nodes); } #endregion static clearCache = function() { #region - var node_list = getNodeList(); - for(var i = 0; i < ds_list_size(node_list); i++) { - node_list[| i].clearCache(); - } + array_foreach(getNodeList(), function(node) { node.clearCache(); }); } #endregion static stepBegin = function() { #region @@ -451,9 +447,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static step = function() { #region if(combine_render_time) { render_time = 0; - var node_list = getNodeList(); - for(var i = 0; i < ds_list_size(node_list); i++) - render_time += node_list[| i].render_time; + array_foreach(getNodeList(), function(node) { render_time += node.render_time; }); } onStep(); @@ -517,8 +511,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getTool = function() { #region - for(var i = 0, n = ds_list_size(nodes); i < n; i++) { - var _node = nodes[| i]; + for(var i = 0, n = array_length(nodes); i < n; i++) { + var _node = nodes[i]; if(!_node.active) continue; if(_node.isTool) return _node.getTool(); } @@ -534,8 +528,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc var dups = ds_list_create(); - for(var i = 0, n = ds_list_size(nodes); i < n; i++) { - var _node = nodes[| i]; + for(var i = 0, n = array_length(nodes); i < n; i++) { + var _node = nodes[i]; var _cnode = _node.clone(target); ds_list_add(dups, _cnode); @@ -554,16 +548,12 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static enable = function() { #region active = true; - var node_list = getNodeList(); - for( var i = 0; i < ds_list_size(node_list); i++ ) - node_list[| i].enable(); + array_foreach(getNodeList(), function(node) { node.enable(); }); } #endregion static disable = function() { #region active = false; - var node_list = getNodeList(); - for( var i = 0; i < ds_list_size(node_list); i++ ) - node_list[| i].disable(); + array_foreach(getNodeList(), function(node) { node.disable(); }); } #endregion static resetRender = function(_clearCache = false) { #region @@ -573,8 +563,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(_clearCache) clearInputCache(); if(reset_all_child) - for(var i = 0, n = ds_list_size(nodes); i < n; i++) - nodes[| i].resetRender(_clearCache); + for(var i = 0, n = array_length(nodes); i < n; i++) + nodes[i].resetRender(_clearCache); } #endregion static setInstance = function(node) { #region @@ -606,10 +596,10 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static getGraphPreviewSurface = function() { #region var _output_junc = outputs[| preview_channel]; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - if(!nodes[| i].active) continue; - if(is_instanceof(nodes[| i], Node_Group_Thumbnail)) - _output_junc = nodes[| i].inputs[| 0]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + if(!nodes[i].active) continue; + if(is_instanceof(nodes[i], Node_Group_Thumbnail)) + _output_junc = nodes[i].inputs[| 0]; } if(!is_instanceof(_output_junc, NodeValue)) return noone; @@ -625,12 +615,12 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static enable = function() { #region active = true; timeline_item.active = true; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) nodes[| i].enable(); + for( var i = 0, n = array_length(nodes); i < n; i++ ) nodes[i].enable(); } #endregion static disable = function() { #region active = false; timeline_item.active = false; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) nodes[| i].disable(); + for( var i = 0, n = array_length(nodes); i < n; i++ ) nodes[i].disable(); } #endregion static attributeSerialize = function() { #region diff --git a/scripts/node_collection_inline/node_collection_inline.gml b/scripts/node_collection_inline/node_collection_inline.gml index fc2bc6420..abd76bcb9 100644 --- a/scripts/node_collection_inline/node_collection_inline.gml +++ b/scripts/node_collection_inline/node_collection_inline.gml @@ -1,6 +1,6 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { attributes.members = []; - nodes = ds_list_create(); + nodes = []; group_vertex = []; group_dragging = false; group_adding = false; @@ -27,7 +27,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c static removeNode = function(node) { #region array_remove(attributes.members, node.node_id); - ds_list_remove(nodes, node); + array_remove(nodes, node); if(node.inline_context == self) node.inline_context = noone; @@ -42,9 +42,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c node.inline_context = self; array_push_unique(attributes.members, node.node_id); - - if(!ds_list_exist(nodes, node)) - ds_list_add(nodes, node); + array_push_unique(nodes, node); onAddNode(node); } #endregion @@ -77,7 +75,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c } #endregion static refreshMember = function() { #region - ds_list_clear(nodes); + nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { @@ -93,8 +91,8 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c var _hash = ""; var _ind = 0; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var _node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _node = nodes[i]; if(!_node.active) continue; _hash += $"{_node.x},{_node.y},{_node.w},{_node.h}|"; _ind++; @@ -116,8 +114,8 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c var _vtrx = array_create(_ind * 4 * (90 / 30 + 1)); var _ind = 0; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var _node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _node = nodes[i]; if(!_node.active) continue; _ind = getNodeBorder(_ind, _vtrx, _node); } @@ -228,8 +226,8 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c setRenderStatus(false); if(_clearCache) clearInputCache(); - for( var i = 0; i < ds_list_size(nodes); i++ ) - nodes[| i].resetRender(_clearCache); + for( var i = 0; i < array_length(nodes); i++ ) + nodes[i].resetRender(_clearCache); } #endregion static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 24aa31ec6..091710954 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -28,12 +28,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { destroy_when_upgroup = false; var l = _group == noone? PROJECT.nodes : _group.getNodeList(); - ds_list_add(l, self); + array_push(l, self); active_index = -1; active_range = [ 0, TOTAL_FRAMES - 1 ]; - array_push(PROJECT.nodeArray, self); + array_push(PROJECT.allNodes, self); inline_context = noone; inline_parent_object = ""; @@ -261,7 +261,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { #region ---- timeline ---- timeline_item = new timelineItemNode(self); - anim_priority = ds_map_size(PROJECT.nodeMap); + anim_priority = array_length(PROJECT.allNodes); is_anim_timeline = false; #endregion @@ -901,7 +901,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _inp = inputs[| i].value_from; // print($"Checking isLeafList {inputs[| i]} < {_inp} | list {ds_list_to_array(list)}"); - if(_inp != noone && ds_list_exist(list, _inp.node)) + if(_inp != noone && array_exists(list, _inp.node)) return false; } @@ -1915,8 +1915,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { return; } - for( var i = 0; i < ds_list_size(group.nodes); i++ ) - group.nodes[| i].isTool = false; + for( var i = 0; i < array_length(group.nodes); i++ ) + group.nodes[i].isTool = false; isTool = true; } #endregion @@ -2234,7 +2234,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(!active) return; disable(); - ds_list_remove(group == noone? PROJECT.nodes : group.getNodeList(), self); + array_remove(group == noone? PROJECT.nodes : group.getNodeList(), self); if(PANEL_GRAPH.node_hover == self) PANEL_GRAPH.node_hover = noone; PANEL_GRAPH.nodes_selecting = []; @@ -2284,7 +2284,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(active) return; enable(); - ds_list_add(group == noone? PROJECT.nodes : group.getNodeList(), self); + array_push(group == noone? PROJECT.nodes : group.getNodeList(), self); onRestore(); if(group) group.refreshNodes(); diff --git a/scripts/node_dynasurf/node_dynasurf.gml b/scripts/node_dynasurf/node_dynasurf.gml index 3415e26cc..38f35ef0f 100644 --- a/scripts/node_dynasurf/node_dynasurf.gml +++ b/scripts/node_dynasurf/node_dynasurf.gml @@ -51,8 +51,8 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) rendered = result; if(result) - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var _n = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _n = nodes[i]; if(!is_instanceof(_n, Node_DynaSurf_Out) && !is_instanceof(_n, Node_DynaSurf_Out_Width) && @@ -73,8 +73,8 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) static setDynamicSurface = function() { #region var _dyna = new compute_dynaSurf(); - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var _n = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _n = nodes[i]; if(is_instanceof(_n, Node_DynaSurf_Out)) _dyna.drawFn = _n.outputs[| 0].getValue(); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index fd7a95633..a09e5fd8e 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -21,12 +21,8 @@ MPEG-4 (.mp4)|*.mp4", function exportAll() { if(IS_RENDERING) return; - var key = ds_map_find_first(PROJECT.nodeMap); - - repeat(ds_map_size(PROJECT.nodeMap)) { - var node = PROJECT.nodeMap[? key]; - key = ds_map_find_next(PROJECT.nodeMap, key); - + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var node = PROJECT.allNodes[i]; if(!node.active) continue; if(!is_instanceof(node, Node_Export)) continue; diff --git a/scripts/node_functions/node_functions.gml b/scripts/node_functions/node_functions.gml index 31e8e3fe4..1a5b9cb0c 100644 --- a/scripts/node_functions/node_functions.gml +++ b/scripts/node_functions/node_functions.gml @@ -164,14 +164,13 @@ } function nodeCleanUp() { - var key = ds_map_find_first(PROJECT.nodeMap); - repeat(ds_map_size(PROJECT.nodeMap)) { - if(PROJECT.nodeMap[? key]) { - PROJECT.nodeMap[? key].active = false; - PROJECT.nodeMap[? key].cleanUp(); - delete PROJECT.nodeMap[? key]; - } - key = ds_map_find_next(PROJECT.nodeMap, key); + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var _node = PROJECT.allNodes[i]; + + if(!is_struct(_node)) continue; + _node.active = false; + _node.cleanUp(); + delete _node; } ds_map_clear(APPEND_MAP); @@ -185,16 +184,12 @@ function refreshNodeMap() { ds_map_clear(PROJECT.nodeNameMap); - var key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); - repeat(amo) { - var node = PROJECT.nodeMap[? key]; + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var node = PROJECT.allNodes[i]; if(node.internalName != "") PROJECT.nodeNameMap[? node.internalName] = node; - - key = ds_map_find_next(PROJECT.nodeMap, key); } } diff --git a/scripts/node_iterate_each_inline/node_iterate_each_inline.gml b/scripts/node_iterate_each_inline/node_iterate_each_inline.gml index 657160eda..ad0a1e467 100644 --- a/scripts/node_iterate_each_inline/node_iterate_each_inline.gml +++ b/scripts/node_iterate_each_inline/node_iterate_each_inline.gml @@ -30,7 +30,7 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli APPEND_MAP[? CLONING_GROUP.input_node.node_id] = input; APPEND_MAP[? CLONING_GROUP.output_node.node_id] = output; - ds_list_add(APPEND_LIST, input, output); + array_push(APPEND_LIST, input, output); } } #endregion @@ -60,7 +60,7 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli } #endregion static refreshMember = function() { #region - ds_list_clear(nodes); + nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { @@ -71,7 +71,7 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli var _node = PROJECT.nodeMap[? attributes.members[i]]; _node.inline_context = self; - ds_list_add(nodes, _node); + array_push(nodes, _node); if(is_instanceof(_node, Node_Iterator_Each_Inline_Input)) { input_node = _node; diff --git a/scripts/node_iterate_filter/node_iterate_filter.gml b/scripts/node_iterate_filter/node_iterate_filter.gml index 94ca8b160..6357c1e43 100644 --- a/scripts/node_iterate_filter/node_iterate_filter.gml +++ b/scripts/node_iterate_filter/node_iterate_filter.gml @@ -28,8 +28,8 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr var _int = noone; var _oup = noone; - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var _n = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _n = nodes[i]; if(is_instanceof(_n, Node_Iterator_Filter_Input)) _int = _n; diff --git a/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml b/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml index 4d40500a5..6155ef0dd 100644 --- a/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml +++ b/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml @@ -29,7 +29,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In APPEND_MAP[? CLONING_GROUP.input_node.node_id] = input; APPEND_MAP[? CLONING_GROUP.output_node.node_id] = output; - ds_list_add(APPEND_LIST, input, output); + array_push(APPEND_LIST, input, output); } } #endregion @@ -58,7 +58,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In } #endregion static refreshMember = function() { #region - ds_list_clear(nodes); + nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { @@ -68,7 +68,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In var _node = PROJECT.nodeMap[? attributes.members[i]]; _node.inline_context = self; - ds_list_add(nodes, _node); + array_push(nodes, _node); if(is_instanceof(_node, Node_Iterator_Filter_Inline_Input)) { input_node = _node; diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index f7e1928b4..9ee9e4078 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -11,7 +11,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone ); - topoList = ds_list_create(); + topoList = []; custom_input_index = ds_list_size(inputs); custom_output_index = ds_list_size(inputs); @@ -35,8 +35,8 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr } #endregion static isActiveDynamic = function(frame = CURRENT_FRAME) { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) - if(nodes[| i].isActiveDynamic(frame)) return true; + for( var i = 0, n = array_length(nodes); i < n; i++ ) + if(nodes[i].isActiveDynamic(frame)) return true; return false; } #endregion @@ -63,8 +63,8 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr var _typ = inputs[| 0].type; - for( var i = 0; i < ds_list_size(nodes); i++ ) { - var _n = nodes[| i]; + for( var i = 0; i < array_length(nodes); i++ ) { + var _n = nodes[i]; if(!struct_has(_n.attributes, "sort_inputs")) continue; switch(_n.attributes.sort_inputs) { @@ -83,7 +83,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr inputReady += 2; break; case 9 : - outputNode = nodes[| i].inputs[| 0]; + outputNode = nodes[i].inputs[| 0]; inputReady += 4; break; } diff --git a/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml b/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml index e8e12bde3..001a8c959 100644 --- a/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml +++ b/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml @@ -3,7 +3,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli color = COLORS.node_blend_loop; is_root = false; - topoList = ds_list_create(); + topoList = []; input_node = noone; output_node = noone; @@ -31,13 +31,13 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli APPEND_MAP[? CLONING_GROUP.input_node.node_id] = input; APPEND_MAP[? CLONING_GROUP.output_node.node_id] = output; - ds_list_add(APPEND_LIST, input, output); + array_push(APPEND_LIST, input, output); } } #endregion static isActiveDynamic = function(frame = CURRENT_FRAME) { #region - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) - if(nodes[| i].isActiveDynamic(frame)) return true; + for( var i = 0, n = array_length(nodes); i < n; i++ ) + if(nodes[i].isActiveDynamic(frame)) return true; return false; } #endregion @@ -47,7 +47,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli } #endregion static refreshMember = function() { #region - ds_list_clear(nodes); + nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { @@ -57,7 +57,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli var _node = PROJECT.nodeMap[? attributes.members[i]]; _node.inline_context = self; - ds_list_add(nodes, _node); + array_push(nodes, _node); if(is_instanceof(_node, Node_Iterator_Sort_Inline_Input)) { input_node = _node; @@ -153,8 +153,6 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli if(input_node.inputs[| 0].value_from == noone) return; - //print($"=============== STARTING SORT with {ds_list_size(topoList)}/{ds_list_size(nodes)} nodes ===============") - var arrIn = input_node.inputs[| 0].getValue(); var arrOut = output_node.outputs[| 0].getValue(); diff --git a/scripts/node_pixel_builder/node_pixel_builder.gml b/scripts/node_pixel_builder/node_pixel_builder.gml index 23516d737..e4f8f97d6 100644 --- a/scripts/node_pixel_builder/node_pixel_builder.gml +++ b/scripts/node_pixel_builder/node_pixel_builder.gml @@ -33,8 +33,8 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g } #endregion static checkComplete = function() { #region - for( var i = 0; i < ds_list_size(nodes); i++ ) - if(!nodes[| i].rendered) return []; + for( var i = 0; i < array_length(nodes); i++ ) + if(!nodes[i].rendered) return []; buildPixel(); @@ -56,8 +56,8 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g var _dim = getInputData(0); var _surfs = ds_map_create(); - for( var i = 0; i < ds_list_size(nodes); i++ ) { - var _n = nodes[| i]; + for( var i = 0; i < array_length(nodes); i++ ) { + var _n = nodes[i]; for( var j = 0; j < ds_list_size(_n.outputs); j++ ) { var _out = _n.outputs[| j]; diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index 05cb3a13f..6ae66051d 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -178,8 +178,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(gr == noone) return; if(previewing == 0) { - for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { - var _node = gr.nodes[| i]; + for( var i = 0, n = array_length(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny); active &= _hov; diff --git a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml index c81e88953..5ce99c01d 100644 --- a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml +++ b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml @@ -54,8 +54,8 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group if(inline_context != noone) gr = inline_context; if(attributes.show_objects && gr != noone) - for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { - var _node = gr.nodes[| i]; + for( var i = 0, n = array_length(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !_hov; diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 1fe6067f3..e6de1f34e 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -44,8 +44,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(gr == noone) return; if(!attributes.show_objects) return; - for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { - var _node = gr.nodes[| i]; + for( var i = 0, n = array_length(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !_hov; diff --git a/scripts/node_rigid_render_output/node_rigid_render_output.gml b/scripts/node_rigid_render_output/node_rigid_render_output.gml index 40c4ecc54..f10e691b0 100644 --- a/scripts/node_rigid_render_output/node_rigid_render_output.gml +++ b/scripts/node_rigid_render_output/node_rigid_render_output.gml @@ -54,8 +54,8 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x if(gr == noone) return; if(!attributes.show_objects) return; - for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { - var _node = gr.nodes[| i]; + for( var i = 0, n = array_length(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !_hov; diff --git a/scripts/node_smoke_group/node_smoke_group.gml b/scripts/node_smoke_group/node_smoke_group.gml index b7b767396..77b49e35f 100644 --- a/scripts/node_smoke_group/node_smoke_group.gml +++ b/scripts/node_smoke_group/node_smoke_group.gml @@ -63,8 +63,8 @@ function Node_Smoke_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro } static update = function() { - for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { - var node = nodes[| i]; + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var node = nodes[i]; if(node.cacheExist()) node.cachedPropagate(); } diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index f8fd5696b..1e9f4aa24 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -1992,10 +1992,8 @@ function Panel_Animation() : PanelContent() constructor { TOTAL_FRAMES = len; if(_len != len) { - var key = ds_map_find_first(PROJECT.nodeMap); - repeat(ds_map_size(PROJECT.nodeMap)) { - var _node = PROJECT.nodeMap[? key]; - key = ds_map_find_next(PROJECT.nodeMap, key); + for (var m = 0, n = array_length(PROJECT.allNodes); m < n; m++) { + var _node = PROJECT.allNodes[m]; if(!_node || !_node.active) continue; for(var i = 0; i < ds_list_size(_node.inputs); i++) { diff --git a/scripts/panel_animation_scaler/panel_animation_scaler.gml b/scripts/panel_animation_scaler/panel_animation_scaler.gml index bb3f9728a..91745307c 100644 --- a/scripts/panel_animation_scaler/panel_animation_scaler.gml +++ b/scripts/panel_animation_scaler/panel_animation_scaler.gml @@ -22,10 +22,10 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor { static scale = function() { var fac = scale_to / TOTAL_FRAMES; - var key = ds_map_find_first(PROJECT.nodeMap); - repeat(ds_map_size(PROJECT.nodeMap)) { - var _node = PROJECT.nodeMap[? key]; - key = ds_map_find_next(PROJECT.nodeMap, key); + + for (var k = 0, n = array_length(PROJECT.allNodes); k < n; k++) { + var _node = PROJECT.allNodes[k]; + if(!_node || !_node.active) continue; for(var i = 0; i < ds_list_size(_node.inputs); i++) { @@ -37,6 +37,7 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor { } } } + TOTAL_FRAMES = scale_to; close(); } diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 5fe7821f1..0ab60611f 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -145,15 +145,15 @@ function Panel_Collection() : PanelContent() constructor { contentPane = new scrollPane(content_w - ui(6), content_h, function(_y, _m) { #region draw_clear_alpha(c_white, 0); - var nodes; + var content; var steamNode = []; if(mode == 0) { if(!COLLECTIONS.scanned) COLLECTIONS.scan([".json", ".pxcc"]); - if(context == root) nodes = STEAM_COLLECTION; - else nodes = context.content; + if(context == root) content = STEAM_COLLECTION; + else content = context.content; for( var i = 0; i < ds_list_size(STEAM_COLLECTION); i++ ) { var meta = STEAM_COLLECTION[| i].meta; @@ -162,15 +162,15 @@ function Panel_Collection() : PanelContent() constructor { } } else if(mode == 1) { - nodes = context.content; + content = context.content; } else if(mode == 2) { - nodes = context; + content = context; } - if(search_string != "") nodes = search_list; + if(search_string != "") content = search_list; - var node_list = ds_list_size(nodes); + var node_list = ds_list_size(content); var node_count = node_list + array_length(steamNode); var frame = PREFERENCES.collection_animated? current_time * PREFERENCES.collection_preview_speed / 3000 : 0; var _cw = contentPane.surface_w; @@ -200,7 +200,7 @@ function Panel_Collection() : PanelContent() constructor { var index = i * col + j; if(index >= node_count) break; - var _node = index < node_list? nodes[| index] : steamNode[index - node_list]; + var _node = index < node_list? content[| index] : steamNode[index - node_list]; var _nx = grid_space + (grid_width + grid_space) * j; var _boxx = _nx + (grid_width - grid_size) / 2; _boxx = round(_boxx); @@ -293,7 +293,7 @@ function Panel_Collection() : PanelContent() constructor { hh += list_height; for(var i = 0; i < node_count; i++) { - var _node = i < node_list? nodes[| i] : steamNode[i - node_list]; + var _node = i < node_list? content[| i] : steamNode[i - node_list]; if(!_node) continue; if(yy + list_height >= 0 && yy <= contentPane.surface_h) { diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 0b1145aa0..bb1232a82 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -55,7 +55,7 @@ function panel_graph_add_display() { CALL("graph_add_disp"); PANEL_GRAPH.createNodeHotkey("Node_Display_Text"); } function panel_graph_add_transform() { CALL("graph_add_transform"); PANEL_GRAPH.doTransform(); } - function panel_graph_select_all() { CALL("graph_select_all"); PANEL_GRAPH.nodes_selecting = ds_list_to_array(PANEL_GRAPH.nodes_list); } + function panel_graph_select_all() { CALL("graph_select_all"); PANEL_GRAPH.nodes_selecting = PANEL_GRAPH.nodes_list; } function panel_graph_toggle_grid() { CALL("graph_toggle_grid"); PANEL_GRAPH.display_parameter.show_grid = !PANEL_GRAPH.display_parameter.show_grid; } function panel_graph_toggle_preview() { CALL("graph_toggle_preview"); PANEL_GRAPH.setTriggerPreview(); } function panel_graph_toggle_parameter() { CALL("graph_toggle_parameter"); PANEL_GRAPH.setTriggerParameter(); } @@ -227,7 +227,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { #endregion #region ---- nodes ---- - node_context = ds_list_create(); + node_context = []; node_dragging = noone; node_drag_mx = 0; @@ -299,10 +299,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { toolbar_height = ui(40); - function toCenterNode(_list = nodes_list) { #region + function toCenterNode(_arr = nodes_list) { #region if(!project.active) return; - if(ds_list_empty(_list)) { + if(array_empty(_arr)) { graph_x = round(w / 2 / graph_s); graph_y = round(h / 2 / graph_s); return; @@ -313,8 +313,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var miny = 99999; var maxy = -99999; - for(var i = 0; i < ds_list_size(_list); i++) { - var _node = _list[| i]; + for(var i = 0; i < array_length(_arr); i++) { + var _node = _arr[i]; if(!is_struct(_node) || !is_instanceof(_node, Node) || !_node.active) continue; @@ -544,12 +544,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { _blend.inputs[| 1].setFrom(_canvas.outputs[| 0]); } #endregion - function getFocusingNode() { INLINE return array_empty(nodes_selecting)? noone : nodes_selecting[0]; } + function getFocusingNode() { return array_empty(nodes_selecting)? noone : nodes_selecting[0]; } - function getCurrentContext() { #region - if(ds_list_empty(node_context)) return noone; - return node_context[| ds_list_size(node_context) - 1]; - } #endregion + function getCurrentContext() { return array_empty(node_context)? noone : node_context[array_length(node_context) - 1]; } function getNodeList(cont = getCurrentContext()) { #region return cont == noone? project.nodes : cont.getNodeList(); @@ -575,8 +572,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var graph = new Panel_Graph(project); panel.setContent(graph, true); - for( var i = 0; i < ds_list_size(node_context); i++ ) - graph.addContext(node_context[| i]); + for( var i = 0; i < array_length(node_context); i++ ) + graph.addContext(node_context[i]); graph.addContext(group); setFocus(panel); @@ -714,10 +711,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { function fullView() { #region INLINE - var _l = ds_list_create_from_array(nodes_selecting); - toCenterNode(array_empty(nodes_selecting)? nodes_list : _l); - ds_list_destroy(_l); - + toCenterNode(array_empty(nodes_selecting)? nodes_list : node_selecting); graph_s_to = 1; } #endregion @@ -846,7 +840,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { //// =========== Context ========== function resetContext() { #region - ds_list_clear(node_context); + node_context = []; nodes_list = project.nodes; toCenterNode(); } #endregion @@ -856,7 +850,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { setContextFrame(false, _node); nodes_list = _node.nodes; - ds_list_add(node_context, _node); + array_push(node_context, _node); node_dragging = noone; nodes_selecting = []; @@ -1000,8 +994,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var gr_y = graph_y * graph_s; var _hov = false; - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var h = nodes_list[| i].drawPreviewBackground(gr_x, gr_y, mx, my, graph_s); + for(var i = 0; i < array_length(nodes_list); i++) { + var h = nodes_list[i].drawPreviewBackground(gr_x, gr_y, mx, my, graph_s); _hov |= h; } @@ -1028,16 +1022,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { _frame_hovering = frame_hovering; frame_hovering = noone; - for(var i = 0; i < ds_list_size(nodes_list); i++) { - nodes_list[| i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); - nodes_list[| i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); + for(var i = 0; i < array_length(nodes_list); i++) { + nodes_list[i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); + nodes_list[i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); } printIf(log, $"Predraw time: {get_timer() - t}"); t = get_timer(); #region draw frame - for(var i = 0; i < ds_list_size(nodes_list); i++) { - if(nodes_list[| i].drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter)) - frame_hovering = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + if(nodes_list[i].drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter)) + frame_hovering = nodes_list[i]; } #endregion printIf(log, $"Frame draw time: {get_timer() - t}"); t = get_timer(); @@ -1045,8 +1039,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { #region hover node_hovering = noone; if(pHOVER) - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + var _node = nodes_list[i]; _node.branch_drawing = false; if(_node.pointIn(gr_x, gr_y, mx, my, graph_s)) node_hovering = _node; @@ -1100,8 +1094,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { nodes_selecting = [ node_hovering ]; if(!key_mod_press(CTRL)) - for(var i = 0; i < ds_list_size(nodes_list); i++) { //select content - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { //select content + var _node = nodes_list[i]; if(_node == node_hovering) continue; if(!_node.selectable) continue; @@ -1286,13 +1280,13 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { param.active = hoverable; param.setPos(gr_x, gr_y, graph_s, mx, my); param.setBoundary(-64, -64, w + 64, h + 64); - param.setProp(ds_list_size(nodes_list), display_parameter.highlight); + param.setProp(array_length(nodes_list), display_parameter.highlight); param.setDraw(aa, bg_color); - for(var i = 0; i < ds_list_size(nodes_list); i++) { + for(var i = 0; i < array_length(nodes_list); i++) { param.cur_layer = i + 1; - var _hov = nodes_list[| i].drawConnections(param); + var _hov = nodes_list[i].drawConnections(param); if(_hov != noone && is_struct(_hov)) hov = _hov; } @@ -1336,11 +1330,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { #region draw node var t = get_timer(); - for(var i = 0; i < ds_list_size(nodes_list); i++) - nodes_list[| i].drawNodeBehind(gr_x, gr_y, mx, my, graph_s); + for(var i = 0; i < array_length(nodes_list); i++) + nodes_list[i].drawNodeBehind(gr_x, gr_y, mx, my, graph_s); - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + var _node = nodes_list[i]; if(is_instanceof(_node, Node_Frame)) continue; try { @@ -1354,8 +1348,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } } - for(var i = 0; i < ds_list_size(nodes_list); i++) - nodes_list[| i].drawBadge(gr_x, gr_y, graph_s); + for(var i = 0; i < array_length(nodes_list); i++) + nodes_list[i].drawBadge(gr_x, gr_y, graph_s); if(PANEL_INSPECTOR && PANEL_INSPECTOR.prop_hover != noone) value_focus = PANEL_INSPECTOR.prop_hover; @@ -1366,8 +1360,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(mouse_press(mb_left)) node_dragging = noone; - for(var i = 0; i < ds_list_size(nodes_list); i++) - nodes_list[| i].groupCheck(gr_x, gr_y, graph_s, mx, my); + for(var i = 0; i < array_length(nodes_list); i++) + nodes_list[i].groupCheck(gr_x, gr_y, graph_s, mx, my); if(node_dragging && !key_mod_press(ALT)) { var nx = node_drag_sx + (mouse_graph_x - node_drag_mx); @@ -1454,8 +1448,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(nodes_select_drag == 2) { draw_sprite_stretched_points_clamp(THEME.ui_selection, 0, nodes_select_mx, nodes_select_my, mx, my, COLORS._main_accent); - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + var _node = nodes_list[i]; if(!_node.selectable) continue; if(is_instanceof(_node, Node_Frame) && !nodes_select_frame) continue; @@ -1752,8 +1746,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var gr_x = graph_x * graph_s; var gr_y = graph_y * graph_s; - for(var i = 0; i < ds_list_size(nodes_list); i++) - nodes_list[| i].drawJunctionNames(gr_x, gr_y, mx, my, graph_s); + for(var i = 0; i < array_length(nodes_list); i++) + nodes_list[i].drawJunctionNames(gr_x, gr_y, mx, my, graph_s); } #endregion @@ -1778,37 +1772,34 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var bh = toolbar_height - ui(12); var tbh = h - toolbar_height / 2; - for(var i = -1; i < ds_list_size(node_context); i++) { + for(var i = -1; i < array_length(node_context); i++) { if(i == -1) { tt = __txt("Global"); } else { - var _cnt = node_context[| i]; + var _cnt = node_context[i]; tt = _cnt.renamed? _cnt.display_name : _cnt.name; } tw = string_width(tt); th = string_height(tt); - if(i < ds_list_size(node_context) - 1) { + if(i < array_length(node_context) - 1) { if(buttonInstant(THEME.button_hide_fill, xx - ui(6), tbh - bh / 2, tw + ui(12), bh, [mx, my], pFOCUS, pHOVER) == 2) { node_hover = noone; nodes_selecting = []; PANEL_PREVIEW.resetNodePreview(); - setContextFrame(true, node_context[| i + 1]); - var _nodeFocus = node_context[| i + 1]; + setContextFrame(true, node_context[i + 1]); + var _nodeFocus = node_context[i + 1]; if(i == -1) resetContext(); else { - for(var j = ds_list_size(node_context) - 1; j > i; j--) - ds_list_delete(node_context, j); - nodes_list = node_context[| i].getNodeList(); + array_resize(node_context, i + 1); + nodes_list = node_context[i].getNodeList(); } nodes_selecting = [ _nodeFocus ]; - var _l = ds_list_create_from_array(nodes_selecting) - toCenterNode(_l); - ds_list_destroy(_l); + toCenterNode(nodes_selecting); break; } @@ -1816,7 +1807,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } draw_set_color(COLORS._main_text); - draw_set_alpha(i < ds_list_size(node_context) - 1? 0.33 : 1); + draw_set_alpha(i < array_length(node_context) - 1? 0.33 : 1); draw_text(xx, tbh, tt); draw_set_alpha(1); xx += tw; @@ -1877,14 +1868,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { surface_set_target(minimap_surface); draw_clear_alpha(COLORS.panel_bg_clear_inner, 0.75); - if(!ds_list_empty(nodes_list)) { + if(!array_empty(nodes_list)) { var minx = 99999; var maxx = -99999; var miny = 99999; var maxy = -99999; - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + var _node = nodes_list[i]; minx = min(_node.x - 32, minx); maxx = max(_node.x + _node.w + 32, maxx); @@ -1899,8 +1890,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var ss = min(minimap_w / spw, minimap_h / sph); draw_set_alpha(0.4); - for(var i = 0; i < ds_list_size(nodes_list); i++) { - var _node = nodes_list[| i]; + for(var i = 0; i < array_length(nodes_list); i++) { + var _node = nodes_list[i]; var nx = minimap_w / 2 + (_node.x - cx) * ss; var ny = minimap_h / 2 + (_node.y - cy) * ss; @@ -2113,7 +2104,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { _map.nodes = _node; ds_map_clear(APPEND_MAP); - ds_list_clear(APPEND_LIST); + APPEND_LIST = []; CLONING = true; var _pmap_keys = variable_struct_get_names(_pmap); @@ -2128,10 +2119,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } APPEND_LIST = __APPEND_MAP(_map,, APPEND_LIST); - recordAction(ACTION_TYPE.collection_loaded, array_create_from_list(APPEND_LIST)); + recordAction(ACTION_TYPE.collection_loaded, array_clone(APPEND_LIST)); CLONING = false; - if(ds_list_size(APPEND_LIST) == 0) return; + if(array_empty(APPEND_LIST)) return; for(var i = 0; i < array_length(nodes_selecting); i++) { var _orignal = nodes_selecting[i]; @@ -2148,19 +2139,19 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var x0 = 99999999; var y0 = 99999999; - for(var i = 0; i < ds_list_size(APPEND_LIST); i++) { - var _node = APPEND_LIST[| i]; + for(var i = 0; i < array_length(APPEND_LIST); i++) { + var _node = APPEND_LIST[i]; x0 = min(x0, _node.x); y0 = min(y0, _node.y); } - node_dragging = APPEND_LIST[| 0]; + node_dragging = APPEND_LIST[0]; node_drag_mx = x0; node_drag_my = y0; node_drag_sx = x0; node_drag_sy = y0; node_drag_ox = x0; node_drag_oy = y0; - nodes_selecting = array_create_from_list(APPEND_LIST); + nodes_selecting = APPEND_LIST; } #endregion function doInstance() { #region @@ -2215,26 +2206,24 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(_app == noone) return; - if(ds_list_size(_app) == 0) { - ds_list_destroy(_app); + if(array_empty(_app)) return; - } var x0 = 99999999; var y0 = 99999999; - for(var i = 0; i < ds_list_size(_app); i++) { - var _node = _app[| i]; + for(var i = 0; i < array_length(_app); i++) { + var _node = _app[i]; x0 = min(x0, _node.x); y0 = min(y0, _node.y); } - node_dragging = _app[| 0]; + node_dragging = _app[0]; node_drag_mx = x0; node_drag_my = y0; node_drag_sx = x0; node_drag_sy = y0; node_drag_ox = x0; node_drag_oy = y0; - nodes_selecting = array_create_from_list(_app); + nodes_selecting = _app; return; } @@ -2501,25 +2490,25 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var app = APPEND(DRAGGING.data.path, getCurrentContext()); - if(!is_struct(app) && ds_exists(app, ds_type_list)) { + if(is_array(app)) { var cx = 0; var cy = 0; + var amo = array_length(app); - for( var i = 0; i < ds_list_size(app); i++ ) { - cx += app[| i].x; - cy += app[| i].y; + for( var i = 0; i < amo; i++ ) { + cx += app[i].x; + cy += app[i].y; } - cx /= ds_list_size(app); - cy /= ds_list_size(app); + cx /= amo; + cy /= amo; - for( var i = 0; i < ds_list_size(app); i++ ) { - app[| i].x = app[| i].x - cx + mouse_grid_x; - app[| i].y = app[| i].y - cy + mouse_grid_y; + for( var i = 0; i < amo; i++ ) { + app[i].x = app[i].x - cx + mouse_grid_x; + app[i].y = app[i].y - cy + mouse_grid_y; } - ds_list_destroy(app); - } else { + } else if(is_struct(app) && is_instanceof(app, Node)) { app.x = mouse_grid_x; app.y = mouse_grid_y; } @@ -2538,10 +2527,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } #endregion static bringNodeToFront = function(node) { #region - if(!ds_list_exist(nodes_list, node)) return; + if(!array_exists(nodes_list, node)) return; - ds_list_remove(nodes_list, node); - ds_list_add(nodes_list, node); + array_remove(nodes_list, node); + array_push(nodes_list, node); } #endregion static onFullScreen = function() { run_in(1, fullView); } diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 0d50e85c1..43dc455f7 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -151,10 +151,8 @@ function Panel_Menu() : PanelContent() constructor { }, [ THEME.sequence_control, 1 ], ["", "Render all"]), menuItem(__txtx("panel_menu_execute_exports", "Execute all export nodes"), function() { - var key = ds_map_find_first(PROJECT.nodeMap); - repeat(ds_map_size(PROJECT.nodeMap)) { - var node = PROJECT.nodeMap[? key]; - key = ds_map_find_next(PROJECT.nodeMap, key); + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var node = PROJECT.allNodes[i]; if(!node.active) continue; if(instanceof(node) != "Node_Export") continue; diff --git a/scripts/panel_nodes/panel_nodes.gml b/scripts/panel_nodes/panel_nodes.gml index a8c017730..6649ff4ae 100644 --- a/scripts/panel_nodes/panel_nodes.gml +++ b/scripts/panel_nodes/panel_nodes.gml @@ -25,14 +25,14 @@ function Panel_Nodes() : PanelContent() constructor { sc_nodes.resize(w - ui(padding + padding), h - ui(padding + title_height + 40)); } - function drawNodeList(_list, _x0, _x1, _y, _m) { + function drawNodeList(_arr, _x0, _x1, _y, _m) { var ww = sc_nodes.surface_w; var hg = ui(28); var _h = 0; - for( var i = 0; i < ds_list_size(_list); i++ ) { - var node = _list[| i]; + for( var i = 0; i < array_length(_arr); i++ ) { + var node = _arr[i]; var name = node.renamed? node.display_name : node.name; if(string_lower(search_string) != "" && string_lower(string_pos(search_string, name)) == 0) diff --git a/scripts/panel_tunnels/panel_tunnels.gml b/scripts/panel_tunnels/panel_tunnels.gml index b4bb3aea6..d96885e3b 100644 --- a/scripts/panel_tunnels/panel_tunnels.gml +++ b/scripts/panel_tunnels/panel_tunnels.gml @@ -16,15 +16,11 @@ function Panel_Tunnels() : PanelContent() constructor { tunnel_hover = noone; function scanNodes() { - var amo = ds_map_size(PROJECT.nodeMap); - var k = ds_map_find_first(PROJECT.nodeMap); - tunnel_ins = []; - repeat(amo) { - var node = PROJECT.nodeMap[? k]; - k = ds_map_find_next(PROJECT.nodeMap, k); - + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var node = PROJECT.allNodes[i]; + if(instanceof(node) == "Node_Tunnel_In") array_push(tunnel_ins, node); } diff --git a/scripts/project_data/project_data.gml b/scripts/project_data/project_data.gml index bc059ab43..fcd0edc9e 100644 --- a/scripts/project_data/project_data.gml +++ b/scripts/project_data/project_data.gml @@ -8,20 +8,20 @@ active = true; /// @is {bool} meta = __getdefaultMetaData(); - path = ""; /// @is {string} + path = ""; /// @is {string} thumbnail = ""; - version = SAVE_VERSION; /// @is {number} - seed = irandom_range(100000, 999999); /// @is {number} + version = SAVE_VERSION; /// @is {number} + seed = irandom_range(100000, 999999); /// @is {number} modified = false; /// @is {bool} - readonly = false; /// @is {bool} + readonly = false; /// @is {bool} safeMode = false; - nodes = ds_list_create(); - nodeArray = []; + allNodes = []; + nodes = []; + nodeTopo = []; nodeMap = ds_map_create(); nodeNameMap = ds_map_create(); - nodeTopo = ds_list_create(); animator = new AnimationManager(); globalNode = new Node_Global(); @@ -132,14 +132,11 @@ notes = []; static cleanup = function() { #region - if(!ds_map_empty(nodeMap)) - array_map(ds_map_keys_to_array(nodeMap), function(_key, _ind) { - var _node = nodeMap[? _key]; - _node.active = false; - _node.cleanUp(); - }); + array_foreach(allNodes, function(_node) { + _node.active = false; + _node.cleanUp(); + }); - ds_list_destroy(nodes); ds_map_destroy(nodeMap); ds_map_destroy(nodeNameMap); diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index a7e093c46..f31c770fe 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -18,42 +18,37 @@ enum RENDER_TYPE { function ResetAllNodesRender() { #region LOG_IF(global.FLAG.render == 1, $"XXXXXXXXXXXXXXXXXXXX RESETTING ALL NODES [frame {CURRENT_FRAME}] XXXXXXXXXXXXXXXXXXXX"); - var _key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); - - repeat(amo) { - var _node = PROJECT.nodeMap[? _key]; + array_foreach(PROJECT.allNodes, function(_node) { _node.setRenderStatus(false); - for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ ) _node.inputs[| i].resetCache(); - - _key = ds_map_find_next(PROJECT.nodeMap, _key); - } + return 0; + }); + } #endregion function NodeTopoSort() { #region LOG_IF(global.FLAG.render == 1, $"======================= RESET TOPO =======================") - var _key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); + var amo = array_length(PROJECT.allNodes); var _t = get_timer(); - repeat(amo) { - var _node = PROJECT.nodeMap[? _key]; + array_foreach(PROJECT.allNodes, function(_node) { _node.clearTopoSorted(); - _key = ds_map_find_next(PROJECT.nodeMap, _key); - } + return 0; + }); - ds_list_clear(PROJECT.nodeTopo); + PROJECT.nodeTopo = []; __topoSort(PROJECT.nodeTopo, PROJECT.nodes); - LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort Completed: {ds_list_size(PROJECT.nodeTopo)}/{amo} nodes sorted in {(get_timer() - _t) / 1000} ms +++++++"); + LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort Completed: {array_length(PROJECT.nodeTopo)}/{amo} nodes sorted in {(get_timer() - _t) / 1000} ms +++++++"); } #endregion function NodeListSort(_list, _nodeList) { #region - for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ ) - _nodeList[| i].clearTopoSorted(); + array_foreach(_nodeList, function(node) { + node.clearTopoSorted(); + return 0; + }); // print($"===================== NODE LIST SORT =====================") @@ -61,7 +56,7 @@ function NodeListSort(_list, _nodeList) { #region __topoSort(_list, _nodeList); } #endregion -function __sortNode(_list, _node) { #region +function __sortNode(_arr, _node) { #region if(_node.topoSorted) return; var _parents = []; @@ -77,27 +72,27 @@ function __sortNode(_list, _node) { #region // print($" > Checking {_node.name}: {array_length(_parents)}"); if(is_instanceof(_node, Node_Collection) && !_node.managedRenderOrder) - __topoSort(_list, _node.nodes); + __topoSort(_arr, _node.nodes); for( var i = 0, n = array_length(_parents); i < n; i++ ) - __sortNode(_list, _parents[i]); + __sortNode(_arr, _parents[i]); if(!_node.topoSorted) { - ds_list_add(_list, _node); + array_push(_arr, _node); _node.topoSorted = true; // print($" > Adding > {_node.name}"); } } #endregion -function __topoSort(_list, _nodeList) { #region +function __topoSort(_arr, _nodeArr) { #region var _root = []; var _leftOver = []; - var _global = _nodeList == PROJECT.nodes; - __temp_nodeList = _nodeList; + var _global = _nodeArr == PROJECT.nodes; + __temp_nodeList = _nodeArr; - for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ ) { - var _node = _nodeList[| i]; + for( var i = 0, n = array_length(_nodeArr); i < n; i++ ) { + var _node = _nodeArr[i]; var _isRoot = true; if(is_instanceof(_node, Node_Collection_Inline) && !_node.is_root) { @@ -113,7 +108,7 @@ function __topoSort(_list, _nodeList) { #region var _to = _node.outputs[| j].getJunctionTo(); if(_global) _isRoot &= array_empty(_to); - else _isRoot &= !array_any(_to, function(_val) { return ds_list_exist(__temp_nodeList, _val.node); } ); + else _isRoot &= !array_any(_to, function(_val) { return array_exists(__temp_nodeList, _val.node); } ); if(!_isRoot) break; } @@ -125,23 +120,23 @@ function __topoSort(_list, _nodeList) { #region // print($"Root: {_root}"); for( var i = 0, n = array_length(_root); i < n; i++ ) - __sortNode(_list, _root[i]); + __sortNode(_arr, _root[i]); for( var i = 0, n = array_length(_leftOver); i < n; i++ ) { if(!_leftOver[i].topoSorted) - ds_list_insert(_list, 0, _leftOver[i]); + array_insert(_arr, 0, _leftOver[i]); } } #endregion -function __nodeLeafList(_list) { #region +function __nodeLeafList(_arr) { #region var nodes = []; var nodeNames = []; - for( var i = 0, n = ds_list_size(_list); i < n; i++ ) { - var _node = _list[| i]; + for( var i = 0, n = array_length(_arr); i < n; i++ ) { + var _node = _arr[i]; if(!_node.active) { LOG_LINE_IF(global.FLAG.render == 1, $"Reject {_node.internalName} [inactive]"); continue; } - if(!_node.isLeafList(_list)) { LOG_LINE_IF(global.FLAG.render == 1, $"Reject {_node.internalName} [not leaf]"); continue; } + if(!_node.isLeafList(_arr)) { LOG_LINE_IF(global.FLAG.render == 1, $"Reject {_node.internalName} [not leaf]"); continue; } if(!_node.isRenderable()) { LOG_LINE_IF(global.FLAG.render == 1, $"Reject {_node.internalName} [not renderable]"); continue; } array_push(nodes, _node); @@ -188,27 +183,24 @@ function Render(partial = false, runAction = false) { #region var reset_all = !partial; if(reset_all) { - LOG_IF(global.FLAG.render == 1, $"xxxxxxxxxx Resetting {ds_list_size(PROJECT.nodeTopo)} nodes xxxxxxxxxx"); - var _key = ds_map_find_first(PROJECT.nodeMap); - var amo = ds_map_size(PROJECT.nodeMap); + LOG_IF(global.FLAG.render == 1, $"xxxxxxxxxx Resetting {array_length(PROJECT.nodeTopo)} nodes xxxxxxxxxx"); - repeat(amo) { - var _node = PROJECT.nodeMap[? _key]; + for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) { + var _node = PROJECT.allNodes[i]; _node.setRenderStatus(false); - _key = ds_map_find_next(PROJECT.nodeMap, _key); } } // get leaf node - LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {ds_list_size(PROJECT.nodeTopo)} nodes -----"); + LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {array_length(PROJECT.nodeTopo)} nodes -----"); RENDER_QUEUE.clear(); - for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) { - var _node = PROJECT.nodeTopo[| i]; + for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) { + var _node = PROJECT.nodeTopo[i]; _node.passiveDynamic = false; } - for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) { - var _node = PROJECT.nodeTopo[| i]; + for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) { + var _node = PROJECT.nodeTopo[i]; _node.render_time = 0; if(!__nodeIsRenderLeaf(_node)) @@ -269,18 +261,18 @@ function Render(partial = false, runAction = false) { #region LOG_END(); } #endregion -function __renderListReset(list) { #region - for( var i = 0; i < ds_list_size(list); i++ ) { - list[| i].setRenderStatus(false); +function __renderListReset(arr) { #region + for( var i = 0; i < array_length(arr); i++ ) { + list[i].setRenderStatus(false); - if(struct_has(list[| i], "nodes")) - __renderListReset(list[| i].nodes); + if(struct_has(list[i], "nodes")) + __renderListReset(list[i].nodes); } } #endregion -function RenderList(list) { #region +function RenderList(arr) { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"=============== RENDER LIST START [{ds_list_size(list)}] ==============="); + LOG_IF(global.FLAG.render == 1, $"=============== RENDER LIST START [{array_length(arr)}] ==============="); var queue = ds_queue_create(); try { @@ -288,16 +280,16 @@ function RenderList(list) { #region var error = 0; var t = current_time; - __renderListReset(list); + __renderListReset(arr); // get leaf node - for( var i = 0, n = ds_list_size(list); i < n; i++ ) { - var _node = list[| i]; + for( var i = 0, n = array_length(arr); i < n; i++ ) { + var _node = arr[i]; _node.passiveDynamic = false; } - for( var i = 0, n = ds_list_size(list); i < n; i++ ) { - var _node = list[| i]; + for( var i = 0, n = array_length(arr); i < n; i++ ) { + var _node = arr[i]; if(!__nodeIsRenderLeaf(_node)) continue; diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 56fd65318..ca0d790a2 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -18,16 +18,14 @@ function save_serialize(project = PROJECT, _outMap = false) { #region _map.version = SAVE_VERSION; var _node_list = []; - var _key = ds_map_find_first(project.nodeMap); + var amo = array_length(project.allNodes); + var i = 0; - repeat(ds_map_size(project.nodeMap)) { - var _node = project.nodeMap[? _key]; - - if(_node.active) - array_push(_node_list, _node.serialize()); - - _key = ds_map_find_next(project.nodeMap, _key); + repeat(amo) { + var _node = project.allNodes[i++]; + if(_node.active) array_push(_node_list, _node.serialize()); } + _map.nodes = _node_list; var _anim_map = {}; @@ -154,14 +152,17 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c _content.version = SAVE_VERSION; var _nodes = []; - var cx = 0; - var cy = 0; - for(var i = 0; i < ds_list_size(_list); i++) { - cx += _list[| i].x; - cy += _list[| i].y; + var cx = 0; + var cy = 0; + var amo = array_length(_list); + + for(var i = 0; i < amo; i++) { + cx += _list[i].x; + cy += _list[i].y; } - cx = round((cx / ds_list_size(_list)) / 32) * 32; - cy = round((cy / ds_list_size(_list)) / 32) * 32; + + cx = round((cx / amo) / 32) * 32; + cy = round((cy / amo) / 32) * 32; if(save_surface) { var preview_surface = PANEL_PREVIEW.getNodePreviewSurface(); @@ -171,8 +172,8 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c } } - for(var i = 0; i < ds_list_size(_list); i++) - SAVE_NODE(_nodes, _list[| i], cx, cy, true, context); + for(var i = 0; i < amo; i++) + SAVE_NODE(_nodes, _list[i], cx, cy, true, context); _content.nodes = _nodes; json_save_struct(_path, _content, !PREFERENCES.save_file_minify); @@ -230,8 +231,8 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) { #region if(struct_has(_node, "nodes")) { - for(var i = 0; i < ds_list_size(_node.nodes); i++) - SAVE_NODE(_arr, _node.nodes[| i], dx, dy, scale, context); + for(var i = 0; i < array_length(_node.nodes); i++) + SAVE_NODE(_arr, _node.nodes[i], dx, dy, scale, context); } var m = _node.serialize(scale); diff --git a/sprites/s_node_svg/2d1796d8-b49c-4323-88ed-3801bd585e7a.png b/sprites/s_node_svg/2d1796d8-b49c-4323-88ed-3801bd585e7a.png new file mode 100644 index 0000000000000000000000000000000000000000..d3c1a577ef769e58aa6c062d1964c5f8d00a7907 GIT binary patch literal 1950 zcmZ`)XHb*r7XFY*`W>s?5sghdp+Qlf(>OS$pSow+}DPI+d|d!9LG=AC&?sUPy3tczpfa_`{mVyQ+nSN`$L3>MCy?^M54aso=MigVTl8Cf`jdFPW9p={M>OLi zGnak$-mQ=#e%s5|_j;c9WpO@7=vtYJfzejSlah3HQls)2a(vuI2;oi%U_yuhx-!oP z7F)_b25EW#*7Hw;Rc{I>KNNM*6y2*4eT|U+jA)T03EcYQq>3A*LxCNz4VC9F zUz85@WP0|rWsG4BhCz0fa~fi7u;{HZQS)In8=q=Vx~bvbFW%oaYf+&IC=$@dB~2WB zX=Rjj;;+ISmy=+YHqa6eW0b;p_qv=QmJPmkFmub5Y*b=Z&z{ZKw3+;*btF4`oIN}H zk8%pW4pQiv(~x&!v$J4bvIOPKq^?st;dc!^3=ikTR?j4IbgKDOHr?FYezsK1Ky} z&JMpCijn54t|r0UHdlv&3gwy7bxnG04>{PvnFYq!%he5j2O{B;LGxARk|Gx=i6ecy zIC1pwEa>_l=&kR6e$8mrc-HyM)0B9E4%u5)(=xyG{U!w+Z%5@YzkR@5GC1_AJKswLW@N~%*%LayhXswMJ>a^86m(C!UYA zvH5pHB68hKvPeDeW9Rdc*X;?#imD;c#N&nS0Y>Xgc5%&5oJli;q{fqHSz!`F$-S zqpA|Nwu5|!D_2baoP}J4kab3t&gKRdGnlbqr(AXqJM>I@4<_SEL*1mh?@enn{Be;% z*O)Lx)&vJ!{Xkmv1x+h`j&e9dM8zsDvmweZ<;T!JDg0dHBdQD|JIxL^sYdJY5oJ$i zK{jFcJLp+zV5{EDWaRMnlTPnoX0TuTZLke2cZ^F=W!?n~7cKn5>bI7d&$g1#E4AAa zw;j^UpqkHW`$uzfq`52Mp}{L6+Un6!Du3*Dw>z#~tn82d(~s zvnVGhG*yIjV-=;rvS0`uwy%RGOA~a$O zJGuOm*xSQf!f#a=z1i?}gpzL1&FL24#!~+lEq%O=q!lac#3~ui^&PxAbTlrVg|cQxOhtHi}l- zH7c&@xZb+Bn|o1(98BhHZcLwpHy-%u$Z{(%N&-Pj3oU~0fWN-dKEj%3R?F)@Ak3c} zhfwYe*c<`pP=HdHmu_?Kgw=tWQTs>JQs88{T1_FU(LkKRy*{0Yn)}&9AO0Zkp(D90 zv5FV}tqJHS28=!Us_MzrRTVvTfy?7vJmcVO4Zgu!7snJePh+i|A`crOH8M`(EdN)c z#D?$HZ9B@uH+VmK_Q0WI`!eKF2`sxUg5Odv}*SU`v zO#}DBPXT+9ZtBj9Z*`W>s?5sghdp+Qlf(>OS$pSow+}DPI+d|d!9LG=AC&?sUPy3tczpfa_`{mVyQ+nSN`$L3>MCy?^M54aso=MigVTl8Cf`jdFPW9p={M>OLi zGnak$-mQ=#e%s5|_j;c9WpO@7=vtYJfzejSlah3HQls)2a(vuI2;oi%U_yuhx-!oP z7F)_b25EW#*7Hw;Rc{I>KNNM*6y2*4eT|U+jA)T03EcYQq>3A*LxCNz4VC9F zUz85@WP0|rWsG4BhCz0fa~fi7u;{HZQS)In8=q=Vx~bvbFW%oaYf+&IC=$@dB~2WB zX=Rjj;;+ISmy=+YHqa6eW0b;p_qv=QmJPmkFmub5Y*b=Z&z{ZKw3+;*btF4`oIN}H zk8%pW4pQiv(~x&!v$J4bvIOPKq^?st;dc!^3=ikTR?j4IbgKDOHr?FYezsK1Ky} z&JMpCijn54t|r0UHdlv&3gwy7bxnG04>{PvnFYq!%he5j2O{B;LGxARk|Gx=i6ecy zIC1pwEa>_l=&kR6e$8mrc-HyM)0B9E4%u5)(=xyG{U!w+Z%5@YzkR@5GC1_AJKswLW@N~%*%LayhXswMJ>a^86m(C!UYA zvH5pHB68hKvPeDeW9Rdc*X;?#imD;c#N&nS0Y>Xgc5%&5oJli;q{fqHSz!`F$-S zqpA|Nwu5|!D_2baoP}J4kab3t&gKRdGnlbqr(AXqJM>I@4<_SEL*1mh?@enn{Be;% z*O)Lx)&vJ!{Xkmv1x+h`j&e9dM8zsDvmweZ<;T!JDg0dHBdQD|JIxL^sYdJY5oJ$i zK{jFcJLp+zV5{EDWaRMnlTPnoX0TuTZLke2cZ^F=W!?n~7cKn5>bI7d&$g1#E4AAa zw;j^UpqkHW`$uzfq`52Mp}{L6+Un6!Du3*Dw>z#~tn82d(~s zvnVGhG*yIjV-=;rvS0`uwy%RGOA~a$O zJGuOm*xSQf!f#a=z1i?}gpzL1&FL24#!~+lEq%O=q!lac#3~ui^&PxAbTlrVg|cQxOhtHi}l- zH7c&@xZb+Bn|o1(98BhHZcLwpHy-%u$Z{(%N&-Pj3oU~0fWN-dKEj%3R?F)@Ak3c} zhfwYe*c<`pP=HdHmu_?Kgw=tWQTs>JQs88{T1_FU(LkKRy*{0Yn)}&9AO0Zkp(D90 zv5FV}tqJHS28=!Us_MzrRTVvTfy?7vJmcVO4Zgu!7snJePh+i|A`crOH8M`(EdN)c z#D?$HZ9B@uH+VmK_Q0WI`!eKF2`sxUg5Odv}*SU`v zO#}DBPXT+9ZtBj9Z":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"s_node_svg", + "playback":1, + "playbackSpeed":30.0, + "playbackSpeedType":0, + "resourceType":"GMSequence", + "resourceVersion":"2.0", + "showBackdrop":true, + "showBackdropImage":false, + "timeUnits":1, + "tracks":[ + {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"2d1796d8-b49c-4323-88ed-3801bd585e7a","path":"sprites/s_node_svg/s_node_svg.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"4d3405fa-fc9b-4b08-aff2-f96d73d2c2ef","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange":null, + "volume":1.0, + "xorigin":32, + "yorigin":32, + }, + "swatchColours":null, + "swfPrecision":0.5, + "textureGroupId":{ + "name":"Default", + "path":"texturegroups/Default", + }, + "type":0, + "VTile":false, + "width":64, +} \ No newline at end of file