From 8c496994164c0c82d37da226f00a7307e296f740 Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Tue, 10 Oct 2023 12:12:42 +0700 Subject: [PATCH] VFX stuffs and array sample node. --- PixelComposer.resource_order | 4 +- PixelComposer.yyp | 5 +- datafiles/data/related_node.json | 3 +- scripts/__VFX/__VFX.gml | 4 +- scripts/__surface/__surface.gml | 7 +- .../_node_VFX_effector/_node_VFX_effector.gml | 9 --- .../_node_VFX_spawner/_node_VFX_spawner.gml | 6 +- .../node_VFX_effect_accelerate.gml | 12 +-- .../node_VFX_effect_attract.gml | 22 +++--- .../node_VFX_effect_destroy.gml | 2 +- .../node_VFX_effect_repel.gml | 22 +++--- .../node_VFX_effect_turbulence.gml | 27 ++++--- .../node_VFX_effect_vortex.gml | 30 ++++--- .../node_VFX_effect_wind.gml | 8 +- .../node_VFX_effector/node_VFX_effector.gml | 52 ++++++++---- scripts/node_VFX_group/node_VFX_group.gml | 60 ++++++++++---- .../node_array_sample/node_array_sample.gml | 54 +++++++++++++ .../node_array_sample.yy} | 6 +- scripts/node_array_sample/node_counter.yy | 12 +++ .../node_audio_window/node_audio_window.gml | 2 +- scripts/node_collection/node_collection.gml | 22 +++--- scripts/node_data/node_data.gml | 6 +- scripts/node_iterate/node_iterate.gml | 3 +- .../node_iterate_each/node_iterate_each.gml | 3 +- .../node_iterate_filter.gml | 3 +- .../node_iterate_sort/node_iterate_sort.gml | 3 +- scripts/node_processor/node_processor.gml | 4 +- scripts/node_registry/node_registry.gml | 1 + scripts/node_scale/node_scale.gml | 43 ++++++++-- scripts/node_scale_algo/node_scale_algo.gml | 38 +++++++-- scripts/render_data/render_data.gml | 19 +---- .../f22a7ff8-3119-4af6-871a-90c7358e6a54.png | Bin 0 -> 1039 bytes .../cbc68d05-16a3-4e98-8366-d7a9375c5236.png | Bin 0 -> 1039 bytes .../s_node_array_sample.yy | 74 ++++++++++++++++++ 34 files changed, 417 insertions(+), 149 deletions(-) delete mode 100644 scripts/_node_VFX_effector/_node_VFX_effector.gml create mode 100644 scripts/node_array_sample/node_array_sample.gml rename scripts/{_node_VFX_effector/_node_VFX_effector.yy => node_array_sample/node_array_sample.yy} (51%) create mode 100644 scripts/node_array_sample/node_counter.yy create mode 100644 sprites/s_node_array_sample/f22a7ff8-3119-4af6-871a-90c7358e6a54.png create mode 100644 sprites/s_node_array_sample/layers/f22a7ff8-3119-4af6-871a-90c7358e6a54/cbc68d05-16a3-4e98-8366-d7a9375c5236.png create mode 100644 sprites/s_node_array_sample/s_node_array_sample.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 3ca49dc7f..cc6ec7730 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -125,6 +125,7 @@ {"name":"fluidSim","order":2,"path":"folders/nodes/data/simulation/fluidSim.yy",}, {"name":"strandSim","order":1,"path":"folders/nodes/data/simulation/strandSim.yy",}, {"name":"VFX","order":3,"path":"folders/nodes/data/simulation/VFX.yy",}, + {"name":"effector","order":18,"path":"folders/nodes/data/simulation/VFX/effector.yy",}, {"name":"transform","order":9,"path":"folders/nodes/data/transform.yy",}, {"name":"value","order":4,"path":"folders/nodes/data/value.yy",}, {"name":"array","order":1,"path":"folders/nodes/data/value/array.yy",}, @@ -216,7 +217,6 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, - {"name":"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",}, @@ -730,6 +730,7 @@ {"name":"node_noise_cell","order":2,"path":"scripts/node_noise_cell/node_noise_cell.yy",}, {"name":"s_node_pb_fx_radial","order":4,"path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",}, {"name":"__background_get_internal","order":2,"path":"scripts/__background_get_internal/__background_get_internal.yy",}, + {"name":"s_node_array_sample","order":18,"path":"sprites/s_node_array_sample/s_node_array_sample.yy",}, {"name":"s_biterator_b_labels","order":9,"path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",}, {"name":"d3d_ray","order":9,"path":"scripts/d3d_ray/d3d_ray.yy",}, {"name":"sh_combine_hsv","order":10,"path":"shaders/sh_combine_hsv/sh_combine_hsv.yy",}, @@ -816,6 +817,7 @@ {"name":"node_path_builder","order":9,"path":"scripts/node_path_builder/node_path_builder.yy",}, {"name":"o_dialog_gradient","order":1,"path":"objects/o_dialog_gradient/o_dialog_gradient.yy",}, {"name":"sh_channel_R_grey","order":7,"path":"shaders/sh_channel_R_grey/sh_channel_R_grey.yy",}, + {"name":"node_array_sample","order":18,"path":"scripts/node_array_sample/node_array_sample.yy",}, {"name":"sh_blend_subtract","order":5,"path":"shaders/sh_blend_subtract/sh_blend_subtract.yy",}, {"name":"BBMOD_Vec4","order":6,"path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",}, {"name":"s_biterator_color_slot","order":17,"path":"sprites/s_biterator_color_slot/s_biterator_color_slot.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 97f668338..19ab5be1d 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -153,6 +153,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"rigidSim","folderPath":"folders/nodes/data/simulation/rigidSim.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"strandSim","folderPath":"folders/nodes/data/simulation/strandSim.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"VFX","folderPath":"folders/nodes/data/simulation/VFX.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"effector","folderPath":"folders/nodes/data/simulation/VFX/effector.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"transform","folderPath":"folders/nodes/data/transform.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"value","folderPath":"folders/nodes/data/value.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"array","folderPath":"folders/nodes/data/value/array.yy",}, @@ -250,7 +251,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"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",}, @@ -1339,6 +1339,7 @@ {"id":{"name":"node_noise_cell","path":"scripts/node_noise_cell/node_noise_cell.yy",},}, {"id":{"name":"s_node_pb_fx_radial","path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",},}, {"id":{"name":"__background_get_internal","path":"scripts/__background_get_internal/__background_get_internal.yy",},}, + {"id":{"name":"s_node_array_sample","path":"sprites/s_node_array_sample/s_node_array_sample.yy",},}, {"id":{"name":"s_biterator_b_labels","path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",},}, {"id":{"name":"d3d_ray","path":"scripts/d3d_ray/d3d_ray.yy",},}, {"id":{"name":"sh_combine_hsv","path":"shaders/sh_combine_hsv/sh_combine_hsv.yy",},}, @@ -1439,6 +1440,7 @@ {"id":{"name":"node_path_builder","path":"scripts/node_path_builder/node_path_builder.yy",},}, {"id":{"name":"o_dialog_gradient","path":"objects/o_dialog_gradient/o_dialog_gradient.yy",},}, {"id":{"name":"sh_channel_R_grey","path":"shaders/sh_channel_R_grey/sh_channel_R_grey.yy",},}, + {"id":{"name":"node_array_sample","path":"scripts/node_array_sample/node_array_sample.yy",},}, {"id":{"name":"sh_blend_subtract","path":"shaders/sh_blend_subtract/sh_blend_subtract.yy",},}, {"id":{"name":"BBMOD_Vec4","path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",},}, {"id":{"name":"s_biterator_color_slot","path":"sprites/s_biterator_color_slot/s_biterator_color_slot.yy",},}, @@ -1510,7 +1512,6 @@ {"id":{"name":"node_VFX_override","path":"scripts/node_VFX_override/node_VFX_override.yy",},}, {"id":{"name":"fd_README","path":"scripts/fd_README/fd_README.yy",},}, {"id":{"name":"ase_object","path":"scripts/ase_object/ase_object.yy",},}, - {"id":{"name":"_node_VFX_effector","path":"scripts/_node_VFX_effector/_node_VFX_effector.yy",},}, {"id":{"name":"node_rigid_object","path":"scripts/node_rigid_object/node_rigid_object.yy",},}, {"id":{"name":"node_pb_box_transform","path":"scripts/node_pb_box_transform/node_pb_box_transform.yy",},}, {"id":{"name":"areaBox","path":"scripts/areaBox/areaBox.yy",},}, diff --git a/datafiles/data/related_node.json b/datafiles/data/related_node.json index 43508bf0d..ee0cb5284 100644 --- a/datafiles/data/related_node.json +++ b/datafiles/data/related_node.json @@ -28,7 +28,8 @@ "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" ] + "Node_Strand_Group": [ "Node_Strand_Create", "Node_Strand_Gravity", "Node_Strand_Update", "Node_Strand_Render", "Node_Strand_Render_Texture" ], + "Node_VFX_Group": [ "Node_VFX_Spawner", "Node_VFX_Renderer", "Node_VFX_Renderer_Output" ] } } } \ No newline at end of file diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index f42cafd8d..02e77afe3 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -255,7 +255,7 @@ function __part(_node) constructor { } var lifeRat = 1 - life / life_total; - var scCurve = sct.get(lifeRat); + var scCurve = sct == noone? 1 : sct.get(lifeRat); scx = drawsx * scCurve; scy = drawsy * scCurve; @@ -284,7 +284,7 @@ function __part(_node) constructor { var cc = (col == -1)? c_white : col.eval(lifeRat); if(blend != c_white) cc = colorMultiply(blend, cc); - alp_draw = alp * alp_fade.get(lifeRat); + alp_draw = alp * (alp_fade == noone? 1 : 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); diff --git a/scripts/__surface/__surface.gml b/scripts/__surface/__surface.gml index 0ec95bd56..3d1126a4d 100644 --- a/scripts/__surface/__surface.gml +++ b/scripts/__surface/__surface.gml @@ -46,10 +46,13 @@ function SurfaceAtlas(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = return self; } - static clone = function() { + static clone = function(_surface = false) { gml_pragma("forceinline"); - return new SurfaceAtlas(getSurface(), x, y, rotation, sx, sy, blend, alpha); + var _surf = getSurface(); + if(_surface) _surf = surface_clone(_surf); + + return new SurfaceAtlas(_surf, x, y, rotation, sx, sy, blend, alpha); } } diff --git a/scripts/_node_VFX_effector/_node_VFX_effector.gml b/scripts/_node_VFX_effector/_node_VFX_effector.gml deleted file mode 100644 index ff1368a2b..000000000 --- a/scripts/_node_VFX_effector/_node_VFX_effector.gml +++ /dev/null @@ -1,9 +0,0 @@ -enum FORCE_TYPE { - Wind, - Accelerate, - Attract, - Repel, - Vortex, - Turbulence, - Destroy -} \ 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 33c8fbf6a..b9c0dbdb0 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -367,7 +367,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co } #region ----- precomputes ----- - seed = getInputData(32); + resetSeed(); var _wigg_pos = getInputData(41); var _wigg_rot = getInputData(42); @@ -391,6 +391,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co render(); } #endregion + static resetSeed = function() { #region + seed = getInputData(32); + } #endregion + function checkPartPool() { #region var _part_amo = attributes.part_amount; var _curr_amo = array_length(parts); diff --git a/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.gml b/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.gml index e48534916..ceae09d81 100644 --- a/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.gml +++ b/scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.gml @@ -3,12 +3,12 @@ function Node_VFX_Accelerate(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, node_draw_icon = s_node_vfx_accel; function onAffect(part, str) { - var _vect = current_data[4]; - var _sten = current_data[5]; - var _rot_range = current_data[6]; - var _sca_range = current_data[7]; - var _rot = random_range(_rot_range[0], _rot_range[1]); - var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; + var _vect = getInputData(4); + var _sten = getInputData(5); + var _rot_range = getInputData(6); + var _sca_range = getInputData(7); + var _rot = random_range(_rot_range[0], _rot_range[1]); + var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; part.sx = part.sx + _vect[0] * str * _sten; part.sy = part.sy + _vect[1] * str * _sten; diff --git a/scripts/node_VFX_effect_attract/node_VFX_effect_attract.gml b/scripts/node_VFX_effect_attract/node_VFX_effect_attract.gml index 2d3aa59e6..ac877960a 100644 --- a/scripts/node_VFX_effect_attract/node_VFX_effect_attract.gml +++ b/scripts/node_VFX_effect_attract/node_VFX_effect_attract.gml @@ -5,20 +5,20 @@ function Node_VFX_Attract(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _g inputs[| 4].setVisible(false, false); function onAffect(part, str) { - var _area = current_data[1]; - var _area_x = _area[0]; - var _area_y = _area[1]; + var _area = getInputData(1); + var _area_x = _area[0]; + var _area_y = _area[1]; - var _sten = current_data[5]; - var _rot_range = current_data[6]; - var _sca_range = current_data[7]; - var _rot = random_range(_rot_range[0], _rot_range[1]); - var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; + var _sten = getInputData(5); + var _rot_range = getInputData(6); + var _sca_range = getInputData(7); + var _rot = random_range(_rot_range[0], _rot_range[1]); + var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; - var pv = part.getPivot(); + var pv = part.getPivot(); var dirr = point_direction(pv[0], pv[1], _area_x, _area_y); - part.x = part.x + lengthdir_x(_sten * str, dirr); - part.y = part.y + lengthdir_y(_sten * str, dirr); + part.x = part.x + lengthdir_x(_sten * str, dirr); + part.y = part.y + lengthdir_y(_sten * str, dirr); part.rot += _rot * str; diff --git a/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.gml b/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.gml index 0a848f53d..00624e238 100644 --- a/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.gml +++ b/scripts/node_VFX_effect_destroy/node_VFX_effect_destroy.gml @@ -7,7 +7,7 @@ function Node_VFX_Destroy(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _g inputs[| 7].setVisible(false, false); function onAffect(part, str) { - var _sten = current_data[5]; + var _sten = getInputData(5); if(random(1) < str * _sten) part.kill(); diff --git a/scripts/node_VFX_effect_repel/node_VFX_effect_repel.gml b/scripts/node_VFX_effect_repel/node_VFX_effect_repel.gml index a7e328024..773f3c536 100644 --- a/scripts/node_VFX_effect_repel/node_VFX_effect_repel.gml +++ b/scripts/node_VFX_effect_repel/node_VFX_effect_repel.gml @@ -5,20 +5,20 @@ function Node_VFX_Repel(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _gro inputs[| 4].setVisible(false, false); function onAffect(part, str) { - var _area = current_data[1]; - var _area_x = _area[0]; - var _area_y = _area[1]; + var _area = getInputData(1); + var _area_x = _area[0]; + var _area_y = _area[1]; - var _sten = current_data[5]; - var _rot_range = current_data[6]; - var _sca_range = current_data[7]; - var _rot = random_range(_rot_range[0], _rot_range[1]); - var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; + var _sten = getInputData(5); + var _rot_range = getInputData(6); + var _sca_range = getInputData(7); + var _rot = random_range(_rot_range[0], _rot_range[1]); + var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; - var pv = part.getPivot(); + var pv = part.getPivot(); var dirr = point_direction(_area_x, _area_y, pv[0], pv[1]); - part.x = part.x + lengthdir_x(_sten * str, dirr); - part.y = part.y + lengthdir_y(_sten * str, dirr); + part.x = part.x + lengthdir_x(_sten * str, dirr); + part.y = part.y + lengthdir_y(_sten * str, dirr); part.rot += _rot * str; diff --git a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml index 09d92bf05..757a1c988 100644 --- a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml +++ b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml @@ -4,23 +4,28 @@ function Node_VFX_Turbulence(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, inputs[| 4].setVisible(false, false); - inputs[| 8] = nodeValue("Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) - .setVisible(true, false); + inputs[| effector_input_length + 0] = nodeValue("Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ); + + inputs[| effector_input_length + 1] = nodeValue("Constant seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); - array_push(input_display_list, 8); + array_push(input_display_list, effector_input_length + 0, effector_input_length + 1); function onAffect(part, str) { - var _sten = current_data[5]; - var _rot_range = current_data[6]; - var _sca_range = current_data[7]; - var _rot = random_range(_rot_range[0], _rot_range[1]); - var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; + var _sten = getInputData(5); + var _rot_range = getInputData(6); + var _sca_range = getInputData(7); + var _rot = random_range(_rot_range[0], _rot_range[1]); + var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; var pv = part.getPivot(); - var t_scale = current_data[8]; - var perx = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, part.seed) - 0.5) * 2; - var pery = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, part.seed + 100) - 0.5) * 2; + var t_scale = getInputData(effector_input_length + 0); + var con_sed = getInputData(effector_input_length + 1); + + var _seed = con_sed? seed : part.seed; + + var perx = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, _seed) - 0.5) * 2; + var pery = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, _seed + 100) - 0.5) * 2; part.x += perx * str * _sten; part.y += pery * str * _sten; diff --git a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml index c4ac661a8..526226004 100644 --- a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml +++ b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml @@ -4,24 +4,27 @@ function Node_VFX_Vortex(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _gr inputs[| 4].setVisible(false, false); - inputs[| 8] = nodeValue("Attraction force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ); + inputs[| effector_input_length + 0] = nodeValue("Attraction force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ); - inputs[| 9] = nodeValue("Clockwise", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); + inputs[| effector_input_length + 1] = nodeValue("Clockwise", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); + + inputs[| effector_input_length + 2] = nodeValue("Destroy when reach middle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); - array_push(input_display_list, 8, 9); + array_push(input_display_list, effector_input_length + 0, effector_input_length + 1, effector_input_length + 2); function onAffect(part, str) { - var _area = current_data[1]; - var _area_x = _area[0]; - var _area_y = _area[1]; + var _area = getInputData(1); + var _area_x = _area[0]; + var _area_y = _area[1]; - var _sten = current_data[5]; - var _rot_range = current_data[6]; - var _sca_range = current_data[7]; - var _attr = current_data[8]; - var _clkw = current_data[9]; + var _sten = getInputData(5); + var _rot_range = getInputData(6); + var _sca_range = getInputData(7); + var _attr = getInputData(effector_input_length + 0); + var _clkw = getInputData(effector_input_length + 1); + var _dest = getInputData(effector_input_length + 2); - var _rot = random_range(_rot_range[0], _rot_range[1]); + var _rot = random_range(_rot_range[0], _rot_range[1]); var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; var pv = part.getPivot(); @@ -42,6 +45,9 @@ function Node_VFX_Vortex(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _gr else part.scx += sign(part.scx) * scx_s; if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s)); else part.scy += sign(part.scy) * scy_s; + + if(_dest && point_distance(pv[0], pv[1], _area_x, _area_y) <= 1) + part.kill(); } PATCH_STATIC diff --git a/scripts/node_VFX_effect_wind/node_VFX_effect_wind.gml b/scripts/node_VFX_effect_wind/node_VFX_effect_wind.gml index 756b1e1ec..de4a49ca8 100644 --- a/scripts/node_VFX_effect_wind/node_VFX_effect_wind.gml +++ b/scripts/node_VFX_effect_wind/node_VFX_effect_wind.gml @@ -3,12 +3,12 @@ function Node_VFX_Wind(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _grou node_draw_icon = s_node_vfx_wind; function onAffect(part, str) { - var _vect = getInputData(4); - var _sten = getInputData(5); + var _vect = getInputData(4); + var _sten = getInputData(5); var _rot_range = getInputData(6); var _sca_range = getInputData(7); - var _rot = random_range(_rot_range[0], _rot_range[1]); - var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; + var _rot = random_range(_rot_range[0], _rot_range[1]); + var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ]; part.x = part.x + _vect[0] * _sten * str; part.y = part.y + _vect[1] * _sten * str; diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index d44261db7..b3bbb7c8d 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -1,3 +1,13 @@ +enum FORCE_TYPE { + Wind, + Accelerate, + Attract, + Repel, + Vortex, + Turbulence, + Destroy +} + function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Effector"; color = COLORS.node_blend_vfx; @@ -8,6 +18,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr w = 96; h = 80; min_h = h; + seed = 1; inputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, -1 ) .setVisible(true, true); @@ -37,16 +48,21 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setDisplay(VALUE_DISPLAY.vector_range, { linked : true }) .rejectArray(); + inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(100000, 999999) ) + .rejectArray(); + + effector_input_length = ds_list_size(inputs); + input_display_list = [ 0, ["Area", false], 1, 2, 3, - ["Effect", false], 4, 5, 6, 7, + ["Effect", false], 8, 4, 5, 6, 7, ]; outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, -1 ); UPDATE_PART_FORWARD - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); var area = getInputData(1); @@ -86,11 +102,19 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr } draw_set_alpha(1); } - } + } #endregion + + function reset() { #region + resetSeed(); + } #endregion + + static resetSeed = function() { #region + seed = getInputData(8); + } #endregion function onAffect(part, str) {} - function affect(part) { + function affect(part) { #region if(!part.active) return; var _area = getInputData(1); @@ -108,7 +132,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _area_y0 = _area_y - _area_h; var _area_y1 = _area_y + _area_h; - random_set_seed(part.seed); + random_set_seed(part.seed + seed); var str = 0, in, _dst; var pv = part.getPivot(); @@ -116,9 +140,9 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(_area_t == AREA_SHAPE.rectangle) { in = point_in_rectangle(pv[0], pv[1], _area_x0, _area_y0, _area_x1, _area_y1) _dst = min( distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x1, _area_y0), - distance_to_line(pv[0], pv[1], _area_x0, _area_y1, _area_x1, _area_y1), - distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x0, _area_y1), - distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _area_y1)); + distance_to_line(pv[0], pv[1], _area_x0, _area_y1, _area_x1, _area_y1), + distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x0, _area_y1), + distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _area_y1)); } else if(_area_t == AREA_SHAPE.elipse) { var _dirr = point_direction(_area_x, _area_y, pv[0], pv[1]); var _epx = _area_x + lengthdir_x(_area_w, _dirr); @@ -137,9 +161,9 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(str == 0) return; onAffect(part, str); - } + } #endregion - static update = function(frame = CURRENT_FRAME) { + static update = function(frame = CURRENT_FRAME) { #region var val = getInputData(0); outputs[| 0].setValue(val); if(val == -1) return; @@ -156,12 +180,12 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(jun.value_to[| j].value_from == jun) jun.value_to[| j].node.doUpdate(); } - } + } #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(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); - } - + } #endregion + getPreviewingNode = VFX_PREVIEW_NODE; } \ 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 f3bd9ae12..f13416d7e 100644 --- a/scripts/node_VFX_group/node_VFX_group.gml +++ b/scripts/node_VFX_group/node_VFX_group.gml @@ -7,29 +7,44 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group name = "VFX"; color = COLORS.node_blend_vfx; icon = THEME.vfx; + update_on_frame = true; + managedRenderOrder = true; topoList = ds_list_create(); ungroupable = false; preview_node = noone; + allCached = false; inputs[| 0] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ) .rejectArray(); custom_input_index = ds_list_size(inputs); - if(!LOADING && !APPENDING && !CLONING) { + if(!LOADING && !APPENDING && !CLONING) { #region var input = nodeBuild("Node_VFX_Spawner", -256, -32, self); var output = nodeBuild("Node_VFX_Renderer_Output", 256 + 32 * 5, -32, self); output.inputs[| output.input_fix_len].setFrom(input.outputs[| 0]); preview_node = output; - } + } #endregion - static reset = function() { + static getNextNodes = function() { return allCached? getNextNodesExternal() : getNextNodesInternal(); } + + insp2UpdateTooltip = "Clear cache"; + insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ]; + + static onInspector2Update = function() { #region for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { var node = nodes[| i]; - if(is_instanceof(node, Node_VFX_Spawner_Base)) - node.reset(); + node.clearCache(); + } + } #endregion + + static reset = function() { #region + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { + var node = nodes[| i]; + if(!struct_has(node, "reset")) continue; + node.reset(); } var loop = getInputData(0); @@ -41,23 +56,38 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group if(is_instanceof(node, Node_VFX_Renderer_Output) || is_instanceof(node, Node_VFX_Renderer)) continue; - node.update(i); + node.doUpdate(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); + if(!struct_has(node, "resetSeed")) continue; + node.resetSeed(); } - } + } #endregion - static update = function() { - if(CURRENT_FRAME == 0) { + static update = function() { #region + if(CURRENT_FRAME == 0) NodeListSort(topoList, nodes); - reset(); + + allCached = true; + 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)) continue; + + if(!node.recoverCache()) allCached = false; } - } + + if(!allCached && CURRENT_FRAME == 0) + reset(); + + if(allCached) { + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) + nodes[| i].setRenderStatus(true); + setRenderStatus(true); + } + } #endregion static ononDoubleClick = function(panel) { #region preview_node = noone; @@ -70,6 +100,8 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group break; } } + + PANEL_PREVIEW.setNodePreview(self); } #endregion getPreviewingNode = function() { return preview_node; } diff --git a/scripts/node_array_sample/node_array_sample.gml b/scripts/node_array_sample/node_array_sample.gml new file mode 100644 index 000000000..0a8f45cf9 --- /dev/null +++ b/scripts/node_array_sample/node_array_sample.gml @@ -0,0 +1,54 @@ +function Node_Array_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { + name = "Array Sample"; + previewable = false; + + w = 96; + h = 32 + 24; + min_h = h; + + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, []) + .setArrayDepth(1) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setVisible(true, true); + + outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0) + .setArrayDepth(1); + + static sample = function(arr, stp) { + __temp_arr = arr; + __temp_stp = stp; + + var _len = floor(array_length(arr)); + var _siz = floor(_len / stp); + + var _res = array_create_ext(_siz, function(_i) { + return __temp_arr[_i * __temp_stp]; + }); + + return _res; + } + + static update = function(frame = CURRENT_FRAME) { + var _arr = getInputData(0); + var _stp = getInputData(1); + + if(array_empty(_arr)) return; + + var res; + + if(is_array(_arr[0])) { + for( var i = 0, n = array_length(_arr); i < n; i++ ) + res[i] = sample(_arr[i], _stp); + } else + res = sample(_arr, _stp); + + outputs[| 0].setValue(res); + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_fit(s_node_array_sample, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + } +} \ No newline at end of file diff --git a/scripts/_node_VFX_effector/_node_VFX_effector.yy b/scripts/node_array_sample/node_array_sample.yy similarity index 51% rename from scripts/_node_VFX_effector/_node_VFX_effector.yy rename to scripts/node_array_sample/node_array_sample.yy index 8dc822dcd..bc5d838ee 100644 --- a/scripts/_node_VFX_effector/_node_VFX_effector.yy +++ b/scripts/node_array_sample/node_array_sample.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "_node_VFX_effector", + "name": "node_array_sample", "isCompatibility": false, "isDnD": false, "parent": { - "name": "effector", - "path": "folders/nodes/data/simulation/VFX/effector.yy", + "name": "array", + "path": "folders/nodes/data/value/array.yy", }, } \ No newline at end of file diff --git a/scripts/node_array_sample/node_counter.yy b/scripts/node_array_sample/node_counter.yy new file mode 100644 index 000000000..10832a0b0 --- /dev/null +++ b/scripts/node_array_sample/node_counter.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "variable", + "path": "folders/nodes/data/variable.yy", + }, + "resourceVersion": "1.0", + "name": "node_counter", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_audio_window/node_audio_window.gml b/scripts/node_audio_window/node_audio_window.gml index 9429349f2..50827aade 100644 --- a/scripts/node_audio_window/node_audio_window.gml +++ b/scripts/node_audio_window/node_audio_window.gml @@ -26,7 +26,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); - inputs[| 5] = nodeValue("Match timeline", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Set window cursor to match animation timeline."); + inputs[| 5] = nodeValue("Match timeline", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Set window cursor to match animation timeline."); outputs[| 0] = nodeValue("Bit Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) .setArrayDepth(1); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 3f2822ae4..6da05aef8 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -3,7 +3,7 @@ enum COLLECTION_TAG { loop = 2 } -function groupNodes(nodeArray, _group = noone, record = true, check_connect = true) { +function groupNodes(nodeArray, _group = noone, record = true, check_connect = true) { #region UNDO_HOLDING = true; if(_group == noone) { @@ -36,9 +36,9 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr if(record) recordAction(ACTION_TYPE.group, _group, { io: _io, content: _content }); return _group; -} +} #endregion -function upgroupNode(collection, record = true) { +function upgroupNode(collection, record = true) { #region UNDO_HOLDING = true; var _content = []; var _io = []; @@ -57,9 +57,9 @@ function upgroupNode(collection, record = true) { UNDO_HOLDING = false; if(record) recordAction(ACTION_TYPE.ungroup, collection, { io: _io, content: _content }); -} +} #endregion -function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { nodes = ds_list_create(); ungroupable = true; auto_render_time = false; @@ -82,6 +82,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc input_dummy = nodeValue("Add to group", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0); draw_dummy = false; + managedRenderOrder = false; + input_dummy.onSetFrom = function(juncFrom) { ds_list_remove(juncFrom.value_to, input_dummy); input_dummy.value_from = noone; @@ -185,7 +187,9 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc return input_dummy; } #endregion - static getNextNodes = function() { #region //get node inside the group + static getNextNodes = function() { return getNextNodesInternal(); } + + static getNextNodesInternal = function() { #region //get node inside the group LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, $"→→→→→ Call get next node from group"); @@ -224,7 +228,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _node = _to.node; LOG_IF(global.FLAG.render == 1, $"Checking node {_node.internalName} : {_node.isRenderable()}"); - if(!_node.isRenderable()) continue; + if(!_node.isRenderable()) continue; array_push(nodes, _to.node); } @@ -439,8 +443,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc ds_priority_destroy(ar); } #endregion - static getTool = function() { - for(var i = 0; i < ds_list_size(nodes); i++) { #region + static getTool = function() { #region + for(var i = 0; i < ds_list_size(nodes); i++) { var _node = nodes[| i]; if(_node.isTool) return _node.getTool(); } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 8b73f4378..715ad4262 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -448,7 +448,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x doUpdate(); } #endregion - static doUpdate = function() { #region + static doUpdate = function(frame = CURRENT_FRAME) { #region if(SAFE_MODE) return; if(NODE_EXTRACT) return; @@ -461,7 +461,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } else { render_cached = false; var sBase = surface_get_target(); - getInputs(); + getInputs(frame); LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} <<<<<<<<<<"); @@ -469,7 +469,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!is_instanceof(self, Node_Collection)) setRenderStatus(true); try { - update(); // Update only if input hash differs from previous. + update(frame); // Update only if input hash differs from previous. } catch(exception) { var sCurr = surface_get_target(); while(surface_get_target() != sBase) diff --git a/scripts/node_iterate/node_iterate.gml b/scripts/node_iterate/node_iterate.gml index 4c4c76841..7acbe8e19 100644 --- a/scripts/node_iterate/node_iterate.gml +++ b/scripts/node_iterate/node_iterate.gml @@ -3,8 +3,9 @@ function Node_Iterate(_x, _y, _group = noone) : Node_Iterator(_x, _y, _group) co color = COLORS.node_blend_loop; icon = THEME.loop; - reset_all_child = true; + reset_all_child = true; combine_render_time = false; + managedRenderOrder = true; iterated = 0; inputs[| 0] = nodeValue("Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) diff --git a/scripts/node_iterate_each/node_iterate_each.gml b/scripts/node_iterate_each/node_iterate_each.gml index 874021a63..99061d196 100644 --- a/scripts/node_iterate_each/node_iterate_each.gml +++ b/scripts/node_iterate_each/node_iterate_each.gml @@ -3,8 +3,9 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou color = COLORS.node_blend_loop; icon = THEME.loop; - reset_all_child = true; + reset_all_child = true; combine_render_time = false; + managedRenderOrder = true; iterated = 0; inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] ) diff --git a/scripts/node_iterate_filter/node_iterate_filter.gml b/scripts/node_iterate_filter/node_iterate_filter.gml index ea92f0e21..b6a354e6a 100644 --- a/scripts/node_iterate_filter/node_iterate_filter.gml +++ b/scripts/node_iterate_filter/node_iterate_filter.gml @@ -5,8 +5,9 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr color = COLORS.node_blend_loop; icon = THEME.loop; - reset_all_child = true; + reset_all_child = true; combine_render_time = false; + managedRenderOrder = true; iterated = 0; inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] ) diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index c94eae45e..efcc91651 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -3,8 +3,9 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr color = COLORS.node_blend_loop; icon = THEME.loop; - reset_all_child = true; + reset_all_child = true; combine_render_time = false; + managedRenderOrder = true; inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] ) .setVisible(true, true); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index b6b2a904f..a378c2cb3 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -18,8 +18,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct process_length = []; dimension_index = 0; - manage_atlas = true; - atlas_index = 0; + manage_atlas = true; + atlas_index = 0; batch_output = false; //Run processData once with all outputs as array. diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index d975def57..cf8047737 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -557,6 +557,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio addNodeObject(values, "Array Copy", s_node_array_copy, "Node_Array_Copy", [1, Node_Array_Copy]).setVersion(1144); addNodeObject(values, "Array Convolute",s_node_array_convolute, "Node_Array_Convolute", [1, Node_Array_Convolute]).setVersion(11540); addNodeObject(values, "Array Composite",s_node_array_composite, "Node_Array_Composite", [1, Node_Array_Composite]).setVersion(11540); + addNodeObject(values, "Array Sample", s_node_array_sample, "Node_Array_Sample", [1, Node_Array_Sample]).setVersion(11540); addNodeObject(values, "Sort Number", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).setVersion(1120); addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).setVersion(1120); addNodeObject(values, "Loop Array", s_node_loop_array, "Node_Iterate_Each", [1, Node_Iterate_Each], ["iterate each", "for each", "array loop"], "Create group that iterate to each member in an array."); diff --git a/scripts/node_scale/node_scale.gml b/scripts/node_scale/node_scale.gml index 51296174f..905d4582c 100644 --- a/scripts/node_scale/node_scale.gml +++ b/scripts/node_scale/node_scale.gml @@ -2,6 +2,8 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con name = "Scale"; dimension_index = -1; + manage_atlas = false; + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) @@ -16,44 +18,75 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 4; + inputs[| 5] = nodeValue("Scale atlas position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 4, ["Output", true], 0, - ["Scale", false], 2, 1, 3, + ["Scale", false], 2, 1, 3, 5, ]; attribute_surface_depth(); attribute_interpolation(); + static step = function() { + var _surf = getSingleValue(0); + + var _atlas = is_instanceof(_surf, SurfaceAtlas); + inputs[| 5].setVisible(_atlas); + } + static processData = function(_outSurf, _data, _output_index, _array_index) { var scale = _data[1]; var mode = _data[2]; var targ = _data[3]; + var _atlS = _data[5]; var cDep = attrDepth(); inputs[| 1].setVisible(mode == 0); inputs[| 3].setVisible(mode == 1); - var ww, hh; + var isAtlas = is_instanceof(_data[0], SurfaceAtlas); + if(isAtlas && !is_instanceof(_outSurf, SurfaceAtlas)) + _outSurf = _data[0].clone(true); + var _surf = isAtlas? _outSurf.getSurface() : _outSurf; + + var ww, hh, scx = 1, scy = 1; switch(mode) { case 0 : + scx = scale; + scy = scale; ww = scale * surface_get_width_safe(_data[0]); hh = scale * surface_get_height_safe(_data[0]); break; - case 1 : + case 1 : + scx = targ[0] / surface_get_width_safe(_data[0]); + scy = targ[1] / surface_get_height_safe(_data[0]); ww = targ[0]; hh = targ[1]; break; } - _outSurf = surface_verify(_outSurf, ww, hh, cDep); + _surf = surface_verify(_surf, ww, hh, cDep); - surface_set_shader(_outSurf); + surface_set_shader(_surf); shader_set_interpolation(_data[0]); draw_surface_stretched_safe(_data[0], 0, 0, ww, hh); surface_reset_shader(); + if(isAtlas) { + if(_atlS) { + _outSurf.x = _data[0].x * scx; + _outSurf.y = _data[0].y * scy; + } else { + _outSurf.x = _data[0].x; + _outSurf.y = _data[0].y; + } + + _outSurf.setSurface(_surf); + } + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_scale_algo/node_scale_algo.gml b/scripts/node_scale_algo/node_scale_algo.gml index ef1edeb0e..cfe36ddb2 100644 --- a/scripts/node_scale_algo/node_scale_algo.gml +++ b/scripts/node_scale_algo/node_scale_algo.gml @@ -13,6 +13,8 @@ function Node_create_Scale_Algo(_x, _y, _group = noone, _param = {}) { function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Scale Algorithm"; + manage_atlas = false; + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) @@ -24,24 +26,39 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 3; + inputs[| 4] = nodeValue("Scale atlas position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 3, ["Output", false], 0, - ["Scale", false], 1, 2, + ["Scale", false], 1, 2, 4, ] attribute_surface_depth(); + static step = function() { + var _surf = getSingleValue(0); + + var _atlas = is_instanceof(_surf, SurfaceAtlas); + inputs[| 4].setVisible(_atlas); + } + static processData = function(_outSurf, _data, _output_index, _array_index) { var inSurf = _data[0]; var algo = _data[1]; + var _atlS = _data[4]; var ww = surface_get_width_safe(inSurf); var hh = surface_get_height_safe(inSurf); var cDep = attrDepth(); var shader; var sc = 2; + var isAtlas = is_instanceof(_data[0], SurfaceAtlas); + if(isAtlas && !is_instanceof(_outSurf, SurfaceAtlas)) + _outSurf = _data[0].clone(true); + var _surf = isAtlas? _outSurf.getSurface() : _outSurf; + switch(algo) { case 0 : shader = sh_scale2x; @@ -49,7 +66,7 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group var sw = ww * 2; var sh = hh * 2; - _outSurf = surface_verify(_outSurf, sw, sh, cDep); + _surf = surface_verify(_surf, sw, sh, cDep); break; case 1 : shader = sh_scale3x; @@ -57,12 +74,11 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group var sw = ww * 3; var sh = hh * 3; - _outSurf = surface_verify(_outSurf, sw, sh, cDep); + _surf = surface_verify(_surf, sw, sh, cDep); break; - default: return _outSurf; } - surface_set_target(_outSurf); + surface_set_target(_surf); DRAW_CLEAR BLEND_OVERRIDE; @@ -78,6 +94,18 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group BLEND_NORMAL; surface_reset_target(); + if(isAtlas) { + if(_atlS) { + _outSurf.x = _data[0].x * sc; + _outSurf.y = _data[0].y * sc; + } else { + _outSurf.x = _data[0].x; + _outSurf.y = _data[0].y; + } + + _outSurf.setSurface(_surf); + } + return _outSurf; } } \ No newline at end of file diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index e406d6ac5..a6432a5e8 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -42,21 +42,10 @@ function __nodeLeafList(_list) { #region return nodes; } #endregion -function __nodeIsLoop(_node) { #region - switch(instanceof(_node)) { - case "Node_Iterate" : - case "Node_Iterate_Each" : - case "Node_Iterate_Filter" : - case "Node_Iterate_Sort" : - return true; - } - return false; -} #endregion - -function __nodeInLoop(_node) { #region +function __nodeManualManaged(_node) { #region var gr = _node.group; while(gr != noone) { - if(__nodeIsLoop(gr)) return true; + if(gr.managedRenderOrder) return true; gr = gr.group; } return false; @@ -194,7 +183,7 @@ function Render(partial = false, runAction = false) { #region if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive [{_node.internalName}]"); continue; } if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive [{_node.internalName}]"); continue; } if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update [{_node.internalName}]"); continue; } - if(__nodeInLoop(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop [{_node.internalName}]"); continue; } + if(__nodeManualManaged(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop [{_node.internalName}]"); continue; } if(_node.passiveDynamic) { _node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); continue; } @@ -305,7 +294,7 @@ function RenderList(list, skipInLoop = true) { #region if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; } if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; } - if(skipInLoop && __nodeInLoop(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop {_node.internalName}"); continue; } + if(skipInLoop && __nodeManualManaged(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop {_node.internalName}"); continue; } if(_node.passiveDynamic) { _node.forwardPassiveDynamic(); diff --git a/sprites/s_node_array_sample/f22a7ff8-3119-4af6-871a-90c7358e6a54.png b/sprites/s_node_array_sample/f22a7ff8-3119-4af6-871a-90c7358e6a54.png new file mode 100644 index 0000000000000000000000000000000000000000..8f64ef7b2cc008248aba7c71eb6f07776d7daf06 GIT binary patch literal 1039 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=3dtTpz6=aiY77hwEes65fI|H*Yfq|LH)5S5Q;?~=l@gBj6 z636EMEj)MQL53OkG;Swh!#NzT5qTT$mMcyRe|@O2T!`atSovL!h2c$cPo|2-mAuc` zyu@BXSIAH`!^~s)PG;$M{e7i{W-qOyH`LDi$n|^P>GJ2*`|p1)u=sthy5wh#+*ci2 zQ--ZB3|APg2r&jQ2Y9nM@H*%UGT;(?Wyg?w^VRL}?-RUw6w0r}6fQ3oFE4odi$5az zlBufSo7o@VK34tnuX5ibQ?_Io-)pRQr0N#_^E`fr#hIJ`!|UJ5N4BZzSp*ATc+NOS zZo$W%ZO4q+9V{4X_!w@A#Pdh*?%|$3|A6VIH6{&9e@3oZ-;>33JBz(dZ40+zF@ugD zQ*~hOuTuUq2VZ|?KAPSz?HMC$NnsG9eeN^HgxXXQ@6VeV7M$K6y{B{i!qk+@R?ika z+a?nAcD`2Dj47%|w(Xu^os;s)kKdreoJHY8=c{9%yu}YOZp+Fzap2lM#%`7HE2;Wb zydUqXElV?cUU=0s!=)yD*O5Q=+dYoXlA6rrR^6Zdkm17fzYN)@ll6Xg{$0+&9<%C| z_!GXn5_J(Xe=fRGUTL=0xh6fTKVnJy&JBz0L$+2jNX(zexFa#+#D*RDyLOzJ9=-ZY znfSL=esS~VW&bKJ6YKu+V&asW`<+(4wKMKZbo*cf=M;YcDa}+g~)t&+4p zy(@mlyX=^Xi}_rivsGcw-Yt)lzFQ)8&+6xrZ)p?zzHG3(HsjH?RjVy@R@|}?(3#2k z<=(vqY+>s|tJrrsMa-Ii^qSW1tlZ)?SN}S=%;e0n6=L2poBLXl3Y!dn?UeQf*Ppw8 zKX7NIF~5dwo7$9lQnT5QM8t?X1eX3zT*9a7*FlOg@FnGH9xvX|H*Yfq|LH)5S5Q;?~=l@gBj6 z636EMEj)MQL53OkG;Swh!#NzT5qTT$mMcyRe|@O2T!`atSovL!h2c$cPo|2-mAuc` zyu@BXSIAH`!^~s)PG;$M{e7i{W-qOyH`LDi$n|^P>GJ2*`|p1)u=sthy5wh#+*ci2 zQ--ZB3|APg2r&jQ2Y9nM@H*%UGT;(?Wyg?w^VRL}?-RUw6w0r}6fQ3oFE4odi$5az zlBufSo7o@VK34tnuX5ibQ?_Io-)pRQr0N#_^E`fr#hIJ`!|UJ5N4BZzSp*ATc+NOS zZo$W%ZO4q+9V{4X_!w@A#Pdh*?%|$3|A6VIH6{&9e@3oZ-;>33JBz(dZ40+zF@ugD zQ*~hOuTuUq2VZ|?KAPSz?HMC$NnsG9eeN^HgxXXQ@6VeV7M$K6y{B{i!qk+@R?ika z+a?nAcD`2Dj47%|w(Xu^os;s)kKdreoJHY8=c{9%yu}YOZp+Fzap2lM#%`7HE2;Wb zydUqXElV?cUU=0s!=)yD*O5Q=+dYoXlA6rrR^6Zdkm17fzYN)@ll6Xg{$0+&9<%C| z_!GXn5_J(Xe=fRGUTL=0xh6fTKVnJy&JBz0L$+2jNX(zexFa#+#D*RDyLOzJ9=-ZY znfSL=esS~VW&bKJ6YKu+V&asW`<+(4wKMKZbo*cf=M;YcDa}+g~)t&+4p zy(@mlyX=^Xi}_rivsGcw-Yt)lzFQ)8&+6xrZ)p?zzHG3(HsjH?RjVy@R@|}?(3#2k z<=(vqY+>s|tJrrsMa-Ii^qSW1tlZ)?SN}S=%;e0n6=L2poBLXl3Y!dn?UeQf*Ppw8 zKX7NIF~5dwo7$9lQnT5QM8t?X1eX3zT*9a7*FlOg@FnGH9xvX","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":"f22a7ff8-3119-4af6-871a-90c7358e6a54","path":"sprites/s_node_array_sample/s_node_array_sample.yy",},},},"Disabled":false,"id":"9ae01996-6189-4bab-8461-bcbe384f6007","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