diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index d5ff58e21..3ca49dc7f 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -216,6 +216,7 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, + {"name":"effector","order":18,"path":"folders/nodes/data/simulation/VFX/effector.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -268,7 +269,7 @@ {"name":"node_2d_light","order":1,"path":"scripts/node_2d_light/node_2d_light.yy",}, {"name":"node_rigid_activation","order":7,"path":"scripts/node_rigid_activation/node_rigid_activation.yy",}, {"name":"s_node_image_gif","order":4,"path":"sprites/s_node_image_gif/s_node_image_gif.yy",}, - {"name":"node_VFX_effect_wind","order":5,"path":"scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy",}, + {"name":"node_VFX_effect_wind","order":7,"path":"scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy",}, {"name":"s_node_tunnel_out","order":22,"path":"sprites/s_node_tunnel_out/s_node_tunnel_out.yy",}, {"name":"__background_set_element","order":3,"path":"scripts/__background_set_element/__background_set_element.yy",}, {"name":"s_node_3d_obj","order":3,"path":"sprites/s_node_3d_obj/s_node_3d_obj.yy",}, @@ -679,7 +680,7 @@ {"name":"fd_rectangle_get_pressure_height","order":16,"path":"scripts/fd_rectangle_get_pressure_height/fd_rectangle_get_pressure_height.yy",}, {"name":"hyperbolic_function","order":16,"path":"scripts/hyperbolic_function/hyperbolic_function.yy",}, {"name":"sh_rsh_rotate","order":1,"path":"shaders/sh_rsh_rotate/sh_rsh_rotate.yy",}, - {"name":"node_VFX_effect_destroy","order":12,"path":"scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy",}, + {"name":"node_VFX_effect_destroy","order":3,"path":"scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy",}, {"name":"node_cache","order":9,"path":"scripts/node_cache/node_cache.yy",}, {"name":"sh_bw","order":3,"path":"shaders/sh_bw/sh_bw.yy",}, {"name":"var_comparison","order":1,"path":"scripts/var_comparison/var_comparison.yy",}, @@ -709,10 +710,10 @@ {"name":"sh_threshold","order":18,"path":"shaders/sh_threshold/sh_threshold.yy",}, {"name":"fd_rectangle_set_initial_value_pressure","order":3,"path":"scripts/fd_rectangle_set_initial_value_pressure/fd_rectangle_set_initial_value_pressure.yy",}, {"name":"o_dialog_drag_folder","order":2,"path":"objects/o_dialog_drag_folder/o_dialog_drag_folder.yy",}, - {"name":"node_VFX_effect_repel","order":9,"path":"scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy",}, + {"name":"node_VFX_effect_repel","order":4,"path":"scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy",}, {"name":"s_node_alpha_cut","order":3,"path":"sprites/s_node_alpha_cut/s_node_alpha_cut.yy",}, {"name":"node_iterator_length","order":4,"path":"scripts/node_iterator_length/node_iterator_length.yy",}, - {"name":"node_VFX_effect_attract","order":8,"path":"scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy",}, + {"name":"node_VFX_effect_attract","order":2,"path":"scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy",}, {"name":"sh_d3d_ssao_blur","order":1,"path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",}, {"name":"panel_addon","order":5,"path":"scripts/panel_addon/panel_addon.yy",}, {"name":"s_node_text_splice","order":6,"path":"sprites/s_node_text_splice/s_node_text_splice.yy",}, @@ -923,7 +924,7 @@ {"name":"color_selector","order":4,"path":"scripts/color_selector/color_selector.yy",}, {"name":"node_trigger_bool","order":1,"path":"scripts/node_trigger_bool/node_trigger_bool.yy",}, {"name":"s_node_strandSim_gravity","order":4,"path":"sprites/s_node_strandSim_gravity/s_node_strandSim_gravity.yy",}, - {"name":"node_VFX_effect_turbulence","order":11,"path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",}, + {"name":"node_VFX_effect_turbulence","order":5,"path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",}, {"name":"action_loader","order":15,"path":"scripts/action_loader/action_loader.yy",}, {"name":"sh_surface_replace_replace","order":1,"path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",}, {"name":"node_ase_file_read","order":14,"path":"scripts/node_ase_file_read/node_ase_file_read.yy",}, @@ -977,6 +978,7 @@ {"name":"sh_blend_replace","order":50,"path":"shaders/sh_blend_replace/sh_blend_replace.yy",}, {"name":"node_rigid_render","order":3,"path":"scripts/node_rigid_render/node_rigid_render.yy",}, {"name":"node_image_splice_sheet","order":4,"path":"scripts/node_image_splice_sheet/node_image_splice_sheet.yy",}, + {"name":"node_VFX_renderer_output","order":17,"path":"scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy",}, {"name":"sh_posterize_palette","order":12,"path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",}, {"name":"fd_rectangle_set_material_maccormack_weight","order":6,"path":"scripts/fd_rectangle_set_material_maccormack_weight/fd_rectangle_set_material_maccormack_weight.yy",}, {"name":"collection_data","order":9,"path":"scripts/collection_data/collection_data.yy",}, @@ -1062,7 +1064,7 @@ {"name":"s_node_cache_array","order":25,"path":"sprites/s_node_cache_array/s_node_cache_array.yy",}, {"name":"sh_blend_alpha_addition","order":13,"path":"shaders/sh_blend_alpha_addition/sh_blend_alpha_addition.yy",}, {"name":"widget","order":25,"path":"scripts/widget/widget.yy",}, - {"name":"node_VFX_effect_vortex","order":10,"path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",}, + {"name":"node_VFX_effect_vortex","order":6,"path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",}, {"name":"s_node_skew","order":11,"path":"sprites/s_node_skew/s_node_skew.yy",}, {"name":"s_node_feedback_input","order":10,"path":"sprites/s_node_feedback_input/s_node_feedback_input.yy",}, {"name":"s_node_path_builder","order":9,"path":"sprites/s_node_path_builder/s_node_path_builder.yy",}, @@ -1442,7 +1444,7 @@ {"name":"s_node_3d_sphere","order":8,"path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",}, {"name":"fd_rectangle_replace_velocity","order":16,"path":"scripts/fd_rectangle_replace_velocity/fd_rectangle_replace_velocity.yy",}, {"name":"s_node_group_thumbnail","order":34,"path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",}, - {"name":"node_VFX_effector","order":6,"path":"scripts/node_VFX_effector/node_VFX_effector.yy",}, + {"name":"node_VFX_effector","order":8,"path":"scripts/node_VFX_effector/node_VFX_effector.yy",}, {"name":"node_path_shift","order":5,"path":"scripts/node_path_shift/node_path_shift.yy",}, {"name":"s_node_wav_file_write","order":17,"path":"sprites/s_node_wav_file_write/s_node_wav_file_write.yy",}, {"name":"s_node_3d_cylinder","order":1,"path":"sprites/s_node_3d_cylinder/s_node_3d_cylinder.yy",}, @@ -1476,6 +1478,7 @@ {"name":"fd_rectangle_add_material","order":4,"path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",}, {"name":"fd_rectangle_set_target","order":18,"path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",}, {"name":"node_wav_file_read","order":17,"path":"scripts/node_wav_file_read/node_wav_file_read.yy",}, + {"name":"s_node_vfx_render_output","order":12,"path":"sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy",}, {"name":"draw_line_dashed","order":7,"path":"scripts/draw_line_dashed/draw_line_dashed.yy",}, {"name":"pseudo_regex","order":7,"path":"scripts/pseudo_regex/pseudo_regex.yy",}, {"name":"node_invert","order":6,"path":"scripts/node_invert/node_invert.yy",}, @@ -1524,7 +1527,7 @@ {"name":"fd_rectangle_get_material_height","order":10,"path":"scripts/fd_rectangle_get_material_height/fd_rectangle_get_material_height.yy",}, {"name":"rangeBox","order":10,"path":"scripts/rangeBox/rangeBox.yy",}, {"name":"s_node_array_copy","order":14,"path":"sprites/s_node_array_copy/s_node_array_copy.yy",}, - {"name":"node_VFX_effect_accelerate","order":7,"path":"scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy",}, + {"name":"node_VFX_effect_accelerate","order":1,"path":"scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy",}, {"name":"node_flood_fill","order":11,"path":"scripts/node_flood_fill/node_flood_fill.yy",}, {"name":"node_frame","order":1,"path":"scripts/node_frame/node_frame.yy",}, {"name":"s_node_scale_algo","order":7,"path":"sprites/s_node_scale_algo/s_node_scale_algo.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 3cd0dbde6..97f668338 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -250,6 +250,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"effector","folderPath":"folders/nodes/data/simulation/VFX/effector.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -1618,6 +1619,7 @@ {"id":{"name":"sh_blend_replace","path":"shaders/sh_blend_replace/sh_blend_replace.yy",},}, {"id":{"name":"node_rigid_render","path":"scripts/node_rigid_render/node_rigid_render.yy",},}, {"id":{"name":"node_image_splice_sheet","path":"scripts/node_image_splice_sheet/node_image_splice_sheet.yy",},}, + {"id":{"name":"node_VFX_renderer_output","path":"scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy",},}, {"id":{"name":"sh_posterize_palette","path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",},}, {"id":{"name":"fd_rectangle_set_material_maccormack_weight","path":"scripts/fd_rectangle_set_material_maccormack_weight/fd_rectangle_set_material_maccormack_weight.yy",},}, {"id":{"name":"collection_data","path":"scripts/collection_data/collection_data.yy",},}, @@ -2196,6 +2198,7 @@ {"id":{"name":"fd_rectangle_add_material","path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",},}, {"id":{"name":"fd_rectangle_set_target","path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},}, {"id":{"name":"node_wav_file_read","path":"scripts/node_wav_file_read/node_wav_file_read.yy",},}, + {"id":{"name":"s_node_vfx_render_output","path":"sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy",},}, {"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},}, {"id":{"name":"pseudo_regex","path":"scripts/pseudo_regex/pseudo_regex.yy",},}, {"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},}, diff --git a/datafiles/data/related_node.json b/datafiles/data/related_node.json index 7b3a6977f..43508bf0d 100644 --- a/datafiles/data/related_node.json +++ b/datafiles/data/related_node.json @@ -22,5 +22,13 @@ "connectTo": { "key": "connectionType", "relations": {} + }, + "context": { + "key": "contextNode", + "relations": { + "Node_Fluid_Group": [ "Node_Fluid_Add", "Node_Fluid_Apply_Velocity", "Node_Fluid_Update", "Node_Fluid_Render", "Node_Fluid_Render_Output" ], + "Node_Rigid_Group": [ "Node_Rigid_Object", "Node_Rigid_Force_Apply", "Node_Rigid_Render", "Node_Rigid_Render_Output" ], + "Node_Strand_Group": [ "Node_Strand_Create", "Node_Strand_Gravity", "Node_Strand_Update", "Node_Strand_Render", "Node_Strand_Render_Texture" ] + } } } \ No newline at end of file diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index cdc47a9cb..2ff66a3e0 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -318,17 +318,22 @@ event_inherited(); } else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT) { _list = ds_list_create(); + var sug = []; + if(node_called != noone) { - var sug = nodeReleatedQuery( + array_append(sug, nodeReleatedQuery( node_called.connect_type == JUNCTION_CONNECT.input? "connectTo" : "connectFrom", node_called.type - ); - - if(array_length(sug)) { - ds_list_add(_list, "Related"); - for( var i = 0, n = array_length(sug); i < n; i++ ) - ds_list_add(_list, ALL_NODES[? sug[i]]); - } + )); + } + + var _cont = PANEL_GRAPH.getCurrentContext(); + if(_cont != noone) + array_append(sug, nodeReleatedQuery("context", instanceof(_cont))); + if(array_length(sug)) { + ds_list_add(_list, "Related"); + for( var i = 0, n = array_length(sug); i < n; i++ ) + ds_list_add(_list, ALL_NODES[? sug[i]]); } ds_list_add(_list, "Favourites"); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 903e43a3b..db28ef598 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -98,7 +98,7 @@ _HOVERING_ELEMENT = noone; if(PROJECT.animator.frame_progress) { __addon_preAnim(); - if(PROJECT.animator.current_frame == 0) + if(CURRENT_FRAME == 0) ResetAllNodesRender(); Render(true); diff --git a/scripts/GmlLua/GmlLua.gml b/scripts/GmlLua/GmlLua.gml index 1fbd6cb0e..730128475 100644 --- a/scripts/GmlLua/GmlLua.gml +++ b/scripts/GmlLua/GmlLua.gml @@ -313,8 +313,8 @@ Project.fps = 0; function lua_projectData(state) { lua_add_code(state, @" -Project.frame = " + string(PROJECT.animator.current_frame) + @"; -Project.frameTotal = " + string(PROJECT.animator.frames_total) + @"; +Project.frame = " + string(CURRENT_FRAME) + @"; +Project.frameTotal = " + string(TOTAL_FRAMES) + @"; Project.fps = " + string(PROJECT.animator.framerate) + @"; "); } diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 0b0e89f67..f42cafd8d 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -66,6 +66,8 @@ function __part(_node) constructor { ground_bounce = 0; ground_friction = 1; + frame = 0; + static reset = function() { #region gml_pragma("forceinline"); @@ -85,7 +87,7 @@ function __part(_node) constructor { life = _life; life_total = life; - node.onPartCreate(self); + if(node.onPartCreate != noone) node.onPartCreate(self); } #endregion static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) { #region @@ -148,19 +150,20 @@ function __part(_node) constructor { alp_fade = _fade; } #endregion - static kill = function() { #region + static kill = function(callDestroy = true) { #region gml_pragma("forceinline"); active = false; - - node.onPartDestroy(self); + if(callDestroy && node.onPartDestroy != noone) + node.onPartDestroy(self); } #endregion - static step = function() { #region + static step = function(frame = 0) { #region gml_pragma("forceinline"); if(!active) return; x += speedx; + self.frame = frame; random_set_seed(seed + life); @@ -192,7 +195,7 @@ function __part(_node) constructor { if(follow) rot = spVec[1]; else rot += rot_s; - if(step_int > 0 && safe_mod(life, step_int) == 0) + if(node.onPartStep != noone && step_int > 0 && safe_mod(life, step_int) == 0) node.onPartStep(self); if(life-- < 0) kill(); @@ -235,15 +238,21 @@ function __part(_node) constructor { ss = surf[ping >= len? (len - 1) * 2 - ping : ping]; break; case ANIM_END_ACTION.destroy: - if(ind >= len) return; - else ss = surf[ind]; + if(ind >= len) { + //print($"Drawing part destroy when animation end"); + kill(); + return; + } else ss = surf[ind]; break; } } var surface = is_instanceof(ss, SurfaceAtlas)? ss.getSurface() : node.surface_cache[$ ss]; - if(!is_surface(surface)) return; + if(!is_surface(surface)) { + //print($"Drawing part failed: Not a surface"); + return; + } var lifeRat = 1 - life / life_total; var scCurve = sct.get(lifeRat); @@ -268,12 +277,16 @@ function __part(_node) constructor { var x1 = _xx + s_w * 1.5; var y1 = _yy + s_h * 1.5; - if(x0 > surf_w || y0 > surf_h || x1 < 0 || y1 < 0) return; //culling + if(x0 > surf_w || y0 > surf_h || x1 < 0 || y1 < 0) { + //print($"Drawing part failed: Outside view"); + return; //culling + } var cc = (col == -1)? c_white : col.eval(lifeRat); if(blend != c_white) cc = colorMultiply(blend, cc); alp_draw = alp * alp_fade.get(lifeRat); + //print($"Draw part [{frame}]: {surface} at {_xx}, {_yy}, scale {drawsx}, {drawsy} - {scCurve} color {cc}, {alp_draw}"); draw_surface_ext_safe(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw); } #endregion diff --git a/scripts/__node/__node.gml b/scripts/__node/__node.gml index 0e1478029..4c65d9dd7 100644 --- a/scripts/__node/__node.gml +++ b/scripts/__node/__node.gml @@ -11,7 +11,7 @@ function __Node_Base(x, y) constructor { anim_priority = -999; static step = function() {} - static update = function(frame = PROJECT.animator.current_frame) {} + static update = function(frame = CURRENT_FRAME) {} static valueUpdate = function(index) {} static triggerRender = function() {} diff --git a/scripts/__node_3d_combine/__node_3d_combine.gml b/scripts/__node_3d_combine/__node_3d_combine.gml index ec264fae1..4bdcd81f8 100644 --- a/scripts/__node_3d_combine/__node_3d_combine.gml +++ b/scripts/__node_3d_combine/__node_3d_combine.gml @@ -145,7 +145,7 @@ function __Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) constr _3d_clear_local_transform(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dim = getInputData(0); var _lpos = getInputData(1); var _lrot = getInputData(2); diff --git a/scripts/__node_3d_obj/__node_3d_obj.gml b/scripts/__node_3d_obj/__node_3d_obj.gml index 8db09f2ac..d5b110b18 100644 --- a/scripts/__node_3d_obj/__node_3d_obj.gml +++ b/scripts/__node_3d_obj/__node_3d_obj.gml @@ -194,7 +194,7 @@ function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructo _3d_clear_local_transform(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!surface_exists(tex_surface)) reset_tex(); if(do_reset_material) { diff --git a/scripts/__node_3d_render/__node_3d_render.gml b/scripts/__node_3d_render/__node_3d_render.gml index bd93d69ca..3157fcfb2 100644 --- a/scripts/__node_3d_render/__node_3d_render.gml +++ b/scripts/__node_3d_render/__node_3d_render.gml @@ -170,7 +170,7 @@ // _3d_clear_local_transform(); // } -// static update = function(frame = PROJECT.animator.current_frame) { +// static update = function(frame = CURRENT_FRAME) { // if(!surface_exists(tex_surface)) reset_tex(); // if(do_reset_material) { diff --git a/scripts/__node_3d_repeat/__node_3d_repeat.gml b/scripts/__node_3d_repeat/__node_3d_repeat.gml index 1b9c1c797..b53597c1c 100644 --- a/scripts/__node_3d_repeat/__node_3d_repeat.gml +++ b/scripts/__node_3d_repeat/__node_3d_repeat.gml @@ -162,7 +162,7 @@ function __Node_3D_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 21].setVisible(_proj); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dim = getInputData(0); var _lpos = getInputData(1); var _lrot = getInputData(2); diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml index 1fff4160b..2d853583d 100644 --- a/scripts/__node_iterator/__node_iterator.gml +++ b/scripts/__node_iterator/__node_iterator.gml @@ -27,7 +27,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) static doInitLoop = function() {} - static update = function(frame = PROJECT.animator.current_frame) { initLoop(); } + static update = function(frame = CURRENT_FRAME) { initLoop(); } static outputNextNode = function() { LOG_BLOCK_START(); diff --git a/scripts/_node_VFX_effector/_node_VFX_effector.yy b/scripts/_node_VFX_effector/_node_VFX_effector.yy index 09313c95c..8dc822dcd 100644 --- a/scripts/_node_VFX_effector/_node_VFX_effector.yy +++ b/scripts/_node_VFX_effector/_node_VFX_effector.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index 76f24c7f8..33c8fbf6a 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -177,7 +177,6 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co scatter_index = 0; def_surface = -1; - current_data = []; surface_cache = {}; wiggle_maps = { @@ -195,46 +194,46 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co for( var i = 0; i < attributes.part_amount; i++ ) parts[i] = new __part(self); - static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { #region - var _inSurf = current_data[ 0]; + static spawn = function(_time = CURRENT_FRAME, _pos = -1) { #region + var _inSurf = getInputData( 0); - var _spawn_amount = current_data[ 2]; + var _spawn_amount = getInputData( 2); - var _spawn_area = current_data[ 3]; - var _distrib = current_data[ 4]; - var _dist_map = current_data[30]; - var _scatter = current_data[24]; + var _spawn_area = getInputData( 3); + var _distrib = getInputData( 4); + var _dist_map = getInputData(30); + var _scatter = getInputData(24); - var _life = current_data[ 5]; - var _direction = current_data[ 6]; - var _directCenter = current_data[29]; - var _velocity = current_data[18]; + var _life = getInputData( 5); + var _direction = getInputData( 6); + var _directCenter = getInputData(29); + var _velocity = getInputData(18); - var _accel = current_data[ 7]; - var _grav = current_data[19]; - var _gvDir = current_data[33]; - var _turn = current_data[34]; - var _turnBi = current_data[35]; - var _turnSc = current_data[36]; + var _accel = getInputData( 7); + var _grav = getInputData(19); + var _gvDir = getInputData(33); + var _turn = getInputData(34); + var _turnBi = getInputData(35); + var _turnSc = getInputData(36); - var _follow = current_data[15]; - var _rotation = current_data[ 8]; - var _rotation_speed = current_data[ 9]; - var _scale = current_data[10]; - var _size = current_data[17]; + var _follow = getInputData(15); + var _rotation = getInputData( 8); + var _rotation_speed = getInputData( 9); + var _scale = getInputData(10); + var _size = getInputData(17); - var _color = current_data[12]; - var _blend = current_data[28]; - var _alpha = current_data[13]; + var _color = getInputData(12); + var _blend = getInputData(28); + var _alpha = getInputData(13); - var _arr_type = current_data[22]; - var _anim_speed = current_data[23]; - var _anim_end = current_data[26]; + var _arr_type = getInputData(22); + var _anim_speed = getInputData(23); + var _anim_end = getInputData(26); - var _ground = current_data[37]; - var _ground_offset = current_data[38]; - var _ground_bounce = current_data[39]; - var _ground_frict = current_data[40]; + var _ground = getInputData(37); + var _ground_offset = getInputData(38); + var _ground_bounce = getInputData(39); + var _ground_frict = getInputData(40); if(_rotation[1] < _rotation[0]) _rotation[1] += 360; @@ -244,7 +243,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co var _amo = irandom_range(_spawn_amount[0], _spawn_amount[1]); if(_distrib == 2) _posDist = get_points_from_dist(_dist_map, _amo, seed); - //print($"Frame {_time}: Spawning {_amo} particles, seed {seed}, {irandom(99999999)}"); + //print($"[{display_name}] Frame {_time}: Spawning {_amo} particles, seed {seed}, at {_pos}"); + for( var i = 0; i < _amo; i++ ) { seed += 100; random_set_seed(seed); @@ -335,49 +335,60 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co static updateParticleForward = function() {} - function reset() { #region - spawn_index = 0; - scatter_index = 0; - for(var i = 0; i < array_length(parts); i++) { - if(!parts[i].active) continue; - parts[i].kill(); + static getSurfaceCache = function() { #region + var surfs = getInputData(0); + + if(!is_array(getInputData(0))) surfs = [ surfs ]; + if(!array_empty(getInputData(0))) { + if(is_array(getInputData(0))) + surfs = array_spread(surfs); + for( var i = 0, n = array_length(surfs); i < n; i++ ) { + if(is_surface(surface_cache[$ surfs[i]])) continue; + surface_cache[$ surfs[i]] = surface_clone(surfs[i]); + } } - - render(); - seed = getInputData(32); - - var _wigg_pos = getInputData(41); - var _wigg_rot = getInputData(42); - var _wigg_sca = getInputData(43); - var _wigg_dir = getInputData(20); - - wiggle_maps.wig_psx.check(_wigg_pos[0], _wigg_pos[1], seed + 10); - wiggle_maps.wig_psy.check(_wigg_pos[0], _wigg_pos[1], seed + 20); - wiggle_maps.wig_rot.check(_wigg_rot[0], _wigg_rot[1], seed + 30); - wiggle_maps.wig_scx.check(_wigg_sca[0], _wigg_sca[1], seed + 40); - wiggle_maps.wig_scy.check(_wigg_sca[0], _wigg_sca[1], seed + 50); - wiggle_maps.wig_dir.check(_wigg_dir[0], _wigg_dir[1], seed + 60); - - var _curve_sca = getInputData(11); - var _curve_alp = getInputData(14); - - curve_scale = new curveMap(_curve_sca, PROJECT.animator.frames_total); - curve_alpha = new curveMap(_curve_alp, PROJECT.animator.frames_total); + } #endregion + + function reset() { #region + getInputs(0); var keys = variable_struct_get_names(surface_cache); for( var i = 0, n = array_length(keys); i < n; i++ ) surface_free_safe(surface_cache[$ keys[i]]); surface_cache = {}; + getSurfaceCache(); - var _loop = getInputData(21); - if(!_loop) return; + spawn_index = 0; + scatter_index = 0; - for(var i = 0; i < PROJECT.animator.frames_total; i++) { - runVFX(i, false); - updateParticleForward(); + for(var i = 0; i < array_length(parts); i++) { + if(!parts[i].active) continue; + parts[i].kill(false); } - seed = getInputData(32); + #region ----- precomputes ----- + seed = getInputData(32); + + var _wigg_pos = getInputData(41); + var _wigg_rot = getInputData(42); + var _wigg_sca = getInputData(43); + var _wigg_dir = getInputData(20); + + wiggle_maps.wig_psx.check(_wigg_pos[0], _wigg_pos[1], seed + 10); + wiggle_maps.wig_psy.check(_wigg_pos[0], _wigg_pos[1], seed + 20); + wiggle_maps.wig_rot.check(_wigg_rot[0], _wigg_rot[1], seed + 30); + wiggle_maps.wig_scx.check(_wigg_sca[0], _wigg_sca[1], seed + 40); + wiggle_maps.wig_scy.check(_wigg_sca[0], _wigg_sca[1], seed + 50); + wiggle_maps.wig_dir.check(_wigg_dir[0], _wigg_dir[1], seed + 60); + + var _curve_sca = getInputData(11); + var _curve_alp = getInputData(14); + + curve_scale = new curveMap(_curve_sca, TOTAL_FRAMES); + curve_alpha = new curveMap(_curve_alp, TOTAL_FRAMES); + #endregion + + render(); } #endregion function checkPartPool() { #region @@ -392,7 +403,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co } } #endregion - static runVFX = function(_time = PROJECT.animator.current_frame, _render = true) { #region + static runVFX = function(_time = CURRENT_FRAME, _render = true) { #region var _spawn_delay = inputs[| 1].getValue(_time); var _spawn_type = inputs[| 16].getValue(_time); var _spawn_active = inputs[| 27].getValue(_time); @@ -400,22 +411,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co //print($"{_time} : {_spawn_trig} | {ds_list_to_array(inputs[| 44].animator.values)}"); - for( var i = 0; i < ds_list_size(inputs); i++ ) - current_data[i] = inputs[| i].getValue(_time); - - var surfs = current_data[0]; - - if(!is_array(current_data[0])) surfs = [ surfs ]; - if(!array_empty(current_data[0])) { - if(is_array(current_data[0])) - surfs = array_spread(surfs); - for( var i = 0, n = array_length(surfs); i < n; i++ ) { - if(is_surface(surface_cache[$ surfs[i]])) continue; - surface_cache[$ surfs[i]] = surface_clone(surfs[i]); - } - } - - //print(surface_cache); + getInputs(_time); + getSurfaceCache(); if(_spawn_active) { switch(_spawn_type) { @@ -424,11 +421,16 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co case 2 : if(_spawn_trig) spawn(_time); break; } } - + + //var activeParts = 0; for(var i = 0; i < array_length(parts); i++) { if(!parts[i].active) continue; - parts[i].step(); + //activeParts++; + parts[i].step(_time); } + + //print($"Run VFX frame {_time} seed {seed}"); + //print($"[{display_name}] Running VFX frame {_time}: {activeParts} active particles."); if(!_render) return; @@ -493,18 +495,18 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co static onDrawOverlay = -1; - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region checkPartPool(); - onUpdate(); + onUpdate(frame); } #endregion - static onUpdate = function() {} + static onUpdate = function(frame = CURRENT_FRAME) {} static render = function() {} - static onPartCreate = function(part) {} - static onPartStep = function(part) {} - static onPartDestroy = function(part) {} + static onPartCreate = noone; + static onPartStep = noone; + static onPartDestroy = noone; static doSerialize = function(_map) { #region _map.part_base_length = input_len; diff --git a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml index f522c5db7..a78168a14 100644 --- a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml +++ b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml @@ -1,8 +1,9 @@ function Node_Fluid(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { color = COLORS.node_blend_fluid; icon = THEME.fluid_sim; + update_on_frame = true; - static updateForward = function(frame = PROJECT.animator.current_frame, _update = true) { + static updateForward = function(frame = CURRENT_FRAME, _update = true) { if(_update) update(frame); //print($"Update {frame}: {name}"); diff --git a/scripts/_node_strand_affector/_node_strand_affector.gml b/scripts/_node_strand_affector/_node_strand_affector.gml index 363d36520..ff83f9fd9 100644 --- a/scripts/_node_strand_affector/_node_strand_affector.gml +++ b/scripts/_node_strand_affector/_node_strand_affector.gml @@ -147,7 +147,7 @@ function _Node_Strand_Affector(_x, _y, _group = noone) : Node(_x, _y, _group) co active &= inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _typ = getInputData(1); inputs[| 4].setVisible(_typ == 1); diff --git a/scripts/addon_lua_constant/addon_lua_constant.gml b/scripts/addon_lua_constant/addon_lua_constant.gml index 4fac4ecaa..0453cfc2e 100644 --- a/scripts/addon_lua_constant/addon_lua_constant.gml +++ b/scripts/addon_lua_constant/addon_lua_constant.gml @@ -154,8 +154,8 @@ function __addon_lua_panel_variable(lua, panel) { ); lua_add_code(lua, - "Animator.frame_current = " + string(PROJECT.animator.current_frame) + "\n" + - "Animator.frame_total = " + string(PROJECT.animator.frames_total) + "\n" + + "Animator.frame_current = " + string(CURRENT_FRAME) + "\n" + + "Animator.frame_total = " + string(TOTAL_FRAMES) + "\n" + "Animator.frame_rate = " + string(PROJECT.animator.framerate) + "\n" ); } diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index 52da40fa6..4fd9d4d6a 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -7,6 +7,8 @@ } #macro ANIMATION_STATIC !(PROJECT.animator.is_playing || PROJECT.animator.frame_progress) + #macro CURRENT_FRAME PROJECT.animator.current_frame + #macro TOTAL_FRAMES PROJECT.animator.frames_total #endregion #region animation class diff --git a/scripts/ase_object/ase_object.gml b/scripts/ase_object/ase_object.gml index a4e4c3389..89dc3cf5d 100644 --- a/scripts/ase_object/ase_object.gml +++ b/scripts/ase_object/ase_object.gml @@ -69,7 +69,7 @@ function ase_layer(name) constructor { cels[index] = cel; } - static getCel = function(index = PROJECT.animator.current_frame) { + static getCel = function(index = CURRENT_FRAME) { var ind; if(tag != noone) { diff --git a/scripts/curveBox/curveBox.gml b/scripts/curveBox/curveBox.gml index a2c36c142..f9b6da70e 100644 --- a/scripts/curveBox/curveBox.gml +++ b/scripts/curveBox/curveBox.gml @@ -285,7 +285,7 @@ function curveBox(_onModify) : widget() constructor { var cc = merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.5); if(point_in_rectangle(_m[0], _m[1], bxF, byF, _x + _w, byF + byH)) { cc = COLORS._main_icon; - if(mouse_click(mb_left, active)) + if(mouse_press(mb_left, active)) zooming = true; } diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index ea98cca5f..e7583b2ab 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -117,7 +117,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false try { if(struct_has(_load_content, "animator")) { var _anim_map = _load_content.animator; - PROJECT.animator.frames_total = _anim_map.frames_total; + TOTAL_FRAMES = _anim_map.frames_total; PROJECT.animator.framerate = _anim_map.framerate; } } catch(e) { diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index deab87acf..ccb9c1ecf 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -107,7 +107,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 2) == 2) { for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time > PROJECT.animator.current_frame) { + if(_key.time > CURRENT_FRAME) { PROJECT.animator.setFrame(_key.time); break; } @@ -118,7 +118,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var cc = COLORS.panel_animation_keyframe_unselected; var kfFocus = false; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { - if(jun.animator.values[| j].time == PROJECT.animator.current_frame) { + if(jun.animator.values[| j].time == CURRENT_FRAME) { cc = COLORS.panel_animation_keyframe_selected; kfFocus = true; break; @@ -130,18 +130,18 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var _add = false; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time == PROJECT.animator.current_frame) { + if(_key.time == CURRENT_FRAME) { if(ds_list_size(jun.animator.values) > 1) ds_list_delete(jun.animator.values, j); _add = true; break; - } else if(_key.time > PROJECT.animator.current_frame) { - ds_list_insert(jun.animator.values, j, new valueKey(PROJECT.animator.current_frame, jun.showValue(), jun.animator)); + } else if(_key.time > CURRENT_FRAME) { + ds_list_insert(jun.animator.values, j, new valueKey(CURRENT_FRAME, jun.showValue(), jun.animator)); _add = true; break; } } - if(!_add) ds_list_add(jun.animator.values, new valueKey(PROJECT.animator.current_frame, jun.showValue(), jun.animator)); + if(!_add) ds_list_add(jun.animator.values, new valueKey(CURRENT_FRAME, jun.showValue(), jun.animator)); } bx -= ui(26); @@ -149,7 +149,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var _t = -1; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time < PROJECT.animator.current_frame) + if(_key.time < CURRENT_FRAME) _t = _key.time; } if(_t > -1) PROJECT.animator.setFrame(_t); diff --git a/scripts/node_VCT/node_VCT.gml b/scripts/node_VCT/node_VCT.gml index 602c76a69..0e446fb49 100644 --- a/scripts/node_VCT/node_VCT.gml +++ b/scripts/node_VCT/node_VCT.gml @@ -36,7 +36,7 @@ function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const vct[$ inputs[| i].display_data.key].setDirect(_data[i]); var params = { - frame: PROJECT.animator.current_frame + frame: CURRENT_FRAME }; return vct.process(params); diff --git a/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy b/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy index 729b99af8..c24d3a8ea 100644 --- a/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy +++ b/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy b/scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy index 67ce113b7..3812c5d3f 100644 --- a/scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy +++ b/scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy b/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy index 4ea9d245d..33339e403 100644 --- a/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy +++ b/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy b/scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy index 2a5c1c30e..c1599652e 100644 --- a/scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy +++ b/scripts/node_VFX_effect_repel/node_VFX_effect_repel.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy index 141e1fb38..0315da5d7 100644 --- a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy +++ b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy index 468860ea2..7c13c258d 100644 --- a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy +++ b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy b/scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy index f0e6826ba..d4ae653a2 100644 --- a/scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy +++ b/scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index ab647891f..d44261db7 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -139,7 +139,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr onAffect(part, str); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var val = getInputData(0); outputs[| 0].setValue(val); if(val == -1) return; @@ -162,4 +162,6 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } + + getPreviewingNode = VFX_PREVIEW_NODE; } \ No newline at end of file diff --git a/scripts/node_VFX_effector/node_VFX_effector.yy b/scripts/node_VFX_effector/node_VFX_effector.yy index 9404e5812..8153c0b1c 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.yy +++ b/scripts/node_VFX_effector/node_VFX_effector.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "VFX", - "path": "folders/nodes/data/simulation/VFX.yy", + "name": "effector", + "path": "folders/nodes/data/simulation/VFX/effector.yy", }, } \ No newline at end of file diff --git a/scripts/node_VFX_group/node_VFX_group.gml b/scripts/node_VFX_group/node_VFX_group.gml index 7179b31a2..f3bd9ae12 100644 --- a/scripts/node_VFX_group/node_VFX_group.gml +++ b/scripts/node_VFX_group/node_VFX_group.gml @@ -1,17 +1,76 @@ +function VFX_PREVIEW_NODE() { + if(!is_instanceof(group, Node_VFX_Group)) return self; + return group.getPreviewingNode(); +} + function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor { name = "VFX"; color = COLORS.node_blend_vfx; icon = THEME.vfx; - ungroupable = false; + + topoList = ds_list_create(); + ungroupable = false; + preview_node = noone; + + inputs[| 0] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ) + .rejectArray(); + + custom_input_index = ds_list_size(inputs); if(!LOADING && !APPENDING && !CLONING) { var input = nodeBuild("Node_VFX_Spawner", -256, -32, self); - var renderer = nodeBuild("Node_VFX_Renderer", 256, -32, self); - var output = nodeBuild("Node_Group_Output", 256 + 32 * 5, -32, self); + var output = nodeBuild("Node_VFX_Renderer_Output", 256 + 32 * 5, -32, self); - renderer.inputs[| renderer.input_fix_len].setFrom(input.outputs[| 0]); - output.inputs[| 0].setFrom(renderer.outputs[| 0]); + output.inputs[| output.input_fix_len].setFrom(input.outputs[| 0]); + preview_node = output; } - PATCH_STATIC + static reset = function() { + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { + var node = nodes[| i]; + if(is_instanceof(node, Node_VFX_Spawner_Base)) + node.reset(); + } + + var loop = getInputData(0); + if(!loop) return; + + for( var i = 0; i < TOTAL_FRAMES; i++ ) + for( var j = 0, m = ds_list_size(topoList); j < m; j++ ) { + var node = topoList[| j]; + if(is_instanceof(node, Node_VFX_Renderer_Output) || + is_instanceof(node, Node_VFX_Renderer)) continue; + + node.update(i); + } + + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { + var node = nodes[| i]; + if(!is_instanceof(node, Node_VFX_Spawner_Base)) continue; + + node.seed = node.getInputData(32); + } + } + + static update = function() { + if(CURRENT_FRAME == 0) { + NodeListSort(topoList, nodes); + reset(); + } + } + + static ononDoubleClick = function(panel) { #region + preview_node = noone; + + for( var i = 0, n = ds_list_size(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; + break; + } + } + } #endregion + + getPreviewingNode = function() { return preview_node; } } \ No newline at end of file diff --git a/scripts/node_VFX_override/node_VFX_override.gml b/scripts/node_VFX_override/node_VFX_override.gml index 8857f4442..99973a718 100644 --- a/scripts/node_VFX_override/node_VFX_override.gml +++ b/scripts/node_VFX_override/node_VFX_override.gml @@ -29,7 +29,7 @@ function Node_VFX_Override(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, -1 ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var parts = getInputData(0); if(!is_array(parts)) return; @@ -73,4 +73,6 @@ function Node_VFX_Override(_x, _y, _group = noone) : Node(_x, _y, _group) constr var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } + + getPreviewingNode = VFX_PREVIEW_NODE; } \ No newline at end of file diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index 590549223..b57228699 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -34,7 +34,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onInspector2Update = function() { clearCache(); } - static refreshDynamicInput = function() { + static refreshDynamicInput = function() { #region var _l = ds_list_create(); for( var i = 0; i < ds_list_size(inputs); i++ ) { if(i < input_fix_len || inputs[| i].value_from) @@ -50,24 +50,27 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs = _l; createNewInput(); - } + } #endregion - static onValueFromUpdate = function(index) { + static onValueFromUpdate = function(index) { #region if(index < input_fix_len) return; if(LOADING || APPENDING) return; refreshDynamicInput(); - } + } #endregion - static step = function() { + static step = function() { #region var _dim = getInputData(0); var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); outputs[| 0].setValue(_outSurf); - } + + if(previewing && is_instanceof(group, Node_VFX_Group)) + group.preview_node = self; + } #endregion - static update = function(_time = PROJECT.animator.current_frame) { + static update = function(_time = CURRENT_FRAME) { #region if(!PROJECT.animator.is_playing) { recoverCache(); return; @@ -112,5 +115,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr surface_reset_shader(); cacheCurrentFrame(_outSurf); - } + } #endregion + + getPreviewingNode = VFX_PREVIEW_NODE; } \ No newline at end of file diff --git a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml new file mode 100644 index 000000000..9f8d0af1f --- /dev/null +++ b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml @@ -0,0 +1,165 @@ +function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y, _group) constructor { + name = "Renderer"; + color = COLORS.node_blend_vfx; + icon = THEME.vfx; + use_cache = CACHE_USE.auto; + + w = 128; + h = 128; + min_h = h; + previewable = true; + + inputs[| 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.") + .rejectArray(); + + inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Alpha", "Additive" ]) + .rejectArray(); + + setIsDynamicInput(1); + + attribute_surface_depth(); + attribute_interpolation(); + + insp2UpdateTooltip = "Clear cache"; + insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ]; + + static onInspector2Update = function() { clearCache(); } + + static createNewInput = function() { #region + var index = ds_list_size(inputs); + inputs[| index] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone ) + .setVisible(true, true); + } if(!LOADING && !APPENDING) createNewInput(); #endregion + + 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("Rendered", 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 refreshDynamicInput = function() { #region + var _l = ds_list_create(); + for( var i = 0; i < ds_list_size(inputs); i++ ) { + if(i < input_fix_len || inputs[| i].value_from) + ds_list_add(_l, inputs[| i]); + else + delete inputs[| i]; + } + + for( var i = 0; i < ds_list_size(_l); i++ ) + _l[| i].index = i; + + ds_list_destroy(inputs); + inputs = _l; + + createNewInput(); + } #endregion + + static onValueFromUpdate = function(index) { #region + if(index < input_fix_len) return; + if(LOADING || APPENDING) return; + + refreshDynamicInput(); + } #endregion + + static step = function() { #region + var _dim = getInputData(0); + var _outSurf = outParent.getValue(); + + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); + outParent.setValue(_outSurf); + + if(previewing && is_instanceof(group, Node_VFX_Group)) + group.preview_node = self; + } #endregion + + static update = function(_time = CURRENT_FRAME) { #region + if(!is_instanceof(outParent, NodeValue)) return noone; + + var _dim = inputs[| 0].getValue(_time); + var _exact = inputs[| 1].getValue(_time); + var _blend = inputs[| 2].getValue(_time); + + var _outSurf = outParent.getValue(); + + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); + outParent.setValue(_outSurf); + + surface_set_shader(_outSurf); + shader_set_interpolation(_outSurf); + + if(_blend == PARTICLE_BLEND_MODE.normal) + BLEND_NORMAL; + else if(_blend == PARTICLE_BLEND_MODE.alpha) + BLEND_ALPHA; + else if(_blend == PARTICLE_BLEND_MODE.additive) + BLEND_ADD; + + var surf_w = surface_get_width_safe(_outSurf); + var surf_h = surface_get_height_safe(_outSurf); + + for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + var parts = inputs[| i].getValue(_time); + + if(!is_array(parts) || array_length(parts) == 0) continue; + if(!is_array(parts[0])) parts = [ parts ]; + + //var drawnParts = 0; + + for(var j = 0; j < array_length(parts); j++) + for(var k = 0; k < array_length(parts[j]); k++) { + if(!parts[j][k].active) continue; + + //drawnParts++; + parts[j][k].draw(_exact, surf_w, surf_h); + } + + //print($"Renderer input index {i}: {drawnParts} particles drawn."); + } + + BLEND_NORMAL; + surface_reset_shader(); + + cacheCurrentFrame(_outSurf); + } #endregion + + static recoverCache = function(frame = CURRENT_FRAME) { #region + if(!is_instanceof(outParent, NodeValue)) return false; + if(!cacheExist(frame)) return false; + + var _s = cached_output[CURRENT_FRAME]; + outParent.setValue(_s); + + return true; + } #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 + + getPreviewingNode = VFX_PREVIEW_NODE; +} \ No newline at end of file diff --git a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy new file mode 100644 index 000000000..305a3b0e5 --- /dev/null +++ b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_VFX_renderer_output", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "VFX", + "path": "folders/nodes/data/simulation/VFX.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index 2eb257bb3..02882d407 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -5,26 +5,24 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y attributes.Output_pool = false; + inputs[| 21].setVisible(false, false); + inputs[| input_len + 0] = nodeValue("Spawn trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, false) .setVisible(true, true); inputs[| input_len + 1] = nodeValue("Step interval", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "How often the 'on step' event is triggered.\nWith 1 being trigger every frame, 2 means triggered once every 2 frames."); - outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, [] ); - outputs[| 1] = nodeValue("On create", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 2] = nodeValue("On step", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 3] = nodeValue("On destroy", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, [] ); + outputs[| 1] = nodeValue("On create", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 2] = nodeValue("On step", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 3] = nodeValue("On destroy", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); array_insert(input_display_list, 0, ["Trigger", true], input_len + 0, input_len + 1); UPDATE_PART_FORWARD - static onUpdate = function() { #region - RETURN_ON_REST - - if(PROJECT.animator.current_frame == 0) - reset(); - runVFX(PROJECT.animator.current_frame); + static onUpdate = function(frame = CURRENT_FRAME) { #region + runVFX(frame); if(attributes.Output_pool) { outputs[| 0].setValue(parts); @@ -52,7 +50,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { var _n = vt.value_to[| i]; if(_n.value_from != vt) continue; - _n.node.spawn(, pv); + _n.node.spawn(part.frame, pv); } } #endregion @@ -65,7 +63,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { var _n = vt.value_to[| i]; if(_n.value_from != vt) continue; - _n.node.spawn(, pv); + _n.node.spawn(part.frame, pv); } } #endregion @@ -78,7 +76,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { var _n = vt.value_to[| i]; if(_n.value_from != vt) continue; - _n.node.spawn(, pv); + _n.node.spawn(part.frame, pv); } } #endregion @@ -99,5 +97,6 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y var ss = min((w - 8) / surface_get_width_safe(spr), (h - 8) / surface_get_height_safe(spr)) * _s; draw_surface_align(spr, cx, cy, ss, fa_center, fa_center); } #endregion - + + getPreviewingNode = VFX_PREVIEW_NODE; } \ No newline at end of file diff --git a/scripts/node_VFX_variable/node_VFX_variable.gml b/scripts/node_VFX_variable/node_VFX_variable.gml index 9e229422e..3f5c1ac88 100644 --- a/scripts/node_VFX_variable/node_VFX_variable.gml +++ b/scripts/node_VFX_variable/node_VFX_variable.gml @@ -44,7 +44,7 @@ function Node_VFX_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var parts = getInputData(0); if(!is_array(parts)) return; @@ -75,4 +75,6 @@ function Node_VFX_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) constr var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } + + getPreviewingNode = VFX_PREVIEW_NODE; } \ No newline at end of file diff --git a/scripts/node_animate_curve/node_animate_curve.gml b/scripts/node_animate_curve/node_animate_curve.gml index b5f6952f3..cd68b2737 100644 --- a/scripts/node_animate_curve/node_animate_curve.gml +++ b/scripts/node_animate_curve/node_animate_curve.gml @@ -26,7 +26,7 @@ function Node_Anim_Curve(_x, _y, _group = noone) : Node_Processor(_x, _y, _group static processData = function(_output, _data, _output_index, _array_index = 0) { var curve = _data[0]; - var time = _data[4]? PROJECT.animator.current_frame / (PROJECT.animator.frames_total - 1) : _data[1]; + var time = _data[4]? CURRENT_FRAME / (TOTAL_FRAMES - 1) : _data[1]; var _min = _data[2]; var _max = _data[3]; var val = eval_curve_x(curve, time) * (_max - _min) + _min; diff --git a/scripts/node_animation_control/node_animation_control.gml b/scripts/node_animation_control/node_animation_control.gml index 082e33aef..22a7dd173 100644 --- a/scripts/node_animation_control/node_animation_control.gml +++ b/scripts/node_animation_control/node_animation_control.gml @@ -39,7 +39,7 @@ function Node_Animation_Control(_x, _y, _group = noone) : Node(_x, _y, _group) c if(getInputData(5)) { var fr = getInputData(6); - PROJECT.animator.setFrame(PROJECT.animator.current_frame + fr); + PROJECT.animator.setFrame(CURRENT_FRAME + fr); } } diff --git a/scripts/node_armature/node_armature.gml b/scripts/node_armature/node_armature.gml index ae981b371..1836a04ab 100644 --- a/scripts/node_armature/node_armature.gml +++ b/scripts/node_armature/node_armature.gml @@ -563,7 +563,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo } - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region outputs[| 0].setValue(attributes.bones); } #endregion diff --git a/scripts/node_armature_pose/node_armature_pose.gml b/scripts/node_armature_pose/node_armature_pose.gml index 69cb9917b..73f5c576e 100644 --- a/scripts/node_armature_pose/node_armature_pose.gml +++ b/scripts/node_armature_pose/node_armature_pose.gml @@ -236,7 +236,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const if(_boneCount != _b.childCount()) setBone(); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var _b = getInputData(0); if(_b == noone) return; diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index 5bee9b672..b4316c813 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -146,7 +146,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { refreshDynamicInput(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _typ = getType(); outputs[| 0].setType(_typ); diff --git a/scripts/node_array_add/node_array_add.gml b/scripts/node_array_add/node_array_add.gml index 5347f0e15..c64140139 100644 --- a/scripts/node_array_add/node_array_add.gml +++ b/scripts/node_array_add/node_array_add.gml @@ -51,7 +51,7 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); if(inputs[| 0].value_from == noone) { diff --git a/scripts/node_array_composite/node_array_composite.gml b/scripts/node_array_composite/node_array_composite.gml index 73e108575..75c9a046f 100644 --- a/scripts/node_array_composite/node_array_composite.gml +++ b/scripts/node_array_composite/node_array_composite.gml @@ -31,7 +31,7 @@ function Node_Array_Composite(_x, _y, _group = noone) : Node(_x, _y, _group) con }); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _ker = getInputData(1); diff --git a/scripts/node_array_convolute/node_array_convolute.gml b/scripts/node_array_convolute/node_array_convolute.gml index f2a601853..b6c0e79c3 100644 --- a/scripts/node_array_convolute/node_array_convolute.gml +++ b/scripts/node_array_convolute/node_array_convolute.gml @@ -39,7 +39,7 @@ function Node_Array_Convolute(_x, _y, _group = noone) : Node(_x, _y, _group) con }); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _ker = getInputData(1); diff --git a/scripts/node_array_copy/node_array_copy.gml b/scripts/node_array_copy/node_array_copy.gml index 117af9986..674969a56 100644 --- a/scripts/node_array_copy/node_array_copy.gml +++ b/scripts/node_array_copy/node_array_copy.gml @@ -25,7 +25,7 @@ function Node_Array_Copy(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0].setType(_typ); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _ind = getInputData(1); var _siz = getInputData(2); diff --git a/scripts/node_array_csv_parse/node_array_csv_parse.gml b/scripts/node_array_csv_parse/node_array_csv_parse.gml index 9b0ff7466..e7e9894b5 100644 --- a/scripts/node_array_csv_parse/node_array_csv_parse.gml +++ b/scripts/node_array_csv_parse/node_array_csv_parse.gml @@ -14,7 +14,7 @@ function Node_Array_CSV_Parse(_x, _y, _group = noone) : Node(_x, _y, _group) con outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0) .setArrayDepth(1); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _str = getInputData(0); var _skp = getInputData(1); diff --git a/scripts/node_array_find/node_array_find.gml b/scripts/node_array_find/node_array_find.gml index 8aa298128..2cfea0f90 100644 --- a/scripts/node_array_find/node_array_find.gml +++ b/scripts/node_array_find/node_array_find.gml @@ -15,7 +15,7 @@ function Node_Array_Find(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0] = nodeValue("Index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); inputs[| 0].setType(VALUE_TYPE.any); diff --git a/scripts/node_array_get/node_array_get.gml b/scripts/node_array_get/node_array_get.gml index f506b0435..c3bb504a9 100644 --- a/scripts/node_array_get/node_array_get.gml +++ b/scripts/node_array_get/node_array_get.gml @@ -54,7 +54,7 @@ function Node_Array_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct return array_safe_get(_arr, index); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); if(!is_array(_arr)) return; diff --git a/scripts/node_array_insert/node_array_insert.gml b/scripts/node_array_insert/node_array_insert.gml index 684893a84..7c8e1f7d8 100644 --- a/scripts/node_array_insert/node_array_insert.gml +++ b/scripts/node_array_insert/node_array_insert.gml @@ -19,7 +19,7 @@ function Node_Array_Insert(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); inputs[| 0].setType(VALUE_TYPE.any); diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index 63b44cc66..b98f3005b 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -11,7 +11,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); inputs[| 0].setType(inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type); diff --git a/scripts/node_array_range/node_array_range.gml b/scripts/node_array_range/node_array_range.gml index 233bb3e52..df5af4bb5 100644 --- a/scripts/node_array_range/node_array_range.gml +++ b/scripts/node_array_range/node_array_range.gml @@ -15,7 +15,7 @@ function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var st = getInputData(0); var ed = getInputData(1); var step = getInputData(2); diff --git a/scripts/node_array_remove/node_array_remove.gml b/scripts/node_array_remove/node_array_remove.gml index 3f03b9999..a729ebd4c 100644 --- a/scripts/node_array_remove/node_array_remove.gml +++ b/scripts/node_array_remove/node_array_remove.gml @@ -42,7 +42,7 @@ function Node_Array_Remove(_x, _y, _group = noone) : Node(_x, _y, _group) constr } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); if(!is_array(_arr)) return; diff --git a/scripts/node_array_reverse/node_array_reverse.gml b/scripts/node_array_reverse/node_array_reverse.gml index 440f3a8c6..111234972 100644 --- a/scripts/node_array_reverse/node_array_reverse.gml +++ b/scripts/node_array_reverse/node_array_reverse.gml @@ -11,7 +11,7 @@ function Node_Array_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); inputs[| 0].setType(VALUE_TYPE.any); diff --git a/scripts/node_array_set/node_array_set.gml b/scripts/node_array_set/node_array_set.gml index 5624e6b4b..615a80236 100644 --- a/scripts/node_array_set/node_array_set.gml +++ b/scripts/node_array_set/node_array_set.gml @@ -16,7 +16,7 @@ function Node_Array_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); inputs[| 0].setType(VALUE_TYPE.any); diff --git a/scripts/node_array_shift/node_array_shift.gml b/scripts/node_array_shift/node_array_shift.gml index 3ca5b016f..e979c466d 100644 --- a/scripts/node_array_shift/node_array_shift.gml +++ b/scripts/node_array_shift/node_array_shift.gml @@ -13,7 +13,7 @@ function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _shf = getInputData(1); diff --git a/scripts/node_array_shuffle/node_array_shuffle.gml b/scripts/node_array_shuffle/node_array_shuffle.gml index 2051b81a5..60e646a62 100644 --- a/scripts/node_array_shuffle/node_array_shuffle.gml +++ b/scripts/node_array_shuffle/node_array_shuffle.gml @@ -12,7 +12,7 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Shuffled array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var arr = getInputData(0); var sed = getInputData(1); diff --git a/scripts/node_array_sort/node_array_sort.gml b/scripts/node_array_sort/node_array_sort.gml index 7e93a107a..1ac56de4a 100644 --- a/scripts/node_array_sort/node_array_sort.gml +++ b/scripts/node_array_sort/node_array_sort.gml @@ -18,7 +18,7 @@ function Node_Array_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) construc static sortAcs = function(v1, v2) { return v1[1] < v2[1]; } static sortDes = function(v1, v2) { return v1[1] > v2[1]; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var arr = getInputData(0); var asc = getInputData(1); diff --git a/scripts/node_array_zip/node_array_zip.gml b/scripts/node_array_zip/node_array_zip.gml index efb632664..35166f608 100644 --- a/scripts/node_array_zip/node_array_zip.gml +++ b/scripts/node_array_zip/node_array_zip.gml @@ -48,7 +48,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); if(inputs[| 0].value_from == noone) { diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index 758be2980..f83160692 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -122,7 +122,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const var st = tag[? "Frame start"]; var ed = tag[? "Frame end"]; var rn = ed - st + 1; - var progFr = safe_mod(PROJECT.animator.current_frame - _tag_delay, rn) + 1; + var progFr = safe_mod(CURRENT_FRAME - _tag_delay, rn) + 1; var prog = progFr / rn; var txt = ""; @@ -299,7 +299,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); var current_tag = getInputData(2); if(path_current != path) updatePaths(path); @@ -316,7 +316,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const _tag_delay = 0; for( var i = 0; i < ds_list_size(inputs[| 2].animator.values); i++ ) { var kf = inputs[| 2].animator.values[| i]; - if(kf.time > PROJECT.animator.current_frame) break; + if(kf.time > CURRENT_FRAME) break; _tag_delay = kf.time; } @@ -333,7 +333,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const for( var i = 0, n = array_length(layers); i < n; i++ ) { layers[i].tag = tag; - var cel = layers[i].getCel(PROJECT.animator.current_frame - _tag_delay); + var cel = layers[i].getCel(CURRENT_FRAME - _tag_delay); if(!cel) continue; if(!array_safe_get(vis, i, true)) continue; diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index 4bc6f4106..cbcd8ffcd 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -34,7 +34,7 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var data = getInputData(0); if(data == noone) return; @@ -44,7 +44,7 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct } if(layer_object == noone) return; - var cel = layer_object.getCel(PROJECT.animator.current_frame - data._tag_delay); + var cel = layer_object.getCel(CURRENT_FRAME - data._tag_delay); var celDim = getInputData(1); var ww = data.content[? "Width"]; diff --git a/scripts/node_atlas_draw/node_atlas_draw.gml b/scripts/node_atlas_draw/node_atlas_draw.gml index 3353325a7..72c769f91 100644 --- a/scripts/node_atlas_draw/node_atlas_draw.gml +++ b/scripts/node_atlas_draw/node_atlas_draw.gml @@ -12,7 +12,7 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_interpolation(true); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var dim = getInputData(0); var atl = getInputData(1); diff --git a/scripts/node_atlas_get/node_atlas_get.gml b/scripts/node_atlas_get/node_atlas_get.gml index a2782545e..a3a8493d2 100644 --- a/scripts/node_atlas_get/node_atlas_get.gml +++ b/scripts/node_atlas_get/node_atlas_get.gml @@ -25,7 +25,7 @@ function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) .setArrayDepth(1); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var atl = getInputData(0); if(atl == noone) return; diff --git a/scripts/node_atlas_set/node_atlas_set.gml b/scripts/node_atlas_set/node_atlas_set.gml index bb5b47c12..e5e30bf45 100644 --- a/scripts/node_atlas_set/node_atlas_set.gml +++ b/scripts/node_atlas_set/node_atlas_set.gml @@ -27,7 +27,7 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var atl = getInputData(0); if(atl == noone) return; diff --git a/scripts/node_audio_window/node_audio_window.gml b/scripts/node_audio_window/node_audio_window.gml index 52ea7be22..9429349f2 100644 --- a/scripts/node_audio_window/node_audio_window.gml +++ b/scripts/node_audio_window/node_audio_window.gml @@ -46,7 +46,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr update_on_frame = _anim; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _aud = getInputData(0); if(!is_instanceof(_aud, audioObject)) return; diff --git a/scripts/node_cache/node_cache.gml b/scripts/node_cache/node_cache.gml index 00b0562d9..388760876 100644 --- a/scripts/node_cache/node_cache.gml +++ b/scripts/node_cache/node_cache.gml @@ -26,7 +26,7 @@ function Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { cache_result[cache_loading_progress] = true; cache_loading_progress++; - if(cache_loading_progress == PROJECT.animator.frames_total) { + if(cache_loading_progress == TOTAL_FRAMES) { cache_loading = false; update(); } diff --git a/scripts/node_cache_array/node_cache_array.gml b/scripts/node_cache_array/node_cache_array.gml index 676ff39be..076d3bde9 100644 --- a/scripts/node_cache_array/node_cache_array.gml +++ b/scripts/node_cache_array/node_cache_array.gml @@ -49,13 +49,13 @@ function Node_Cache_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constru var stp = getInputData(3); if(str < 0) str = 1; - if(lst < 0) lst = PROJECT.animator.frames_total; + if(lst < 0) lst = TOTAL_FRAMES; str -= 1; lst -= 1; - if(PROJECT.animator.current_frame < str) return; - if(PROJECT.animator.current_frame > lst) return; + if(CURRENT_FRAME < str) return; + if(CURRENT_FRAME > lst) return; if(lst > str && stp > 0) for( var i = str; i <= lst; i += stp ) { diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 5817ac34d..6affbc09c 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -990,10 +990,10 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor update_on_frame = fram > 1 && anim; if(update_on_frame) - preview_index = safe_mod(PROJECT.animator.current_frame * anims, fram); + preview_index = safe_mod(CURRENT_FRAME * anims, fram); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var _dim = getInputData(0); var _bg = getInputData(8); var _bga = getInputData(9); @@ -1035,7 +1035,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } if(_anim) { - var _fr_index = safe_mod(PROJECT.animator.current_frame * _anims, _frames); + var _fr_index = safe_mod(CURRENT_FRAME * _anims, _frames); outputs[| 0].setValue(output_surface[_fr_index]); } else outputs[| 0].setValue(output_surface); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index bfba56963..3f2822ae4 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -156,12 +156,14 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region if(!draw_input_overlay) return; + for(var i = custom_input_index; i < ds_list_size(inputs); i++) { var _in = inputs[| i]; var _show = _in.from.getInputData(6); if(!_show) continue; - _in.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + var _hov = _in.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + if(_hov != undefined) active &= !_hov; } } #endregion @@ -296,7 +298,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static stepBegin = function() { #region use_cache = CACHE_USE.none; - array_safe_set(cache_result, PROJECT.animator.current_frame, true); + array_safe_set(cache_result, CURRENT_FRAME, true); var node_list = getNodeList(); for(var i = 0; i < ds_list_size(node_list); i++) { @@ -305,8 +307,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(!_node.use_cache) continue; use_cache = CACHE_USE.manual; - if(!array_safe_get(_node.cache_result, PROJECT.animator.current_frame)) - array_safe_set(cache_result, PROJECT.animator.current_frame, false); + if(!array_safe_get(_node.cache_result, CURRENT_FRAME)) + array_safe_set(cache_result, CURRENT_FRAME, false); } var out_surf = false; @@ -506,8 +508,12 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static onDoubleClick = function(panel) { #region panel.addContext(self); + if(ononDoubleClick != noone) + ononDoubleClick(panel); } #endregion + static ononDoubleClick = noone; + static getGraphPreviewSurface = function() { #region var _output_junc = outputs[| preview_channel]; for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { diff --git a/scripts/node_compare/node_compare.gml b/scripts/node_compare/node_compare.gml index 519a2d30e..bd19ea438 100644 --- a/scripts/node_compare/node_compare.gml +++ b/scripts/node_compare/node_compare.gml @@ -54,7 +54,7 @@ function Node_Compare(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return 0; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var mode = getInputData(0); var a = getInputData(1); var b = getInputData(2); diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index 2caca1476..3dd184fa7 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -51,7 +51,7 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct inputs[| 8].setVisible(_mode == 2, _mode == 2); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _true = getInputData(3); var _fals = getInputData(4); diff --git a/scripts/node_counter/node_counter.gml b/scripts/node_counter/node_counter.gml index f741f3887..148cd7347 100644 --- a/scripts/node_counter/node_counter.gml +++ b/scripts/node_counter/node_counter.gml @@ -27,13 +27,13 @@ function Node_Counter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c } static processData = function(_output, _data, _output_index, _array_index = 0) { - var time = PROJECT.animator.current_frame; + var time = CURRENT_FRAME; var mode = _data[2]; var val = 0; switch(mode) { case 0 : val = _data[0] + time * _data[1]; break; - case 1 : val = time / (PROJECT.animator.frames_total - 1) * _data[1]; break; + case 1 : val = time / (TOTAL_FRAMES - 1) * _data[1]; break; } return val; diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index e8293f40d..491ec012f 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -100,7 +100,7 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const update(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_csv_file_write/node_csv_file_write.gml b/scripts/node_csv_file_write/node_csv_file_write.gml index 01f6154b1..15b6c77d1 100644 --- a/scripts/node_csv_file_write/node_csv_file_write.gml +++ b/scripts/node_csv_file_write/node_csv_file_write.gml @@ -48,7 +48,7 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons file_text_close(f); } - static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } + static update = function(frame = CURRENT_FRAME) { writeFile(); } static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 3eb704d8b..8b73f4378 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -21,7 +21,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x ds_list_add(PANEL_GRAPH.getNodeList(_group), self); active_index = -1; - active_range = [ 0, PROJECT.animator.frames_total - 1 ]; + active_range = [ 0, TOTAL_FRAMES - 1 ]; #endregion static resetInternalName = function() { #region @@ -163,6 +163,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x preview_mx = 0; preview_my = 0; + + getPreviewingNode = noone; #endregion #region ---- rendering ---- @@ -434,11 +436,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return array_safe_get(inputs_data, index, def); } #endregion - static getInputs = function() { #region + static getInputs = function(frame = CURRENT_FRAME) { #region inputs_data = array_create(ds_list_size(inputs), undefined); for(var i = 0; i < ds_list_size(inputs); i++) - inputs_data[i] = inputs[| i].getValue(,,, false); + inputs_data[i] = inputs[| i].getValue(frame,,, false); } #endregion static forceUpdate = function() { #region @@ -1187,26 +1189,26 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } #endregion static cacheArrayCheck = function() { #region - if(array_length(cached_output) != PROJECT.animator.frames_total) - array_resize(cached_output, PROJECT.animator.frames_total); - if(array_length(cache_result) != PROJECT.animator.frames_total) - array_resize(cache_result, PROJECT.animator.frames_total); + if(array_length(cached_output) != TOTAL_FRAMES) + array_resize(cached_output, TOTAL_FRAMES); + if(array_length(cache_result) != TOTAL_FRAMES) + array_resize(cache_result, TOTAL_FRAMES); } #endregion static cacheCurrentFrame = function(_frame) { #region cacheArrayCheck(); - if(PROJECT.animator.current_frame < 0) return; - if(PROJECT.animator.current_frame >= array_length(cached_output)) return; + if(CURRENT_FRAME < 0) return; + if(CURRENT_FRAME >= array_length(cached_output)) return; - surface_array_free(cached_output[PROJECT.animator.current_frame]); - cached_output[PROJECT.animator.current_frame] = surface_array_clone(_frame); + surface_array_free(cached_output[CURRENT_FRAME]); + cached_output[CURRENT_FRAME] = surface_array_clone(_frame); - array_safe_set(cache_result, PROJECT.animator.current_frame, true); + array_safe_set(cache_result, CURRENT_FRAME, true); - return cached_output[PROJECT.animator.current_frame]; + return cached_output[CURRENT_FRAME]; } #endregion - static cacheExist = function(frame = PROJECT.animator.current_frame) { #region + static cacheExist = function(frame = CURRENT_FRAME) { #region if(frame < 0) return false; if(frame >= array_length(cached_output)) return false; @@ -1217,7 +1219,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return is_array(s) || surface_exists(s); } #endregion - static getCacheFrame = function(frame = PROJECT.animator.current_frame) { #region + static getCacheFrame = function(frame = CURRENT_FRAME) { #region if(frame < 0) return false; if(!cacheExist(frame)) return noone; @@ -1225,10 +1227,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return surf; } #endregion - static recoverCache = function(frame = PROJECT.animator.current_frame) { #region + static recoverCache = function(frame = CURRENT_FRAME) { #region if(!cacheExist(frame)) return false; - var _s = cached_output[PROJECT.animator.current_frame]; + var _s = cached_output[CURRENT_FRAME]; outputs[| 0].setValue(_s); return true; @@ -1241,8 +1243,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!use_cache) return; if(!isRenderActive()) return; - if(array_length(cached_output) != PROJECT.animator.frames_total) - array_resize(cached_output, PROJECT.animator.frames_total); + if(array_length(cached_output) != TOTAL_FRAMES) + array_resize(cached_output, TOTAL_FRAMES); for(var i = 0; i < array_length(cached_output); i++) { var _s = cached_output[i]; if(is_surface(_s)) @@ -1715,5 +1717,5 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return surface_get_format(_s); } #endregion - static toString = function() { return $"PixelComposerNode: {node_id}[{internalName}] {input_hash}"; } + static toString = function() { return $"PixelComposerNode [{internalName}]: {node_id}"; } } \ No newline at end of file diff --git a/scripts/node_display_image/node_display_image.gml b/scripts/node_display_image/node_display_image.gml index f0b10e80e..bb17d80a7 100644 --- a/scripts/node_display_image/node_display_image.gml +++ b/scripts/node_display_image/node_display_image.gml @@ -71,7 +71,7 @@ function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) const return false; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_dust/node_dust.gml b/scripts/node_dust/node_dust.gml index f3f3adac8..e37d45618 100644 --- a/scripts/node_dust/node_dust.gml +++ b/scripts/node_dust/node_dust.gml @@ -100,7 +100,7 @@ function Node_Dust(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); outputs[| 0].setValue(_outSurf); - if(PROJECT.animator.current_frame == 0) { + if(CURRENT_FRAME == 0) { dusts = [ new __Dust( 0, _dim[1] / 2 ) ]; } else { for( var i = 0, n = array_length(dusts); i < n; i++ ) diff --git a/scripts/node_dynamic_surface_in/node_dynamic_surface_in.gml b/scripts/node_dynamic_surface_in/node_dynamic_surface_in.gml index 34047eb80..588d67d85 100644 --- a/scripts/node_dynamic_surface_in/node_dynamic_surface_in.gml +++ b/scripts/node_dynamic_surface_in/node_dynamic_surface_in.gml @@ -51,7 +51,7 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } #endregion - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(is_undefined(inParent)) return; var _val = inParent.getValue(); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index d6ce3059b..c9e7fc4d3 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -108,7 +108,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| 11] = nodeValue("Sequence begin", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); inputs[| 12] = nodeValue("Frame range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, -1]) - .setDisplay(VALUE_DISPLAY.slider_range, { range: [0, PROJECT.animator.frames_total, 1] }); + .setDisplay(VALUE_DISPLAY.slider_range, { range: [0, TOTAL_FRAMES, 1] }); png_format = [ "INDEX4", "INDEX8", "Default (PNG32)" ]; png_format_r = [ "PNG4", "PNG8" ]; @@ -369,12 +369,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var float_str = string_digits(str); if(float_str != "") { var float_val = string_digits(float_str); - var str_val = max(float_val - string_length(string(PROJECT.animator.current_frame + strt)), 0); + var str_val = max(float_val - string_length(string(CURRENT_FRAME + strt)), 0); repeat(str_val) _txt += "0"; } - _txt += string(PROJECT.animator.current_frame + strt); + _txt += string(CURRENT_FRAME + strt); if(_array) array_push(s, [ "f", _txt ]); else s += _txt; res = true; @@ -510,10 +510,10 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(form >= 1) { var rng_s = rang[0]; - var rng_e = rang[1] == -1? PROJECT.animator.frames_total : rang[1]; + var rng_e = rang[1] == -1? TOTAL_FRAMES : rang[1]; - if(PROJECT.animator.current_frame < rng_s) return; - if(PROJECT.animator.current_frame > rng_e) return; + if(CURRENT_FRAME < rng_s) return; + if(CURRENT_FRAME > rng_e) return; } if(is_array(surf)) { @@ -523,7 +523,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(!is_surface(_surf)) continue; if(form == NODE_EXPORT_FORMAT.gif) { - p = directory + "/" + string(i) + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png"; + p = directory + "/" + string(i) + "/" + string_lead_zero(CURRENT_FRAME, 5) + ".png"; } else { if(is_array(path) && array_length(path) == array_length(surf)) p = pathString(path[ safe_mod(i, array_length(path)) ], i); @@ -546,7 +546,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(is_array(path)) p = path[0]; if(form == NODE_EXPORT_FORMAT.gif) - p = directory + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png"; + p = directory + "/" + string_lead_zero(CURRENT_FRAME, 5) + ".png"; else p = pathString(p); @@ -596,7 +596,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor playing = true; played = 0; PROJECT.animator.real_frame = -1; - PROJECT.animator.current_frame = -1; + CURRENT_FRAME = -1; PROJECT.animator.is_playing = true; PROJECT.animator.rendering = true; @@ -628,7 +628,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| 8].setVisible(anim == 2); inputs[| 11].setVisible(anim == 1); inputs[| 12].setVisible(anim > 0); - inputs[| 12].editWidget.maxx = PROJECT.animator.frames_total; + inputs[| 12].editWidget.maxx = TOTAL_FRAMES; inputs[| 13].setVisible(anim < 2); if(anim == NODE_EXPORT_FORMAT.gif) { @@ -644,7 +644,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor outputs[| 0].visible = isInLoop(); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var anim = getInputData(3); if(anim == NODE_EXPORT_FORMAT.single) { if(isInLoop()) export(); @@ -656,12 +656,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return; } - if(!PROJECT.animator.frame_progress || !playing || PROJECT.animator.current_frame <= -1) + if(!PROJECT.animator.frame_progress || !playing || CURRENT_FRAME <= -1) return; export(); - if(PROJECT.animator.current_frame < PROJECT.animator.frames_total - 1) + if(CURRENT_FRAME < TOTAL_FRAMES - 1) return; if(anim != NODE_EXPORT_FORMAT.gif) diff --git a/scripts/node_feedback_input/node_feedback_input.gml b/scripts/node_feedback_input/node_feedback_input.gml index cf3bb4add..11e2742d6 100644 --- a/scripts/node_feedback_input/node_feedback_input.gml +++ b/scripts/node_feedback_input/node_feedback_input.gml @@ -15,7 +15,7 @@ function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, _node_output = vt; } - if(PROJECT.animator.current_frame > 0 && _node_output != noone && _node_output.node.cache_value != noone) //use cache from output + if(CURRENT_FRAME > 0 && _node_output != noone && _node_output.node.cache_value != noone) //use cache from output return [ _node_output.node.cache_value, inParent ]; return outputs[| 0].getValueDefault(); diff --git a/scripts/node_feedback_output/node_feedback_output.gml b/scripts/node_feedback_output/node_feedback_output.gml index a1b0efd4d..23ac4ef64 100644 --- a/scripts/node_feedback_output/node_feedback_output.gml +++ b/scripts/node_feedback_output/node_feedback_output.gml @@ -11,9 +11,9 @@ function Node_Feedback_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y cache_value = -1; - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(inputs[| 0].value_from == noone) return; - if(PROJECT.animator.current_frame == PROJECT.animator.frames_total - 1) { + if(CURRENT_FRAME == TOTAL_FRAMES - 1) { cache_value = noone; return; } diff --git a/scripts/node_fluid_add/node_fluid_add.gml b/scripts/node_fluid_add/node_fluid_add.gml index 8772427f0..01e9709be 100644 --- a/scripts/node_fluid_add/node_fluid_add.gml +++ b/scripts/node_fluid_add/node_fluid_add.gml @@ -54,7 +54,7 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _pos = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_add_collider/node_fluid_add_collider.gml b/scripts/node_fluid_add_collider/node_fluid_add_collider.gml index d3a0ae87a..df967228d 100644 --- a/scripts/node_fluid_add_collider/node_fluid_add_collider.gml +++ b/scripts/node_fluid_add_collider/node_fluid_add_collider.gml @@ -34,7 +34,7 @@ function Node_Fluid_Add_Collider(_x, _y, _group = noone) : Node_Fluid(_x, _y, _g inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _area = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml index eea8c35e7..2dba9d3e8 100644 --- a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml +++ b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml @@ -39,7 +39,7 @@ function Node_Fluid_Apply_Velocity(_x, _y, _group = noone) : Node_Fluid(_x, _y, inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _pos = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_domain/node_fluid_domain.gml b/scripts/node_fluid_domain/node_fluid_domain.gml index 211f1cd18..7298d3cd2 100644 --- a/scripts/node_fluid_domain/node_fluid_domain.gml +++ b/scripts/node_fluid_domain/node_fluid_domain.gml @@ -51,7 +51,7 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) domain = fd_rectangle_create(256, 256); _dim_old = [0, 0]; - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region RETURN_ON_REST var _dim = inputs[| 0].getValue(frame); @@ -67,7 +67,7 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) var vMac = inputs[| 10].getValue(frame); var wrap = inputs[| 11].getValue(frame); - if(PROJECT.animator.current_frame == 0 || !is_surface(domain.sf_world)) { + if(CURRENT_FRAME == 0 || !is_surface(domain.sf_world)) { fd_rectangle_clear(domain); fd_rectangle_destroy(domain); domain = fd_rectangle_create(_dim[0], _dim[1]); diff --git a/scripts/node_fluid_render/node_fluid_render.gml b/scripts/node_fluid_render/node_fluid_render.gml index 3045a3318..17e56e63e 100644 --- a/scripts/node_fluid_render/node_fluid_render.gml +++ b/scripts/node_fluid_render/node_fluid_render.gml @@ -41,7 +41,7 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(recoverCache() || !PROJECT.animator.is_playing) return; diff --git a/scripts/node_fluid_render_output/node_fluid_render_output.gml b/scripts/node_fluid_render_output/node_fluid_render_output.gml index ef10eba0c..5735474e7 100644 --- a/scripts/node_fluid_render_output/node_fluid_render_output.gml +++ b/scripts/node_fluid_render_output/node_fluid_render_output.gml @@ -45,7 +45,7 @@ function Node_Fluid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x if(!is_undefined(outParent)) ds_list_remove(group.outputs, outParent); - outParent = nodeValue("Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone) + outParent = nodeValue("Rendered", group, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone) .uncache() .setVisible(true, true); outParent.from = self; @@ -60,7 +60,7 @@ function Node_Fluid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x outParent.name = display_name; } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region if(!is_instanceof(outParent, NodeValue)) return noone; var _dim = inputs[| 1].getValue(frame); @@ -94,11 +94,11 @@ function Node_Fluid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x cacheCurrentFrame(_outSurf); } #endregion - static recoverCache = function(frame = PROJECT.animator.current_frame) { #region + static recoverCache = function(frame = CURRENT_FRAME) { #region if(!is_instanceof(outParent, NodeValue)) return false; if(!cacheExist(frame)) return false; - var _s = cached_output[PROJECT.animator.current_frame]; + var _s = cached_output[CURRENT_FRAME]; outParent.setValue(_s); return true; diff --git a/scripts/node_fluid_repulse/node_fluid_repulse.gml b/scripts/node_fluid_repulse/node_fluid_repulse.gml index 645571a0d..1b1f7884a 100644 --- a/scripts/node_fluid_repulse/node_fluid_repulse.gml +++ b/scripts/node_fluid_repulse/node_fluid_repulse.gml @@ -37,7 +37,7 @@ function Node_Fluid_Repulse(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _pos = inputs[| 1].getValue(frame); var _rad = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_sim/node_fluid_sim.gml b/scripts/node_fluid_sim/node_fluid_sim.gml index 3579d7ef2..bc57c53c4 100644 --- a/scripts/node_fluid_sim/node_fluid_sim.gml +++ b/scripts/node_fluid_sim/node_fluid_sim.gml @@ -81,7 +81,7 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro var vMac = getInputData(10); var wrap = getInputData(11); - if(PROJECT.animator.current_frame == 0 || !is_surface(domain.sf_world)) { + if(CURRENT_FRAME == 0 || !is_surface(domain.sf_world)) { fd_rectangle_clear(domain); fd_rectangle_destroy(domain); domain = fd_rectangle_create(_dim[0], _dim[1]); diff --git a/scripts/node_fluid_turbulence/node_fluid_turbulence.gml b/scripts/node_fluid_turbulence/node_fluid_turbulence.gml index 64935481b..1444a4710 100644 --- a/scripts/node_fluid_turbulence/node_fluid_turbulence.gml +++ b/scripts/node_fluid_turbulence/node_fluid_turbulence.gml @@ -31,7 +31,7 @@ function Node_Fluid_Turbulence(_x, _y, _group = noone) : Node_Fluid(_x, _y, _gro inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _are = inputs[| 1].getValue(frame); var _str = inputs[| 2].getValue(frame); @@ -57,11 +57,9 @@ function Node_Fluid_Turbulence(_x, _y, _group = noone) : Node_Fluid(_x, _y, _gro shader_reset(); surface_reset_target(); - with(_dom) { - fd_rectangle_set_target(id, _mod? FD_TARGET_TYPE.ADD_VELOCITY : FD_TARGET_TYPE.REPLACE_VELOCITY); - draw_surface_safe(vSurface, 0, 0); - fd_rectangle_reset_target(id); - } + fd_rectangle_set_target(_dom, _mod? FD_TARGET_TYPE.ADD_VELOCITY : FD_TARGET_TYPE.REPLACE_VELOCITY); + draw_surface_safe(vSurface, 0, 0); + fd_rectangle_reset_target(_dom); surface_free(vSurface); } diff --git a/scripts/node_fluid_update/node_fluid_update.gml b/scripts/node_fluid_update/node_fluid_update.gml index d389a9d7d..ab103e318 100644 --- a/scripts/node_fluid_update/node_fluid_update.gml +++ b/scripts/node_fluid_update/node_fluid_update.gml @@ -17,7 +17,7 @@ function Node_Fluid_Update(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) outputs[| 0] = nodeValue("Fluid Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!PROJECT.animator.is_playing) return; var _dom = inputs[| 0].getValue(frame); diff --git a/scripts/node_fluid_vortex/node_fluid_vortex.gml b/scripts/node_fluid_vortex/node_fluid_vortex.gml index e8f72b7cb..e9d47fea9 100644 --- a/scripts/node_fluid_vortex/node_fluid_vortex.gml +++ b/scripts/node_fluid_vortex/node_fluid_vortex.gml @@ -41,7 +41,7 @@ function Node_Fluid_Vortex(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _dom = inputs[| 0].getValue(frame); var _pos = inputs[| 1].getValue(frame); var _rad = inputs[| 2].getValue(frame); diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 8fafcfedb..a0a74ace4 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -135,7 +135,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region if(inParent.isArray()) return; - inParent.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + return inParent.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } #endregion static onValueUpdate = function(index = 0) { #region @@ -358,7 +358,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru PATCH_STATIC - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region if(is_undefined(inParent)) return; } #endregion diff --git a/scripts/node_guide/node_guide.gml b/scripts/node_guide/node_guide.gml index a30c89e91..be8a892e1 100644 --- a/scripts/node_guide/node_guide.gml +++ b/scripts/node_guide/node_guide.gml @@ -92,6 +92,7 @@ function __generate_node_data() { #region for( var i = 0, n = array_length(_keys); i < n; i++ ) { var _group = _json[$ _keys[i]]; + if(!struct_has(_rel, _keys[i])) _rel[$ _keys[i]] = { relations : {} }; var _Vgroup = _rel[$ _keys[i]].relations; @@ -105,6 +106,13 @@ function __generate_node_data() { #region array_append(_Vgroup[$ _k], _group.relations[$ _types[j]]); } break; + case "contextNode" : + var _nodes = variable_struct_get_names(_group.relations); + for( var j = 0, m = array_length(_nodes); j < m; j++ ) { + if(!struct_has(_Vgroup, _nodes[j])) _Vgroup[$ _nodes[j]] = []; + array_append(_Vgroup[$ _nodes[j]], _group.relations[$ _nodes[j]]); + } + break; } } } diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 0644f00f3..4289152e3 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -91,7 +91,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { update(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); var pad = getInputData(1); if(path == "") return; diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index 543133d4c..3b6ff4edb 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -59,7 +59,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons inputs[| 5] = nodeValue("Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0) .setDisplay(VALUE_DISPLAY.button, { name: "Match length", onClick: function() { if(array_length(spr) == 0) return; - PROJECT.animator.frames_total = array_length(spr); + TOTAL_FRAMES = array_length(spr); } }); inputs[| 6] = nodeValue("Custom frame order", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); @@ -149,7 +149,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons inputs[| 4].setVisible(!_cus && !str); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var path = getInputData(0); if(path == "") return; if(is_array(path) && !array_equals(path, path_loaded)) @@ -161,9 +161,9 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons var _cus = getInputData(6); var _str = getInputData(2); var _end = getInputData(4); - var _spd = _str? (PROJECT.animator.frames_total + 1) / array_length(spr) : 1 / getInputData(3); + var _spd = _str? (TOTAL_FRAMES + 1) / array_length(spr) : 1 / getInputData(3); if(_spd == 0) _spd = 1; - var _frame = _cus? getInputData(7) : floor(PROJECT.animator.current_frame / _spd); + var _frame = _cus? getInputData(7) : floor(CURRENT_FRAME / _spd); var _len = array_length(spr); var _drw = true; diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 511e059ce..5d7a78437 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -35,7 +35,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct .setDisplay(VALUE_DISPLAY.button, { name: "Match length", onClick: function() { if(!spr) return; if(!sprite_exists(spr)) return; - PROJECT.animator.frames_total = sprite_get_number(spr); + TOTAL_FRAMES = sprite_get_number(spr); PROJECT.animator.framerate = 12; } }); @@ -138,7 +138,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var path = getInputData(0); if(path == "") return; if(path_current != path) updatePaths(path); @@ -176,7 +176,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _strt = getInputData(4); var _cust = getInputData(5); var _spd = getInputData(7); - var _frm = _cust? getInputData(6) : PROJECT.animator.current_frame * _spd - _strt; + var _frm = _cust? getInputData(6) : CURRENT_FRAME * _spd - _strt; var _len = sprite_get_number(spr); var _drw = true; diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index 8cfc33bdb..e605908a5 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -122,7 +122,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons return true; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path == "") return; if(!is_array(path)) path = [ path ]; diff --git a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml index 9d438af4d..cd33a2d98 100644 --- a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml +++ b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml @@ -59,7 +59,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru .setDisplay(VALUE_DISPLAY.button, { name: "Sync frames", onClick: function() { var _atl = outputs[| 1].getValue(); var _spd = getInputData(8); - PROJECT.animator.frames_total = max(1, _spd == 0? 1 : ceil(array_length(_atl) / _spd)); + TOTAL_FRAMES = max(1, _spd == 0? 1 : ceil(array_length(_atl) / _spd)); } }); inputs[| 12] = nodeValue("Filter empty output", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); @@ -368,7 +368,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru surface_free(_empS); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(isInLoop()) doInspectorAction(); var _out = getInputData(7); @@ -382,7 +382,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru update_on_frame = true; if(array_length(surf_array)) { - var ind = safe_mod(PROJECT.animator.current_frame * _spd, array_length(surf_array)); + var ind = safe_mod(CURRENT_FRAME * _spd, array_length(surf_array)); outputs[| 0].setValue(array_safe_get(surf_array, ind)); } } diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index c65c25da3..c94eae45e 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -39,7 +39,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr inputs[| 0].setType(type); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region if(frame == 0) { NodeListSort(topoList, nodes); diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.gml b/scripts/node_iterator_each_output/node_iterator_each_output.gml index 8cc885166..e1db3662e 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -37,7 +37,7 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group return _new_val; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(inputs[| 0].value_from == noone) { group.iterationUpdate(); return; diff --git a/scripts/node_iterator_each_size/node_iterator_each_size.gml b/scripts/node_iterator_each_size/node_iterator_each_size.gml index 08645e6bb..cfa33bbda 100644 --- a/scripts/node_iterator_each_size/node_iterator_each_size.gml +++ b/scripts/node_iterator_each_size/node_iterator_each_size.gml @@ -9,7 +9,7 @@ function Node_Iterator_Each_Length(_x, _y, _group = noone) : Node(_x, _y, _group outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!variable_struct_exists(group, "iterated")) return; var val = group.getInputData(0); outputs[| 0].setValue(array_length(val)); diff --git a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml index ecbd9239b..bf508ebd0 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -23,7 +23,7 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro group.outputs[| 0].setType(type); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(inputs[| 0].value_from == noone) { group.iterationUpdate(); return; diff --git a/scripts/node_iterator_index/node_iterator_index.gml b/scripts/node_iterator_index/node_iterator_index.gml index 3b0ebbf78..77a0d9b82 100644 --- a/scripts/node_iterator_index/node_iterator_index.gml +++ b/scripts/node_iterator_index/node_iterator_index.gml @@ -9,7 +9,7 @@ function Node_Iterator_Index(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!variable_struct_exists(group, "iterated")) return; outputs[| 0].setValue(group.iterated); } diff --git a/scripts/node_iterator_length/node_iterator_length.gml b/scripts/node_iterator_length/node_iterator_length.gml index a4d14eeb5..42b99c5cb 100644 --- a/scripts/node_iterator_length/node_iterator_length.gml +++ b/scripts/node_iterator_length/node_iterator_length.gml @@ -9,7 +9,7 @@ function Node_Iterator_Length(_x, _y, _group = noone) : Node(_x, _y, _group) con outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!variable_struct_exists(group, "iterated")) return; var val = group.getInputData(0); outputs[| 0].setValue(val); diff --git a/scripts/node_iterator_output/node_iterator_output.gml b/scripts/node_iterator_output/node_iterator_output.gml index 77aac7de6..4584bdc3f 100644 --- a/scripts/node_iterator_output/node_iterator_output.gml +++ b/scripts/node_iterator_output/node_iterator_output.gml @@ -53,7 +53,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y return _new_val; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(inputs[| 0].value_from == noone) { group.iterationUpdate(); return; diff --git a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml index 501decaa7..b2872384d 100644 --- a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml +++ b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml @@ -11,5 +11,5 @@ function Node_Iterator_Sort_Output(_x, _y, _group = noone) : Node(_x, _y, _group static step = function() {} - static update = function(frame = PROJECT.animator.current_frame) {} + static update = function(frame = CURRENT_FRAME) {} } \ No newline at end of file diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index b33129d25..e3bccfc7e 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -139,7 +139,7 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons return true; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index 37d3e280d..b915191ea 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -109,7 +109,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con } } - static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } + static update = function(frame = CURRENT_FRAME) { writeFile(); } static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 54d4c0ae0..275b23bb7 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -7,7 +7,7 @@ enum CURVE_TYPE { function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor { #region ---- main ---- time = _time; - ratio = time / (PROJECT.animator.frames_total - 1); + ratio = time / (TOTAL_FRAMES - 1); value = _value; anim = _anim; @@ -24,7 +24,7 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor { static setTime = function(time) { #region self.time = time; - ratio = time / (PROJECT.animator.frames_total - 1); + ratio = time / (TOTAL_FRAMES - 1); } #endregion static clone = function(target = noone) { #region @@ -157,7 +157,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { static getName = function() { return prop.name + suffix; } - static getValue = function(_time = PROJECT.animator.current_frame) { #region + static getValue = function(_time = CURRENT_FRAME) { #region if(prop.type == VALUE_TYPE.trigger) { if(ds_list_size(values) == 0) return false; @@ -206,8 +206,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { var fTime = from.time; var tTime = to.time; - var prog = PROJECT.animator.frames_total - fTime + _time; - var totl = PROJECT.animator.frames_total - fTime + tTime; + var prog = TOTAL_FRAMES - fTime + _time; + var totl = TOTAL_FRAMES - fTime + tTime; var rat = prog / totl; var _lrp = interpolate(from, to, rat); @@ -234,7 +234,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { var from = values[| ds_list_size(values) - 1]; var to = values[| 0]; var prog = _time - from.time; - var totl = PROJECT.animator.frames_total - from.time + to.time; + var totl = TOTAL_FRAMES - from.time + to.time; var rat = prog / totl; var _lrp = interpolate(from, to, rat); @@ -308,7 +308,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { return 1; } #endregion - static setValue = function(_val = 0, _record = true, _time = PROJECT.animator.current_frame, ease_in = 0, ease_out = 0) { #region + static setValue = function(_val = 0, _record = true, _time = CURRENT_FRAME, ease_in = 0, ease_out = 0) { #region if(prop.type == VALUE_TYPE.trigger) { if(!prop.is_anim) { values[| 0] = new valueKey(0, _val, self); @@ -388,7 +388,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { for(var i = 0; i < ds_list_size(values); i++) { var _value_list = []; if(scale) - _value_list[0] = values[| i].time / (PROJECT.animator.frames_total - 1); + _value_list[0] = values[| i].time / (TOTAL_FRAMES - 1); else _value_list[0] = values[| i].time; @@ -451,7 +451,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { var _time = array_safe_get(_keyframe, 0); if(scale && _time <= 1) - _time = round(_time * (PROJECT.animator.frames_total - 1)); + _time = round(_time * (TOTAL_FRAMES - 1)); var value = array_safe_get(_keyframe, 1); var ease_in = array_safe_get(_keyframe, 2); diff --git a/scripts/node_logic_operate/node_logic_operate.gml b/scripts/node_logic_operate/node_logic_operate.gml index c04a7d301..769eda087 100644 --- a/scripts/node_logic_operate/node_logic_operate.gml +++ b/scripts/node_logic_operate/node_logic_operate.gml @@ -175,7 +175,7 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var mode = getInputData(0); var a = getInputData(1); var val; diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 456cf08de..d0f5c3441 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -158,7 +158,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!compiled) return; //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; @@ -172,7 +172,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) array_push(argument_val, getInputData(i + 2)); - //if(PROJECT.animator.current_frame == 0) { //refresh state on the first frame + //if(CURRENT_FRAME == 0) { //refresh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); diff --git a/scripts/node_lua_global/node_lua_global.gml b/scripts/node_lua_global/node_lua_global.gml index dc1e7eec0..46c5153e0 100644 --- a/scripts/node_lua_global/node_lua_global.gml +++ b/scripts/node_lua_global/node_lua_global.gml @@ -27,7 +27,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc static stepBegin = function() { var _type = getInputData(1); - if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (PROJECT.animator.current_frame == 0 || _type == 1)) + if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (CURRENT_FRAME == 0 || _type == 1)) setRenderStatus(false); setHeight(); @@ -58,14 +58,14 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(index == 0 || index == 2) compiled = false; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!compiled) return; //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; var _code = getInputData(0); var _type = getInputData(1); - //if(PROJECT.animator.current_frame == 0) { //rerfesh state on the first frame + //if(CURRENT_FRAME == 0) { //rerfesh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); @@ -73,7 +73,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc lua_projectData(getState()); - if(PROJECT.animator.current_frame == 0 || _type == 1) { + if(CURRENT_FRAME == 0 || _type == 1) { try { lua_add_code(getState(), _code); } catch(e) { noti_warning(exception_print(e),, self); } } diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index 71f5fcbc2..8c9b8a810 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -152,7 +152,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!compiled) return; //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; @@ -167,7 +167,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru array_push(argument_val, getInputData(i + 2)); } - //if(PROJECT.animator.current_frame == 0) { //rerfesh state on the first frame + //if(CURRENT_FRAME == 0) { //rerfesh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index e114054ee..265bfad4c 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -201,7 +201,7 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region use_mod = getInputData(0); var a = getInputData(1); var b = getInputData(2); diff --git a/scripts/node_onion_skin/node_onion_skin.gml b/scripts/node_onion_skin/node_onion_skin.gml index 2a652352e..d5c0e1230 100644 --- a/scripts/node_onion_skin/node_onion_skin.gml +++ b/scripts/node_onion_skin/node_onion_skin.gml @@ -52,7 +52,7 @@ function Node_Onion_Skin(_x, _y, _group = noone) : Node(_x, _y, _group) construc surface_set_target(_outSurf); DRAW_CLEAR - var fr = PROJECT.animator.current_frame; + var fr = CURRENT_FRAME; var st = min(_rang[0], _rang[1]); var ed = max(_rang[0], _rang[1]); diff --git a/scripts/node_palette_sort/node_palette_sort.gml b/scripts/node_palette_sort/node_palette_sort.gml index 29e51160f..2a40c1477 100644 --- a/scripts/node_palette_sort/node_palette_sort.gml +++ b/scripts/node_palette_sort/node_palette_sort.gml @@ -61,7 +61,7 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr return res; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _ord = getInputData(1); var _rev = getInputData(2); diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 3aa209e37..5cc37b82e 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -43,6 +43,18 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ PROJECT.animator.setFrame(-1); } #endregion + static reLoop = function() { #region + var _loop = getInputData(21); + if(!_loop) return; + + for(var i = 0; i < TOTAL_FRAMES; i++) { + runVFX(i, false); + updateParticleForward(); + } + + seed = getInputData(32); + } #endregion + static onStep = function() { #region var _dim = getInputData(input_len + 0); var _outSurf = outputs[| 0].getValue(); @@ -51,18 +63,20 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ outputs[| 0].setValue(_outSurf); } #endregion - static onUpdate = function() { #region + static onUpdate = function(frame = CURRENT_FRAME) { #region var _dim = getInputData(input_len + 0); var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); outputs[| 0].setValue(_outSurf); - if(PROJECT.animator.current_frame == 0) + if(CURRENT_FRAME == 0) { reset(); - runVFX(PROJECT.animator.current_frame); + reLoop(); + } + runVFX(CURRENT_FRAME); } #endregion - function render(_time = PROJECT.animator.current_frame) { #region + function render(_time = CURRENT_FRAME) { #region var _dim = inputs[| input_len + 0].getValue(_time); var _exact = inputs[| input_len + 1].getValue(_time); var _blend = inputs[| input_len + 2].getValue(_time); @@ -94,7 +108,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ surface_reset_shader(); if(PROJECT.animator.is_playing) { - //print($"Cache frame {PROJECT.animator.current_frame}"); + //print($"Cache frame {CURRENT_FRAME}"); cacheCurrentFrame(_outSurf); } } #endregion diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index 9880641a9..742627453 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -976,7 +976,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return new __vec2(p[0], p[1]); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region ds_map_clear(cached_pos); updateLength(); diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index 557d876f5..5910143ac 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -127,7 +127,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc return 0; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_builder/node_path_builder.gml b/scripts/node_path_builder/node_path_builder.gml index 51637e80d..fbb4f4a9e 100644 --- a/scripts/node_path_builder/node_path_builder.gml +++ b/scripts/node_path_builder/node_path_builder.gml @@ -14,7 +14,7 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var _lines = getInputData(0); var _conn = getInputData(1); @@ -39,27 +39,27 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr _x + p1[0] * _s, _y + p1[1] * _s); } } - } + } #endregion - static getLineCount = function() { + static getLineCount = function() { #region var _lines = getInputData(0); var _conn = getInputData(1); return _conn? 1 : floor(array_length(_lines) / 2); - } + } #endregion - static getSegmentCount = function() { + static getSegmentCount = function() { #region var _lines = getInputData(0); var _conn = getInputData(1); return _conn? array_length(_lines) - 1 : 1; - } + } #endregion static getLength = function(index) { return is_array(length)? array_safe_get(length, index) : length; } static getAccuLength = function(index) { return array_safe_get(lengthAcc, index, []); } - static getPointRatio = function(_rat, _ind = 0) { + static getPointRatio = function(_rat, _ind = 0) { #region var _lines = getInputData(0); var _conn = getInputData(1); var _p0, _p1; @@ -89,25 +89,25 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr return new __vec2( _x, _y ); } - } + } #endregion - static getPointDistance = function(_dist, ind = 0) { + static getPointDistance = function(_dist, ind = 0) { #region var _conn = getInputData(1); if(_conn) return getPointRatio(_dist / length); else return getPointRatio(_dist / length[ind], ind); - } + } #endregion - static getBoundary = function() { + static getBoundary = function() { #region var boundary = new BoundingBox(); var _lines = getInputData(0); for( var i = 0, n = array_length(_lines); i < n; i++ ) boundary.addPoint(_lines[i][0], _lines[i][1]); return boundary; - } + } #endregion - static update = function() { + static update = function() { #region var _lines = getInputData(0); var _conn = getInputData(1); @@ -142,10 +142,10 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr } outputs[| 0].setValue(self); - } + } #endregion - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(s_node_path_builder, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index bae81244b..b5cf2677d 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -20,7 +20,7 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { inputs[| 0].setType(inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type); outputs[| 0].setType(inputs[| 0].type); outputs[| 0].value_from = inputs[| 0].value_from; diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 28047cc1c..b6b2a904f 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -314,7 +314,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct } #endregion } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region processData_prebatch(); if(batch_output) processBatchOutput(); else processOutput(); @@ -337,19 +337,19 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct static cacheCurrentFrameIndex = function(_frame, index) { #region cacheArrayCheck(); - if(PROJECT.animator.current_frame < 0) return; - if(PROJECT.animator.current_frame >= array_length(cached_output)) return; + if(CURRENT_FRAME < 0) return; + if(CURRENT_FRAME >= array_length(cached_output)) return; - var prev = cached_output[PROJECT.animator.current_frame]; + var prev = cached_output[CURRENT_FRAME]; surface_array_free(array_safe_get(prev, index)); - cached_output[PROJECT.animator.current_frame][index] = surface_array_clone(_frame); + cached_output[CURRENT_FRAME][index] = surface_array_clone(_frame); - array_safe_set(cache_result, PROJECT.animator.current_frame, true); + array_safe_set(cache_result, CURRENT_FRAME, true); - return cached_output[PROJECT.animator.current_frame]; + return cached_output[CURRENT_FRAME]; } #endregion - static getCacheFrameIndex = function(frame = PROJECT.animator.current_frame, index = 0) { #region + static getCacheFrameIndex = function(frame = CURRENT_FRAME, index = 0) { #region if(frame < 0) return false; if(!cacheExist(frame)) return noone; diff --git a/scripts/node_rate_remap/node_rate_remap.gml b/scripts/node_rate_remap/node_rate_remap.gml index 6afc3e3cf..9e58a5c87 100644 --- a/scripts/node_rate_remap/node_rate_remap.gml +++ b/scripts/node_rate_remap/node_rate_remap.gml @@ -22,7 +22,7 @@ function Node_Rate_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _group static processData = function(_output, _data, _output_index, _array_index = 0) { var _surf = _data[0]; var _rate = _data[1]; - var _time = PROJECT.animator.current_frame; + var _time = CURRENT_FRAME; var _step = PROJECT.animator.framerate / _rate; var _targ = floor(_time / _step) * _step; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index c92083074..d975def57 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -159,8 +159,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio var vfx = ds_list_create(); #region addNodeCatagory("VFX", vfx, ["Node_VFX_Group"]); ds_list_add(vfx, "Groups"); - addNodeObject(vfx, "Input", s_node_vfx_input, "Node_Group_Input", [1, Node_Group_Input]); - addNodeObject(vfx, "Output", s_node_vfx_output, "Node_Group_Output", [1, Node_Group_Output]); + addNodeObject(vfx, "Input", s_node_vfx_input, "Node_Group_Input", [1, Node_Group_Input]); + addNodeObject(vfx, "Output", s_node_vfx_output, "Node_Group_Output", [1, Node_Group_Output]); + addNodeObject(vfx, "Renderer", s_node_vfx_render_output, "Node_VFX_Renderer_Output", [1, Node_VFX_Renderer_Output]); ds_list_add(vfx, "VFXs"); addNodeObject(vfx, "Spawner", s_node_vfx_spawn, "Node_VFX_Spawner", [1, Node_VFX_Spawner]); diff --git a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml index 80edf0eb1..e4102f126 100644 --- a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml +++ b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml @@ -11,7 +11,7 @@ enum SPRITE_ANIM_GROUP { function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Render Spritesheet"; - anim_drawn = array_create(PROJECT.animator.frames_total + 1, false); + anim_drawn = array_create(TOTAL_FRAMES + 1, false); inputs[| 0] = nodeValue("Sprites", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); @@ -68,7 +68,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) inputs[| 5].setVisible(pack != SPRITE_STACK.grid); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var inpt = getInputData(0); var grup = getInputData(1); var skip = getInputData(2); @@ -85,7 +85,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) if(grup != SPRITE_ANIM_GROUP.animation) { initRender(); return; - } else if(PROJECT.animator.rendering && PROJECT.animator.frame_progress && PROJECT.animator.current_frame == 0 && !refreshSurface) { + } else if(PROJECT.animator.rendering && PROJECT.animator.frame_progress && CURRENT_FRAME == 0 && !refreshSurface) { var skip = getInputData(2); var arr = is_array(inpt); @@ -93,7 +93,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) if(!arr) inpt = [ inpt ]; var _surf = []; - var amo = floor(PROJECT.animator.frames_total / skip); + var amo = floor(TOTAL_FRAMES / skip); var _st = clamp(rang[0], 0, amo); var _ed = rang[1]; if(rang[1] == 0) _ed = amo; @@ -118,7 +118,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) hh = sh * amo + spac * (amo - 1); break; case SPRITE_STACK.grid : - var amo = floor(PROJECT.animator.frames_total / skip); + var amo = floor(TOTAL_FRAMES / skip); var col = getInputData(4); var row = ceil(amo / col); @@ -142,13 +142,13 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) outputs[| 1].setValue(_atl); } - if(safe_mod(PROJECT.animator.current_frame, skip) != 0) return; + if(safe_mod(CURRENT_FRAME, skip) != 0) return; - if(array_length(anim_drawn) != PROJECT.animator.frames_total) - array_resize(anim_drawn, PROJECT.animator.frames_total); + if(array_length(anim_drawn) != TOTAL_FRAMES) + array_resize(anim_drawn, TOTAL_FRAMES); - if(PROJECT.animator.current_frame >= 0 && PROJECT.animator.current_frame < PROJECT.animator.frames_total) { - if(anim_drawn[PROJECT.animator.current_frame]) return; + if(CURRENT_FRAME >= 0 && CURRENT_FRAME < TOTAL_FRAMES) { + if(anim_drawn[CURRENT_FRAME]) return; if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress) { if(is_array(inpt) && array_length(inpt) == 0) return; @@ -158,9 +158,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) var oupt = outputs[| 0].getValue(); if(is_array(oupt) && (array_length(inpt) != array_length(oupt))) return; - if(PROJECT.animator.current_frame % skip != 0) return; + if(CURRENT_FRAME % skip != 0) return; - var amo = floor(PROJECT.animator.frames_total / skip); + var amo = floor(TOTAL_FRAMES / skip); var _st = clamp(rang[0], 0, amo); var _ed = rang[1]; if(rang[1] == 0) _ed = amo; @@ -168,7 +168,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) _ed = clamp(_ed, 0, amo); if(_ed <= _st) return; - var _frame = floor(PROJECT.animator.current_frame / skip); + var _frame = floor(CURRENT_FRAME / skip); if(_frame < _st || _frame > _ed) return; _frame -= _st; @@ -240,7 +240,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) surface_reset_target(); } - if(drawn) array_safe_set(anim_drawn, PROJECT.animator.current_frame, true); + if(drawn) array_safe_set(anim_drawn, CURRENT_FRAME, true); outputs[| 1].setValue(_atl); } diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index d9dfc2486..244190468 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -251,7 +251,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor surface_reset_target(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _inSurf = getInputData(0); if(is_array(_inSurf) && array_length(_inSurf) == 0) return; if(!is_array(_inSurf) && !is_surface(_inSurf)) return; diff --git a/scripts/node_rigid_activation/node_rigid_activation.gml b/scripts/node_rigid_activation/node_rigid_activation.gml index 322e0e9c8..b458dc1f7 100644 --- a/scripts/node_rigid_activation/node_rigid_activation.gml +++ b/scripts/node_rigid_activation/node_rigid_activation.gml @@ -18,7 +18,7 @@ function Node_Rigid_Activate(_x, _y, _group = noone) : Node(_x, _y, _group) cons ["Activate", false], 1, ] - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _obj = getInputData(0); outputs[| 0].setValue(_obj); diff --git a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml index 6bf18b85d..13bc275c9 100644 --- a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml +++ b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml @@ -110,7 +110,7 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c inputs[| 8].setVisible(_typ == 3); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _obj = getInputData(0); outputs[| 0].setValue(_obj); @@ -126,7 +126,7 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c var _str = getInputData(7); var _rad = getInputData(8); - if((_typ > 0) && PROJECT.animator.current_frame != _frm) + if((_typ > 0) && CURRENT_FRAME != _frm) return; if(!is_array(_obj)) _obj = [ _obj ]; diff --git a/scripts/node_rigid_global/node_rigid_global.gml b/scripts/node_rigid_global/node_rigid_global.gml index d33cc4011..3d77fde01 100644 --- a/scripts/node_rigid_global/node_rigid_global.gml +++ b/scripts/node_rigid_global/node_rigid_global.gml @@ -12,7 +12,7 @@ function Node_Rigid_Global(_x, _y, _group = noone) : Node(_x, _y, _group) constr current_gra = [0, 0]; - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _gra = getInputData(0); if(current_gra[0] != array_safe_get(_gra, 0) || current_gra[1] != array_safe_get(_gra, 1)) { diff --git a/scripts/node_rigid_group/node_rigid_group.gml b/scripts/node_rigid_group/node_rigid_group.gml index a0f5673e9..d707df2da 100644 --- a/scripts/node_rigid_group/node_rigid_group.gml +++ b/scripts/node_rigid_group/node_rigid_group.gml @@ -28,7 +28,7 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro } static update = function() { - if(PROJECT.animator.current_frame == 0) + if(CURRENT_FRAME == 0) reset(); } diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index 4dac5a494..4dcf3e189 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -654,7 +654,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr return object; } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region // } #endregion 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 d1b151e7d..075c241aa 100644 --- a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml +++ b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml @@ -86,7 +86,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { RETURN_ON_REST var _obj = getInputData(0); @@ -101,9 +101,9 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group var _amo = getInputData(4); var _sed = getInputData(7) + frame * _amo * 20; - if(_typ == 0 && (safe_mod(PROJECT.animator.current_frame, _del) == 0)) + if(_typ == 0 && (safe_mod(CURRENT_FRAME, _del) == 0)) spawn(_sed); - else if(_typ == 1 && PROJECT.animator.current_frame == _frm) + else if(_typ == 1 && CURRENT_FRAME == _frm) spawn(_sed); } diff --git a/scripts/node_rigid_override/node_rigid_override.gml b/scripts/node_rigid_override/node_rigid_override.gml index b63a505cc..e31355cc3 100644 --- a/scripts/node_rigid_override/node_rigid_override.gml +++ b/scripts/node_rigid_override/node_rigid_override.gml @@ -29,7 +29,7 @@ function Node_Rigid_Override(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, noone ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var objNode = getInputData(0); outputs[| 0].setValue(objNode); if(!variable_struct_exists(objNode, "object")) return; diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 3550ee27b..8fe0afe78 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -81,7 +81,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0].setValue(_outSurf); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region if(recoverCache() || !PROJECT.animator.is_playing) return; 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 d07004fdc..63a6c2139 100644 --- a/scripts/node_rigid_render_output/node_rigid_render_output.gml +++ b/scripts/node_rigid_render_output/node_rigid_render_output.gml @@ -47,7 +47,7 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x if(!is_undefined(outParent)) ds_list_remove(group.outputs, outParent); - outParent = nodeValue("Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone) + outParent = nodeValue("Rendered", group, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone) .uncache() .setVisible(true, true); outParent.from = self; @@ -102,7 +102,7 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x outParent.setValue(_outSurf); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region if(!is_instanceof(outParent, NodeValue)) return noone; var _dim = getInputData(0); @@ -154,11 +154,11 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x cacheCurrentFrame(_outSurf); } #endregion - static recoverCache = function(frame = PROJECT.animator.current_frame) { #region + static recoverCache = function(frame = CURRENT_FRAME) { #region if(!is_instanceof(outParent, NodeValue)) return false; if(!cacheExist(frame)) return false; - var _s = cached_output[PROJECT.animator.current_frame]; + var _s = cached_output[CURRENT_FRAME]; outParent.setValue(_s); return true; diff --git a/scripts/node_rigid_variable/node_rigid_variable.gml b/scripts/node_rigid_variable/node_rigid_variable.gml index a97a2d8e2..3e0682ea5 100644 --- a/scripts/node_rigid_variable/node_rigid_variable.gml +++ b/scripts/node_rigid_variable/node_rigid_variable.gml @@ -15,12 +15,15 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons input_display_list = [ 0 ]; outputs[| 0] = nodeValue("Positions", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + .setDisplay(VALUE_DISPLAY.vector) + .setVisible(false); outputs[| 1] = nodeValue("Scales", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + .setDisplay(VALUE_DISPLAY.vector) + .setVisible(false); - outputs[| 2] = nodeValue("Rotations", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ); + outputs[| 2] = nodeValue("Rotations", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) + .setVisible(false); outputs[| 3] = nodeValue("Blends", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, 0 ) .setVisible(false); @@ -36,7 +39,11 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); - static update = function(frame = PROJECT.animator.current_frame) { + outputs[| 7] = nodeValue("Velocity magnitude", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) + .setDisplay(VALUE_DISPLAY.vector) + .setVisible(false); + + static update = function(frame = CURRENT_FRAME) { var objNode = getInputData(0); outputs[| 0].setValue(objNode); if(!variable_struct_exists(objNode, "object")) return; @@ -46,11 +53,7 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons var _val = []; for( var i = 0; i < ds_list_size(outputs); i++ ) { - _get[i] = false; - var _in = outputs[| i]; - for( var j = 0; j < ds_list_size(_in.value_to); j++ ) - if(_in.value_to[| j].value_from == _in) _get[i] = true; - + _get[i] = outputs[| i].visible; _val[i] = []; if(_get[i]) _val[i] = array_create(array_length(objs)); } @@ -62,11 +65,12 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons if(_get[0]) _val[0][i] = [ obj.x, obj.y ]; if(_get[1]) _val[1][i] = [ obj.xscale, obj.yscale ]; - if(_get[2]) _val[2][i] = [ obj.image_angle ]; - if(_get[3]) _val[3][i] = [ obj.image_blend ]; - if(_get[4]) _val[4][i] = [ obj.image_alpha ]; + if(_get[2]) _val[2][i] = obj.image_angle; + if(_get[3]) _val[3][i] = obj.image_blend; + if(_get[4]) _val[4][i] = obj.image_alpha; if(_get[5]) _val[5][i] = [ obj.phy_linear_velocity_x, obj.phy_linear_velocity_y ]; if(_get[6]) _val[6][i] = [ obj.phy_com_x, obj.phy_com_y ]; + if(_get[7]) _val[7][i] = point_distance(0, 0, obj.phy_linear_velocity_x, obj.phy_linear_velocity_y); } for( var i = 0; i < ds_list_size(outputs); i++ ) diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index c0d8b004e..131caf652 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -54,7 +54,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons static getPreviewValues = function() { return refVal.getValue(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _area = getInputData(0); var _dist = getInputData(1); var _scat = getInputData(2); diff --git a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml index 4c0ce4497..a074fa693 100644 --- a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml +++ b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml @@ -85,7 +85,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const ["Animation", false], 1, ]; - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _sur = getInputData(0); if(!is_array(_sur)) { outputs[| 0].setValue(_sur); @@ -96,7 +96,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const var _seq = getInputData(2); var _ovf = getInputData(3); - var frm = floor(PROJECT.animator.current_frame / _spd); + var frm = floor(CURRENT_FRAME / _spd); var ind = frm; if(array_length(_seq) == 0) { diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index 417aec17d..dd27c95fd 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -59,7 +59,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| 2].setVisible(_axis != 2); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var _axis = getInputData(0); var _alig = getInputData(1); var _spac = getInputData(2); diff --git a/scripts/node_statistic/node_statistic.gml b/scripts/node_statistic/node_statistic.gml index 9edc8a7c8..b14c42ba0 100644 --- a/scripts/node_statistic/node_statistic.gml +++ b/scripts/node_statistic/node_statistic.gml @@ -76,7 +76,7 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var type = getInputData(0); var res = 0; diff --git a/scripts/node_strand_break/node_strand_break.gml b/scripts/node_strand_break/node_strand_break.gml index eedfc53d6..8c7d749d6 100644 --- a/scripts/node_strand_break/node_strand_break.gml +++ b/scripts/node_strand_break/node_strand_break.gml @@ -13,7 +13,7 @@ function Node_Strand_Break(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _ ["Break", false], input_fix_len + 0, input_fix_len + 1 ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _cha = getInputData(input_fix_len + 0); var _sed = getInputData(input_fix_len + 1); diff --git a/scripts/node_strand_collision/node_strand_collision.gml b/scripts/node_strand_collision/node_strand_collision.gml index 4485456ab..cbb0ddf3a 100644 --- a/scripts/node_strand_collision/node_strand_collision.gml +++ b/scripts/node_strand_collision/node_strand_collision.gml @@ -20,7 +20,7 @@ function Node_Strand_Collision(_x, _y, _group = noone) : Node(_x, _y, _group) co _msh.draw(_x, _y, _s); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _str = getInputData(0); var _msh = getInputData(1); diff --git a/scripts/node_strand_create/node_strand_create.gml b/scripts/node_strand_create/node_strand_create.gml index 779721fd3..bbbe2c9a4 100644 --- a/scripts/node_strand_create/node_strand_create.gml +++ b/scripts/node_strand_create/node_strand_create.gml @@ -533,8 +533,8 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const } } - static update = function(frame = PROJECT.animator.current_frame) { - strandUpdate(PROJECT.animator.current_frame == 0); + static update = function(frame = CURRENT_FRAME) { + strandUpdate(CURRENT_FRAME == 0); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_strand_force_apply/node_strand_force_apply.gml b/scripts/node_strand_force_apply/node_strand_force_apply.gml index a8879a92a..3a9b93e83 100644 --- a/scripts/node_strand_force_apply/node_strand_force_apply.gml +++ b/scripts/node_strand_force_apply/node_strand_force_apply.gml @@ -19,7 +19,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector ["Force", false], input_fix_len + 0, input_fix_len + 2, input_fix_len + 1, input_fix_len + 3, input_fix_len + 4 ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _pos = getInputData(2); var _dir = getInputData(4); @@ -31,7 +31,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector inputs[| 4].setVisible(true); - var _strTur = _tur == 0? _stn : perlin1D(_sed + PROJECT.animator.current_frame, _tfr, _toc, _stn - _tur, _stn + _tur); + var _strTur = _tur == 0? _stn : perlin1D(_sed + CURRENT_FRAME, _tfr, _toc, _stn - _tur, _stn + _tur); var gx = lengthdir_x(_strTur, _dir); var gy = lengthdir_y(_strTur, _dir); diff --git a/scripts/node_strand_gravity/node_strand_gravity.gml b/scripts/node_strand_gravity/node_strand_gravity.gml index dd840e82e..6f50aedb4 100644 --- a/scripts/node_strand_gravity/node_strand_gravity.gml +++ b/scripts/node_strand_gravity/node_strand_gravity.gml @@ -14,7 +14,7 @@ function Node_Strand_Gravity(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.output, VALUE_TYPE.strands, noone); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _str = getInputData(0); var _gra = getInputData(1); var _dir = getInputData(2); diff --git a/scripts/node_strand_length_adjust/node_strand_length_adjust.gml b/scripts/node_strand_length_adjust/node_strand_length_adjust.gml index 11de1ae49..db643db04 100644 --- a/scripts/node_strand_length_adjust/node_strand_length_adjust.gml +++ b/scripts/node_strand_length_adjust/node_strand_length_adjust.gml @@ -14,7 +14,7 @@ function Node_Strand_Length_Adjust(_x, _y, _group = noone) : _Node_Strand_Affect ["Length adjust", false], input_fix_len + 0, input_fix_len + 1, ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _sTyp = getInputData(input_fix_len + 0); var _sStr = getInputData(input_fix_len + 1); diff --git a/scripts/node_strand_render/node_strand_render.gml b/scripts/node_strand_render/node_strand_render.gml index 7eb96b7c4..b57f8aeef 100644 --- a/scripts/node_strand_render/node_strand_render.gml +++ b/scripts/node_strand_render/node_strand_render.gml @@ -45,7 +45,7 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const _str[i].draw(_x, _y, _s); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!PROJECT.animator.is_playing && recoverCache()) return; var _dim = getInputData(0); diff --git a/scripts/node_strand_render_texture/node_strand_render_texture.gml b/scripts/node_strand_render_texture/node_strand_render_texture.gml index 3c4d28593..51202c8b6 100644 --- a/scripts/node_strand_render_texture/node_strand_render_texture.gml +++ b/scripts/node_strand_render_texture/node_strand_render_texture.gml @@ -39,7 +39,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou _str.draw(_x, _y, _s); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(!PROJECT.animator.is_playing && recoverCache()) return; var _dim = getInputData(0); diff --git a/scripts/node_strand_update/node_strand_update.gml b/scripts/node_strand_update/node_strand_update.gml index 9b8d14fb9..6c2fa0a2a 100644 --- a/scripts/node_strand_update/node_strand_update.gml +++ b/scripts/node_strand_update/node_strand_update.gml @@ -11,7 +11,7 @@ function Node_Strand_Update(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.output, VALUE_TYPE.strands, noone); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _str = getInputData(0); var _itr = getInputData(1); diff --git a/scripts/node_struct_json_parse/node_struct_json_parse.gml b/scripts/node_struct_json_parse/node_struct_json_parse.gml index ee6f01294..1cf79e83c 100644 --- a/scripts/node_struct_json_parse/node_struct_json_parse.gml +++ b/scripts/node_struct_json_parse/node_struct_json_parse.gml @@ -11,7 +11,7 @@ function Node_Struct_JSON_Parse(_x, _y, _group = noone) : Node(_x, _y, _group) c outputs[| 0] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {} ); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _str = getInputData(0); var str = json_parse(_str); outputs[| 0].setValue(str); diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index 39819ddae..e200a1ec7 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -12,7 +12,7 @@ function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constr w = 96; - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _insurf = getInputData(0); if(is_array(_insurf)) { var len = array_length(_insurf); diff --git a/scripts/node_switch/node_switch.gml b/scripts/node_switch/node_switch.gml index 23835937c..b4ba8c859 100644 --- a/scripts/node_switch/node_switch.gml +++ b/scripts/node_switch/node_switch.gml @@ -85,7 +85,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor refreshDynamicInput(); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var sele = getInputData(0); var _res = getInputData(1); diff --git a/scripts/node_text_file_read/node_text_file_read.gml b/scripts/node_text_file_read/node_text_file_read.gml index ec48311a2..3e92840b9 100644 --- a/scripts/node_text_file_read/node_text_file_read.gml +++ b/scripts/node_text_file_read/node_text_file_read.gml @@ -84,7 +84,7 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons return false; } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_text_file_write/node_text_file_write.gml b/scripts/node_text_file_write/node_text_file_write.gml index b36cd7643..6164ce92b 100644 --- a/scripts/node_text_file_write/node_text_file_write.gml +++ b/scripts/node_text_file_write/node_text_file_write.gml @@ -25,7 +25,7 @@ function Node_Text_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con file_text_close(f); } - static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } + static update = function(frame = CURRENT_FRAME) { writeFile(); } static onInspector1Update = function() { getInputs(); writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index d3e04d215..1b42b4bfa 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -27,7 +27,7 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_surface_depth(); - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var _inSurf = getInputData(0); var _map = getInputData(1); var _life = getInputData(2); @@ -43,11 +43,11 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc texture_set_stage(uniform_map, surface_get_texture(_map)); for(var i = 0; i <= _life; i++) { - var _frame = PROJECT.animator.current_frame - i; + var _frame = CURRENT_FRAME - i; if(_loop) - _frame = _frame < 0? PROJECT.animator.frames_total - 1 + _frame : _frame; + _frame = _frame < 0? TOTAL_FRAMES - 1 + _frame : _frame; else - _frame = clamp(_frame, 0, PROJECT.animator.frames_total - 1); + _frame = clamp(_frame, 0, TOTAL_FRAMES - 1); var s = array_safe_get(cached_output, _frame) if(!is_surface(s)) continue; diff --git a/scripts/node_timeline_preview/node_timeline_preview.gml b/scripts/node_timeline_preview/node_timeline_preview.gml index 9e30f0f95..3773a417a 100644 --- a/scripts/node_timeline_preview/node_timeline_preview.gml +++ b/scripts/node_timeline_preview/node_timeline_preview.gml @@ -10,7 +10,7 @@ function Node_Timeline_Preview(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _inSurf = getInputData(0); if(_inSurf == 0) return; diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index 9c0fabbf2..661a66685 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -69,7 +69,7 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { _outUV = surface_verify(_outUV, surface_get_width_safe(_surf), surface_get_height_safe(_surf), cDep); outputs[| 1].setValue(_outUV); - var curf = PROJECT.animator.current_frame; + var curf = CURRENT_FRAME; var frame_amo = _loop? _life : min(_life, curf); var st_frame = curf - frame_amo; @@ -81,9 +81,9 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var a0 = eval_curve_x(_alpha, 1 - i / (frame_amo + 1)); var a1 = eval_curve_x(_alpha, 1 - (i + 1) / (frame_amo + 1)); - if(_loop && frame_idx < 0) frame_idx = PROJECT.animator.frames_total + frame_idx; + if(_loop && frame_idx < 0) frame_idx = TOTAL_FRAMES + frame_idx; - var prev = _loop? safe_mod(frame_idx - 1 + PROJECT.animator.frames_total, PROJECT.animator.frames_total) : frame_idx - 1; + var prev = _loop? safe_mod(frame_idx - 1 + TOTAL_FRAMES, TOTAL_FRAMES) : frame_idx - 1; var _prevFrame = getCacheFrame(prev); var _currFrame = getCacheFrame(frame_idx); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index dcf0b02e4..f2d505d96 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -110,7 +110,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(!PROJECT.animator.frame_progress) return; - if(PROJECT.animator.current_frame == 0) { + if(CURRENT_FRAME == 0) { vel = 0; prev_pos[0] = pos[0]; prev_pos[1] = pos[1]; diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index b6dca0f94..d3ba286bc 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -52,7 +52,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static update = function(frame = PROJECT.animator.current_frame) { onValueUpdate(); } + static update = function(frame = CURRENT_FRAME) { onValueUpdate(); } static resetMap = function() { var _key = getInputData(0); diff --git a/scripts/node_tunnel_out/node_tunnel_out.gml b/scripts/node_tunnel_out/node_tunnel_out.gml index e1f28eed2..527e09748 100644 --- a/scripts/node_tunnel_out/node_tunnel_out.gml +++ b/scripts/node_tunnel_out/node_tunnel_out.gml @@ -72,7 +72,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _key = getInputData(0); if(ds_map_exists(TUNNELS_IN, _key)) diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 0c0079559..95efd55ec 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -292,6 +292,8 @@ function value_type_from_string(str) { #region case "dynaSurface" : return VALUE_TYPE.dynaSurface; case "PCXnode" : return VALUE_TYPE.PCXnode; + case "audioBit" : return VALUE_TYPE.audioBit; + case "action" : return VALUE_TYPE.action; } @@ -1310,7 +1312,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static resetCache = function() { cache_value[0] = false; } - static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region + static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region if(type == VALUE_TYPE.trigger) useCache = false; @@ -1353,7 +1355,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return val; } #endregion - static __getAnimValue = function(_time = PROJECT.animator.current_frame) { #region + static __getAnimValue = function(_time = CURRENT_FRAME) { #region if(sep_axis) { var val = []; for( var i = 0, n = array_length(animators); i < n; i++ ) @@ -1387,7 +1389,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return val; } #endregion - static _getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, log = false) { #region + static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, log = false) { #region var _val = getValueRecursive(_time); var val = _val[0]; var nod = _val[1]; @@ -1434,7 +1436,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return valueProcess(val, nod, applyUnit, arrIndex); } #endregion - static getValueRecursive = function(_time = PROJECT.animator.current_frame) { #region + static getValueRecursive = function(_time = CURRENT_FRAME) { #region var val = [ -1, self ]; if(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger even will not propagate from input to output, need to be done manually @@ -1480,7 +1482,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static setAnim = function(anim) { #region if(anim && !is_anim && ds_list_size(animator.values) == 1) - animator.values[| 0].time = PROJECT.animator.current_frame; + animator.values[| 0].time = CURRENT_FRAME; is_anim = anim; PANEL_ANIMATION.updatePropertyList(); @@ -1587,7 +1589,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return array_length(ar); } #endregion - static setValue = function(val = 0, record = true, time = PROJECT.animator.current_frame, _update = true) { #region + static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region val = unit.invApply(val); return setValueDirect(val, noone, record, time, _update); } #endregion @@ -1602,7 +1604,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } } #endregion - static setValueDirect = function(val = 0, index = noone, record = true, time = PROJECT.animator.current_frame, _update = true) { #region + static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region var updated = false; if(sep_axis) { diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index d5660aace..e6518ff87 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -40,7 +40,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const .setDisplay(VALUE_DISPLAY.button, { name: "Sync", onClick: function() { if(content == noone) return; var frm = max(1, ceil(content.duration * PROJECT.animator.framerate)); - PROJECT.animator.frames_total = frm; + TOTAL_FRAMES = frm; } }) .rejectArray(); @@ -187,14 +187,14 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const if(!attributes.play) return; if(PROJECT.animator.is_playing) { - var dur = PROJECT.animator.current_frame / PROJECT.animator.framerate - attributes.preview_shift; + var dur = CURRENT_FRAME / PROJECT.animator.framerate - attributes.preview_shift; if(!audio_is_playing(preview_audio)) preview_id = audio_play_sound(preview_audio, 1, false, attributes.preview_gain, dur); } } #endregion - static update = function(frame = PROJECT.animator.current_frame) { #region + static update = function(frame = CURRENT_FRAME) { #region var path = getInputData(0); var mono = getInputData(2); if(path == "") return; @@ -228,7 +228,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_surface_ext_safe(surf, dx, dy, ss, ss,,, 0.50); - var wd = clamp((PROJECT.animator.current_frame / PROJECT.animator.framerate) / content.duration, 0, 1) * sw; + var wd = clamp((CURRENT_FRAME / PROJECT.animator.framerate) / content.duration, 0, 1) * sw; draw_surface_part_ext_safe(surf, 0, 0, min(wd, sw), sh, dx, dy, ss, ss,, attributes.play? COLORS._main_accent : c_white); draw_set_color(attributes.play? COLORS._main_accent : c_white); diff --git a/scripts/node_websocket_receiver/node_websocket_receiver.gml b/scripts/node_websocket_receiver/node_websocket_receiver.gml index cf7031a08..3e1dd5685 100644 --- a/scripts/node_websocket_receiver/node_websocket_receiver.gml +++ b/scripts/node_websocket_receiver/node_websocket_receiver.gml @@ -90,7 +90,7 @@ function Node_Websocket_Receiver(_x, _y, _group = noone) : Node(_x, _y, _group) } } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { if(CLONING) return; var _port = getInputData(0); diff --git a/scripts/node_websocket_sender/node_websocket_sender.gml b/scripts/node_websocket_sender/node_websocket_sender.gml index 2cfe3c58d..0b470d48f 100644 --- a/scripts/node_websocket_sender/node_websocket_sender.gml +++ b/scripts/node_websocket_sender/node_websocket_sender.gml @@ -83,7 +83,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 6].setVisible(_type == 3, _type == 3); } - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = CURRENT_FRAME) { var _port = getInputData(0); var _target = getInputData(5); diff --git a/scripts/node_wiggler/node_wiggler.gml b/scripts/node_wiggler/node_wiggler.gml index 3b3e399ee..7b9288298 100644 --- a/scripts/node_wiggler/node_wiggler.gml +++ b/scripts/node_wiggler/node_wiggler.gml @@ -30,18 +30,18 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var fre = getSingleValue(1); var sed = getSingleValue(2); - var step = PROJECT.animator.frames_total / 64; + var step = TOTAL_FRAMES / 64; for( var i = 0; i < 64; i++ ) - random_value[i] = getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, step * i, sed, 0, PROJECT.animator.frames_total); + random_value[i] = getWiggle(ran[0], ran[1], TOTAL_FRAMES / fre, step * i, sed, 0, TOTAL_FRAMES); } static processData = function(_output, _data, _output_index, _array_index = 0) { var ran = _data[0]; var fre = _data[1]; var sed = _data[2]; - var time = PROJECT.animator.current_frame; + var time = CURRENT_FRAME; - return getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, time, sed, 0, PROJECT.animator.frames_total); + return getWiggle(ran[0], ran[1], TOTAL_FRAMES / fre, time, sed, 0, TOTAL_FRAMES); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { @@ -49,15 +49,15 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var fre = array_safe_get(current_data, 1); var sed = array_safe_get(current_data, 2); var disp = array_safe_get(current_data, 3); - var time = PROJECT.animator.current_frame; - var total_time = PROJECT.animator.frames_total; + var time = CURRENT_FRAME; + var total_time = TOTAL_FRAMES; switch(disp) { case 0 : w = 96; draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); - var str = getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, time, sed, 0, PROJECT.animator.frames_total); + var str = getWiggle(ran[0], ran[1], TOTAL_FRAMES / fre, time, sed, 0, TOTAL_FRAMES); var ss = string_scale(str, (w - 16) * _s, (h - 16) * _s - 20 * draw_name); draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, str, ss, ss, 0); break; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index a24aa17c9..2fbaed258 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -113,7 +113,7 @@ function Panel_Animation() : PanelContent() constructor { onion_dragging = noone; - prev_cache = array_create(PROJECT.animator.frames_total); + prev_cache = array_create(TOTAL_FRAMES); copy_clipboard = ds_list_create(); @@ -138,7 +138,7 @@ function Panel_Animation() : PanelContent() constructor { [ function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); }, function() { return 2; }, function() { return COLORS._main_icon; }, - function() { PROJECT.animator.setFrame(PROJECT.animator.frames_total - 1); } + function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); } ], [ function() { return __txtx("panel_animation_previous_frame", "Previous frame"); }, function() { return 5; }, @@ -159,9 +159,9 @@ function Panel_Animation() : PanelContent() constructor { addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift, function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); }); addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { PROJECT.animator.setFrame(0); }); - addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { PROJECT.animator.setFrame(PROJECT.animator.frames_total - 1); }); + addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); }); addHotkey("", "Next frame", vk_right, MOD_KEY.none, function() { - PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, PROJECT.animator.frames_total - 1)); + PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1)); }); addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() { PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); @@ -434,7 +434,7 @@ function Panel_Animation() : PanelContent() constructor { var bar_y = h - timeline_h - ui(10); var bar_w = timeline_w; var bar_h = timeline_h; - var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); + var bar_total_w = TOTAL_FRAMES * ui(timeline_scale); var inspecting = PANEL_INSPECTOR.getInspecting(); resetTimelineMask(); @@ -445,13 +445,13 @@ function Panel_Animation() : PanelContent() constructor { #region bg draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h); - var __w = timeline_shift + PROJECT.animator.frames_total * ui(timeline_scale) + PANEL_PAD; + var __w = timeline_shift + TOTAL_FRAMES * ui(timeline_scale) + PANEL_PAD; draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, min(__w, timeline_w), bar_h, COLORS.panel_animation_timeline_blend, 1); if(inspecting) inspecting.drawAnimationTimeline(timeline_shift, bar_w, bar_h, timeline_scale); - for(var i = timeline_separate; i <= PROJECT.animator.frames_total; i += timeline_separate) { + for(var i = timeline_separate; i <= TOTAL_FRAMES; i += timeline_separate) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_color(COLORS.panel_animation_frame_divider); draw_line(bar_line_x, ui(12), bar_line_x, bar_h - PANEL_PAD); @@ -460,18 +460,18 @@ function Panel_Animation() : PanelContent() constructor { draw_text_add(bar_line_x, ui(16), string(i)); } - var bar_line_x = (PROJECT.animator.current_frame + 1) * ui(timeline_scale) + timeline_shift; + var bar_line_x = (CURRENT_FRAME + 1) * ui(timeline_scale) + timeline_shift; var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent; draw_set_color(cc); draw_line(bar_line_x, ui(12), bar_line_x, bar_h - PANEL_PAD); draw_set_text(f_p2, fa_center, fa_bottom, cc); - draw_text_add(bar_line_x, ui(16), string(PROJECT.animator.current_frame + 1)); + draw_text_add(bar_line_x, ui(16), string(CURRENT_FRAME + 1)); #endregion #region cache if(inspecting && inspecting.use_cache) { - for(var i = 0; i < PROJECT.animator.frames_total; i++) { + for(var i = 0; i < TOTAL_FRAMES; i++) { if(i >= array_length(inspecting.cache_result)) break; @@ -524,8 +524,8 @@ function Panel_Animation() : PanelContent() constructor { if(timeline_scubbing) { var rfrm = (mx - bar_x - timeline_shift) / ui(timeline_scale) - 1; - PROJECT.animator.setFrame(clamp(rfrm, 0, PROJECT.animator.frames_total - 1)); - timeline_show_time = PROJECT.animator.current_frame; + PROJECT.animator.setFrame(clamp(rfrm, 0, TOTAL_FRAMES - 1)); + timeline_show_time = CURRENT_FRAME; if(timeline_show_time != _scrub_frame) { _scrub_frame = timeline_show_time; @@ -582,7 +582,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_scubbing = true; - timeline_scub_st = PROJECT.animator.current_frame; + timeline_scub_st = CURRENT_FRAME; _scrub_frame = timeline_scub_st; } } @@ -590,7 +590,7 @@ function Panel_Animation() : PanelContent() constructor { if(pHOVER && point_in_rectangle(mx, my, bar_x, 8, bar_x + min(timeline_w, timeline_shift + bar_total_w), 8 + 16)) { //top bar if(mouse_press(mb_left, pFOCUS) && timeline_draggable) { timeline_scubbing = true; - timeline_scub_st = PROJECT.animator.current_frame; + timeline_scub_st = CURRENT_FRAME; _scrub_frame = timeline_scub_st; } } @@ -607,7 +607,7 @@ function Panel_Animation() : PanelContent() constructor { } #endregion function drawDopesheetLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) { #region - var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); + var bar_total_w = TOTAL_FRAMES * ui(timeline_scale); var bar_show_w = timeline_shift + bar_total_w; var hovering = noone; var _gy_top = key_y + ui(16); @@ -729,7 +729,7 @@ function Panel_Animation() : PanelContent() constructor { var key_last = animator.values[| ds_list_size(animator.values) - 1]; var t_last = (key_last.time + 1) * ui(timeline_scale) + timeline_shift; - if(key_last.time < PROJECT.animator.frames_total) { + if(key_last.time < TOTAL_FRAMES) { if(valArray) { for( var ki = 0; ki < array_length(key_last.value); ki++ ) { draw_set_color(COLORS.axis[ki]); @@ -749,7 +749,7 @@ function Panel_Animation() : PanelContent() constructor { } #endregion function drawDopesheetGraph(prop, key_y, msx, msy) { #region - var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); + var bar_total_w = TOTAL_FRAMES * ui(timeline_scale); var bar_show_w = timeline_shift + bar_total_w; var _gy_top = key_y + ui(16); var _gy_bottom = _gy_top + prop.graph_h - ui(8); @@ -783,7 +783,7 @@ function Panel_Animation() : PanelContent() constructor { } key_next = prop.animator.values[| ds_list_size(prop.animator.values) - 1]; - if(key_next.time < PROJECT.animator.frames_total) { + if(key_next.time < TOTAL_FRAMES) { draw_set_color(key_next.value); draw_rectangle(key_next.dopesheet_x, _gy_top, bar_show_w, _gy_bottom, 0); } @@ -957,7 +957,7 @@ function Panel_Animation() : PanelContent() constructor { var _t = -1; for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time < PROJECT.animator.current_frame) + if(_key.time < CURRENT_FRAME) _t = _key.time; } if(_t > -1) PROJECT.animator.setFrame(_t); @@ -967,7 +967,7 @@ function Panel_Animation() : PanelContent() constructor { if(buttonInstant(noone, tx - ui(6), ty - ui(6), ui(12), ui(12), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner]) == 2) { for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time > PROJECT.animator.current_frame) { + if(_key.time > CURRENT_FRAME) { PROJECT.animator.setFrame(_key.time); break; } @@ -981,18 +981,18 @@ function Panel_Animation() : PanelContent() constructor { var _add = false; for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time == PROJECT.animator.current_frame) { + if(_key.time == CURRENT_FRAME) { if(ds_list_size(animator.values) > 1) ds_list_delete(animator.values, k); _add = true; break; - } else if(_key.time > PROJECT.animator.current_frame) { - ds_list_insert(animator.values, k, new valueKey(PROJECT.animator.current_frame, animator.getValue(), animator)); + } else if(_key.time > CURRENT_FRAME) { + ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, animator.getValue(), animator)); _add = true; break; } } - if(!_add) ds_list_add(animator.values, new valueKey(PROJECT.animator.current_frame, animator.getValue(, false), animator)); + if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(, false), animator)); } #endregion @@ -1166,7 +1166,7 @@ function Panel_Animation() : PanelContent() constructor { var bar_y = h - timeline_h - ui(10); var bar_w = timeline_w; var bar_h = timeline_h; - var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); + var bar_total_w = TOTAL_FRAMES * ui(timeline_scale); if(!is_surface(dope_sheet_surface) || !surface_exists(dope_sheet_surface)) dope_sheet_surface = surface_create_valid(dope_sheet_w, dope_sheet_h); @@ -1277,7 +1277,7 @@ function Panel_Animation() : PanelContent() constructor { dope_sheet_y_max = max(0, dope_sheet_y_max - dope_sheet_h + ui(48)); - for(var i = timeline_sep_line; i <= PROJECT.animator.frames_total; i += timeline_sep_line) { + for(var i = timeline_sep_line; i <= TOTAL_FRAMES; i += timeline_sep_line) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_color(COLORS.panel_animation_frame_divider); draw_set_alpha(i % timeline_separate == 0? 1 : 0.1); @@ -1294,7 +1294,7 @@ function Panel_Animation() : PanelContent() constructor { var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2; len = max(1, len); TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len); - PROJECT.animator.frames_total = len; + TOTAL_FRAMES = len; if(mouse_release(mb_left)) timeline_stretch = 0; @@ -1304,8 +1304,8 @@ function Panel_Animation() : PanelContent() constructor { var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2; len = max(1, len); TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len); - var _len = PROJECT.animator.frames_total; - PROJECT.animator.frames_total = len; + var _len = TOTAL_FRAMES; + TOTAL_FRAMES = len; if(_len != len) { var key = ds_map_find_first(PROJECT.nodeMap); @@ -1344,7 +1344,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_stretch = 2; timeline_stretch_mx = msx; - timeline_stretch_sx = PROJECT.animator.frames_total; + timeline_stretch_sx = TOTAL_FRAMES; } } else { draw_sprite_ui(THEME.animation_stretch, 0, stx, sty, 1, 1, 0, COLORS._main_icon, 1); @@ -1352,7 +1352,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_stretch = 1; timeline_stretch_mx = msx; - timeline_stretch_sx = PROJECT.animator.frames_total; + timeline_stretch_sx = TOTAL_FRAMES; } } } else @@ -1505,7 +1505,7 @@ function Panel_Animation() : PanelContent() constructor { ov = v; } - t = PROJECT.animator.frames_total - 1; + t = TOTAL_FRAMES - 1; if(t > ot && ov) { x0 = (ot + 1) * ui(timeline_scale) + timeline_shift; x1 = ( t + 1) * ui(timeline_scale) + timeline_shift; @@ -1633,7 +1633,7 @@ function Panel_Animation() : PanelContent() constructor { draw_set_color(COLORS.panel_animation_timeline_top); draw_rectangle(PANEL_PAD, PANEL_PAD, ww - 1, hh, false); - for(var i = timeline_separate; i <= PROJECT.animator.frames_total; i += timeline_separate) { + for(var i = timeline_separate; i <= TOTAL_FRAMES; i += timeline_separate) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub); draw_text_add(bar_line_x - ui(2), PANEL_PAD, string(i)); @@ -1643,7 +1643,7 @@ function Panel_Animation() : PanelContent() constructor { var rang = PROJECT.onion_skin.range; var colr = PROJECT.onion_skin.color; - var fr = PROJECT.animator.current_frame + 1; + var fr = CURRENT_FRAME + 1; var tx = fr * ui(timeline_scale) + timeline_shift; var sx = (fr + rang[0]) * ui(timeline_scale) + timeline_shift; var ex = (fr + rang[1]) * ui(timeline_scale) + timeline_shift; @@ -1697,14 +1697,14 @@ function Panel_Animation() : PanelContent() constructor { } } - var bar_line_x = (PROJECT.animator.current_frame + 1) * ui(timeline_scale) + timeline_shift; + var bar_line_x = (CURRENT_FRAME + 1) * ui(timeline_scale) + timeline_shift; var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent; draw_set_color(cc); draw_set_font(f_p2); draw_line(bar_line_x, PANEL_PAD, bar_line_x, dope_sheet_h); - var cf = string(PROJECT.animator.current_frame + 1); + var cf = string(CURRENT_FRAME + 1); var tx = string_width(cf) + ui(4); draw_rectangle(bar_line_x - tx, PANEL_PAD, bar_line_x, hh, false); @@ -1773,18 +1773,18 @@ function Panel_Animation() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), y0, w - ui(16), y1 - y0); var pw = w - ui(16); - var px = ui(8) + pw * (PROJECT.animator.current_frame / PROJECT.animator.frames_total); + var px = ui(8) + pw * (CURRENT_FRAME / TOTAL_FRAMES); draw_set_color(COLORS._main_accent); draw_line(px, y0, px, y1); if(point_in_rectangle(mx, my, ui(8), y0, w - ui(16), y1)) { if(mouse_click(mb_left, pFOCUS)) { - var rfrm = (mx - ui(8)) / (w - ui(16)) * PROJECT.animator.frames_total; - PROJECT.animator.setFrame(clamp(rfrm, 0, PROJECT.animator.frames_total - 1)); + var rfrm = (mx - ui(8)) / (w - ui(16)) * TOTAL_FRAMES; + PROJECT.animator.setFrame(clamp(rfrm, 0, TOTAL_FRAMES - 1)); } } - var txt = string(PROJECT.animator.current_frame + 1) + "/" + string(PROJECT.animator.frames_total); + var txt = string(CURRENT_FRAME + 1) + "/" + string(TOTAL_FRAMES); if(y1 - y0 < ui(40)) { draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub); @@ -1872,7 +1872,7 @@ function Panel_Animation() : PanelContent() constructor { drawAnimationControl(); if(timeline_show_time > -1) { - TOOLTIP = __txt("Frame") + " " + string(timeline_show_time + 1) + "/" + string(PROJECT.animator.frames_total); + TOOLTIP = __txt("Frame") + " " + string(timeline_show_time + 1) + "/" + string(TOTAL_FRAMES); timeline_show_time = -1; } } #endregion @@ -1906,10 +1906,10 @@ function Panel_Animation() : PanelContent() constructor { if(ds_list_empty(copy_clipboard)) return; var shf = 0; - var minx = PROJECT.animator.frames_total + 2; + var minx = TOTAL_FRAMES + 2; for( var i = 0; i < ds_list_size(copy_clipboard); i++ ) minx = min(minx, copy_clipboard[| i].time); - shf = PROJECT.animator.current_frame - minx; + shf = CURRENT_FRAME - minx; var multiVal = false; var _val = noone; diff --git a/scripts/panel_animation_scaler/panel_animation_scaler.gml b/scripts/panel_animation_scaler/panel_animation_scaler.gml index 2eceb7758..1ebfafb15 100644 --- a/scripts/panel_animation_scaler/panel_animation_scaler.gml +++ b/scripts/panel_animation_scaler/panel_animation_scaler.gml @@ -2,7 +2,7 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor { title = __txtx("anim_scale_title", "Animation scaler"); w = ui(380); - scale_to = PROJECT.animator.frames_total; + scale_to = TOTAL_FRAMES; #region data properties = [ @@ -24,7 +24,7 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor { #endregion static scale = function() { - var fac = scale_to / PROJECT.animator.frames_total; + 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]; @@ -40,7 +40,7 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor { } } } - PROJECT.animator.frames_total = scale_to; + TOTAL_FRAMES = scale_to; close(); } diff --git a/scripts/panel_animation_settings/panel_animation_settings.gml b/scripts/panel_animation_settings/panel_animation_settings.gml index 02e4bcaaa..2619c7942 100644 --- a/scripts/panel_animation_settings/panel_animation_settings.gml +++ b/scripts/panel_animation_settings/panel_animation_settings.gml @@ -7,10 +7,10 @@ function Panel_Animation_Setting() : Panel_Linear_Setting() constructor { properties = [ [ new textBox(TEXTBOX_INPUT.number, function(str) { - PROJECT.animator.frames_total = real(str); + TOTAL_FRAMES = real(str); }), __txtx("anim_length", "Animation length"), - function() { return PROJECT.animator.frames_total; } + function() { return TOTAL_FRAMES; } ], [ new textBox(TEXTBOX_INPUT.number, function(str) { diff --git a/scripts/panel_array_sequence/panel_array_sequence.gml b/scripts/panel_array_sequence/panel_array_sequence.gml index 72eae2ead..2c8529cca 100644 --- a/scripts/panel_array_sequence/panel_array_sequence.gml +++ b/scripts/panel_array_sequence/panel_array_sequence.gml @@ -96,7 +96,7 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { } else draw_sprite_ui(THEME.animation_stretch, 0, ax, ay,,,,, 0.75); - for( var i = 0; i < PROJECT.animator.frames_total; i++ ) { + for( var i = 0; i < TOTAL_FRAMES; i++ ) { var _sx = sequence_x + i * _ns; draw_set_color(COLORS._main_text_sub); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 9dd124b2e..e03e60975 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -283,6 +283,9 @@ function Panel_Preview() : PanelContent() constructor { if(resetViewOnDoubleClick) do_fullView = true; + if(is_instanceof(node, Node) && node.getPreviewingNode != noone) + node = node.getPreviewingNode(); + preview_node[splitView? splitSelection : 0] = node; } #endregion @@ -566,7 +569,7 @@ function Panel_Preview() : PanelContent() constructor { var _step = PROJECT.onion_skin.step; var _top = PROJECT.onion_skin.on_top; - var fr = PROJECT.animator.current_frame; + var fr = CURRENT_FRAME; var st = min(_rang[0], _rang[1]); var ed = max(_rang[0], _rang[1]); @@ -959,7 +962,7 @@ function Panel_Preview() : PanelContent() constructor { right_menu_y += string_height("l"); draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub); - draw_text(w - ui(8), right_menu_y, $"{__txt("Frame")} {PROJECT.animator.current_frame}/{PROJECT.animator.frames_total}"); + draw_text(w - ui(8), right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME}/{TOTAL_FRAMES}"); right_menu_y += string_height("l"); draw_text(w - ui(8), right_menu_y, $"x{canvas_s}"); diff --git a/scripts/pcx_ast/pcx_ast.gml b/scripts/pcx_ast/pcx_ast.gml index 389e25a8f..7a4bfcd81 100644 --- a/scripts/pcx_ast/pcx_ast.gml +++ b/scripts/pcx_ast/pcx_ast.gml @@ -34,7 +34,7 @@ global.FUNCTIONS[? "lerp"] = [ ["x", "y", "amount"], function(val) { return lerp(array_safe_get(val, 0), array_safe_get(val, 1), array_safe_get(val, 2)); } ]; global.FUNCTIONS[? "wiggle"] = [ ["time", "frequency", "octave = 1", "seed = 0"], function(val) { - return wiggle(0, 1, PROJECT.animator.frames_total / array_safe_get(val, 1), + return wiggle(0, 1, TOTAL_FRAMES / array_safe_get(val, 1), array_safe_get(val, 0), array_safe_get(val, 3, 0), array_safe_get(val, 2, 1)); @@ -89,11 +89,11 @@ PROJECT_VARIABLES = {}; PROJECT_VARIABLES.Project = {}; - PROJECT_VARIABLES.Project.frame = [ function() { return PROJECT.animator.current_frame }, EXPRESS_TREE_ANIM.animated ]; - PROJECT_VARIABLES.Project.progress = [ function() { return PROJECT.animator.current_frame / (PROJECT.animator.frames_total - 1) }, EXPRESS_TREE_ANIM.animated ]; - PROJECT_VARIABLES.Project.frameTotal = [ function() { return PROJECT.animator.frames_total }, EXPRESS_TREE_ANIM.none ]; + PROJECT_VARIABLES.Project.frame = [ function() { return CURRENT_FRAME }, EXPRESS_TREE_ANIM.animated ]; + PROJECT_VARIABLES.Project.progress = [ function() { return CURRENT_FRAME / (TOTAL_FRAMES - 1) }, EXPRESS_TREE_ANIM.animated ]; + PROJECT_VARIABLES.Project.frameTotal = [ function() { return TOTAL_FRAMES }, EXPRESS_TREE_ANIM.none ]; PROJECT_VARIABLES.Project.fps = [ function() { return PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.none ]; - PROJECT_VARIABLES.Project.time = [ function() { return PROJECT.animator.current_frame / PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.animated ]; + PROJECT_VARIABLES.Project.time = [ function() { return CURRENT_FRAME / PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.animated ]; PROJECT_VARIABLES.Project.name = [ function() { return filename_name_only(PROJECT.path) }, EXPRESS_TREE_ANIM.none ]; PROJECT_VARIABLES.Program = {}; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 9265b6182..e406d6ac5 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -63,7 +63,7 @@ function __nodeInLoop(_node) { #region } #endregion 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 {CURRENT_FRAME}] XXXXXXXXXXXXXXXXXXXX"); var _key = ds_map_find_first(PROJECT.nodeMap); var amo = ds_map_size(PROJECT.nodeMap); @@ -149,7 +149,7 @@ function __sortGraph(_list, _nodeList) { #region function Render(partial = false, runAction = false) { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {PROJECT.animator.current_frame}] =============================="); + LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {CURRENT_FRAME}] =============================="); try { var t = get_timer(); @@ -359,7 +359,7 @@ function RenderList(list, skipInLoop = true) { #region } #endregion function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { #region - printIf(global.FLAG.render, "=== RENDER LIST ACTION START [frame " + string(PROJECT.animator.current_frame) + "] ==="); + printIf(global.FLAG.render, "=== RENDER LIST ACTION START [frame " + string(CURRENT_FRAME) + "] ==="); try { var rendering = noone; diff --git a/scripts/shader_functions/shader_functions.gml b/scripts/shader_functions/shader_functions.gml index 93390f89e..28ee1f06f 100644 --- a/scripts/shader_functions/shader_functions.gml +++ b/scripts/shader_functions/shader_functions.gml @@ -226,6 +226,7 @@ function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount", BLEND_NORMAL; surface_reset_target(); + gpu_set_tex_filter(false); if(__shader_set) shader_reset(); diff --git a/sprites/s_node_vfx_render_output/4a71af77-ab06-447a-9172-00a23a5cb414.png b/sprites/s_node_vfx_render_output/4a71af77-ab06-447a-9172-00a23a5cb414.png new file mode 100644 index 000000000..34beb4d8a Binary files /dev/null and b/sprites/s_node_vfx_render_output/4a71af77-ab06-447a-9172-00a23a5cb414.png differ diff --git a/sprites/s_node_vfx_render_output/layers/4a71af77-ab06-447a-9172-00a23a5cb414/89c4d0a0-4321-4911-a8fc-b01a143b5b5e.png b/sprites/s_node_vfx_render_output/layers/4a71af77-ab06-447a-9172-00a23a5cb414/89c4d0a0-4321-4911-a8fc-b01a143b5b5e.png new file mode 100644 index 000000000..34beb4d8a Binary files /dev/null and b/sprites/s_node_vfx_render_output/layers/4a71af77-ab06-447a-9172-00a23a5cb414/89c4d0a0-4321-4911-a8fc-b01a143b5b5e.png differ diff --git a/sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy b/sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy new file mode 100644 index 000000000..10eee0f8a --- /dev/null +++ b/sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_vfx_render_output", + "bbox_bottom": 63, + "bbox_left": 0, + "bbox_right": 63, + "bbox_top": 0, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"4a71af77-ab06-447a-9172-00a23a5cb414",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"89c4d0a0-4321-4911-a8fc-b01a143b5b5e","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "VFX", + "path": "folders/nodes/icons/VFX.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_vfx_render_output", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"4a71af77-ab06-447a-9172-00a23a5cb414","path":"sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy",},},},"Disabled":false,"id":"b2ad5885-844f-477b-b38f-968650d78498","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file