mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
VFX stuffs and array sample node.
This commit is contained in:
parent
73ebadbfaa
commit
8c49699416
34 changed files with 417 additions and 149 deletions
|
@ -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",},
|
||||
|
|
|
@ -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",},},
|
||||
|
|
|
@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
enum FORCE_TYPE {
|
||||
Wind,
|
||||
Accelerate,
|
||||
Attract,
|
||||
Repel,
|
||||
Vortex,
|
||||
Turbulence,
|
||||
Destroy
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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; }
|
||||
|
|
54
scripts/node_array_sample/node_array_sample.gml
Normal file
54
scripts/node_array_sample/node_array_sample.gml
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
},
|
||||
}
|
12
scripts/node_array_sample/node_counter.yy
Normal file
12
scripts/node_array_sample/node_counter.yy
Normal file
|
@ -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",
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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, [] )
|
||||
|
|
|
@ -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, [] )
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
74
sprites/s_node_array_sample/s_node_array_sample.yy
Normal file
74
sprites/s_node_array_sample/s_node_array_sample.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_array_sample",
|
||||
"bbox_bottom": 44,
|
||||
"bbox_left": 0,
|
||||
"bbox_right": 63,
|
||||
"bbox_top": 19,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"f22a7ff8-3119-4af6-871a-90c7358e6a54",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"cbc68d05-16a3-4e98-8366-d7a9375c5236","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "array",
|
||||
"path": "folders/nodes/icons/value/array.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_array_sample",
|
||||
"autoRecord": true,
|
||||
"backdropHeight": 768,
|
||||
"backdropImageOpacity": 0.5,
|
||||
"backdropImagePath": "",
|
||||
"backdropWidth": 1366,
|
||||
"backdropXOffset": 0.0,
|
||||
"backdropYOffset": 0.0,
|
||||
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
|
||||
"eventStubScript": null,
|
||||
"eventToFunction": {},
|
||||
"length": 1.0,
|
||||
"lockOrigin": false,
|
||||
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","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<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
|
||||
{"resourceType":"Keyframe<SpriteFrameKeyframe>","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,
|
||||
}
|
Loading…
Reference in a new issue