- [Path Builder] Remove connected property. Now use nested vec2 array to define disconnected paths.

This commit is contained in:
MakhamDev 2023-10-28 20:28:47 +07:00
parent a4035b52bf
commit 900c1dea19
11 changed files with 231 additions and 109 deletions

View file

@ -127,7 +127,7 @@
{"name":"fluidSim","order":2,"path":"folders/nodes/data/simulation/fluidSim.yy",}, {"name":"fluidSim","order":2,"path":"folders/nodes/data/simulation/fluidSim.yy",},
{"name":"strandSim","order":1,"path":"folders/nodes/data/simulation/strandSim.yy",}, {"name":"strandSim","order":1,"path":"folders/nodes/data/simulation/strandSim.yy",},
{"name":"VFX","order":3,"path":"folders/nodes/data/simulation/VFX.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":"effector","order":9,"path":"folders/nodes/data/simulation/VFX/effector.yy",},
{"name":"transform","order":8,"path":"folders/nodes/data/transform.yy",}, {"name":"transform","order":8,"path":"folders/nodes/data/transform.yy",},
{"name":"value","order":4,"path":"folders/nodes/data/value.yy",}, {"name":"value","order":4,"path":"folders/nodes/data/value.yy",},
{"name":"array","order":1,"path":"folders/nodes/data/value/array.yy",}, {"name":"array","order":1,"path":"folders/nodes/data/value/array.yy",},
@ -472,7 +472,7 @@
{"name":"o_dialog_release_note","order":8,"path":"objects/o_dialog_release_note/o_dialog_release_note.yy",}, {"name":"o_dialog_release_note","order":8,"path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},
{"name":"sh_fd_advect_material_rgba_16_glsl","order":4,"path":"shaders/sh_fd_advect_material_rgba_16_glsl/sh_fd_advect_material_rgba_16_glsl.yy",}, {"name":"sh_fd_advect_material_rgba_16_glsl","order":4,"path":"shaders/sh_fd_advect_material_rgba_16_glsl/sh_fd_advect_material_rgba_16_glsl.yy",},
{"name":"node_padding","order":9,"path":"scripts/node_padding/node_padding.yy",}, {"name":"node_padding","order":9,"path":"scripts/node_padding/node_padding.yy",},
{"name":"node_VFX_group","order":4,"path":"scripts/node_VFX_group/node_VFX_group.yy",}, {"name":"node_VFX_group","order":3,"path":"scripts/node_VFX_group/node_VFX_group.yy",},
{"name":"libborderless","order":1,"path":"extensions/libborderless/libborderless.yy",}, {"name":"libborderless","order":1,"path":"extensions/libborderless/libborderless.yy",},
{"name":"node_dynamic_surface_in","order":4,"path":"scripts/node_dynamic_surface_in/node_dynamic_surface_in.yy",}, {"name":"node_dynamic_surface_in","order":4,"path":"scripts/node_dynamic_surface_in/node_dynamic_surface_in.yy",},
{"name":"s_node_vfx_attract","order":8,"path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",}, {"name":"s_node_vfx_attract","order":8,"path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",},
@ -488,7 +488,7 @@
{"name":"s_node_switch","order":20,"path":"sprites/s_node_switch/s_node_switch.yy",}, {"name":"s_node_switch","order":20,"path":"sprites/s_node_switch/s_node_switch.yy",},
{"name":"s_node_pb_draw_blob","order":16,"path":"sprites/s_node_pb_draw_blob/s_node_pb_draw_blob.yy",}, {"name":"s_node_pb_draw_blob","order":16,"path":"sprites/s_node_pb_draw_blob/s_node_pb_draw_blob.yy",},
{"name":"s_node_crop","order":2,"path":"sprites/s_node_crop/s_node_crop.yy",}, {"name":"s_node_crop","order":2,"path":"sprites/s_node_crop/s_node_crop.yy",},
{"name":"__VFX","order":2,"path":"scripts/__VFX/__VFX.yy",}, {"name":"__VFX","order":1,"path":"scripts/__VFX/__VFX.yy",},
{"name":"s_menu_black","order":2,"path":"sprites/s_menu_black/s_menu_black.yy",}, {"name":"s_menu_black","order":2,"path":"sprites/s_menu_black/s_menu_black.yy",},
{"name":"__node_3d_export","order":2,"path":"scripts/__node_3d_export/__node_3d_export.yy",}, {"name":"__node_3d_export","order":2,"path":"scripts/__node_3d_export/__node_3d_export.yy",},
{"name":"s_node_vfx_override","order":11,"path":"sprites/s_node_vfx_override/s_node_vfx_override.yy",}, {"name":"s_node_vfx_override","order":11,"path":"sprites/s_node_vfx_override/s_node_vfx_override.yy",},
@ -524,7 +524,7 @@
{"name":"s_node_strandSim_length","order":9,"path":"sprites/s_node_strandSim_length/s_node_strandSim_length.yy",}, {"name":"s_node_strandSim_length","order":9,"path":"sprites/s_node_strandSim_length/s_node_strandSim_length.yy",},
{"name":"node_pb_fx_substract","order":4,"path":"scripts/node_pb_fx_substract/node_pb_fx_substract.yy",}, {"name":"node_pb_fx_substract","order":4,"path":"scripts/node_pb_fx_substract/node_pb_fx_substract.yy",},
{"name":"node_pb_fx_radial","order":9,"path":"scripts/node_pb_fx_radial/node_pb_fx_radial.yy",}, {"name":"node_pb_fx_radial","order":9,"path":"scripts/node_pb_fx_radial/node_pb_fx_radial.yy",},
{"name":"node_VFX_variable","order":15,"path":"scripts/node_VFX_variable/node_VFX_variable.yy",}, {"name":"node_VFX_variable","order":6,"path":"scripts/node_VFX_variable/node_VFX_variable.yy",},
{"name":"node_array_sort","order":11,"path":"scripts/node_array_sort/node_array_sort.yy",}, {"name":"node_array_sort","order":11,"path":"scripts/node_array_sort/node_array_sort.yy",},
{"name":"sh_pb_outline","order":2,"path":"shaders/sh_pb_outline/sh_pb_outline.yy",}, {"name":"sh_pb_outline","order":2,"path":"shaders/sh_pb_outline/sh_pb_outline.yy",},
{"name":"fd_draw_surface_to_collision_mask_surface","order":2,"path":"scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.yy",}, {"name":"fd_draw_surface_to_collision_mask_surface","order":2,"path":"scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.yy",},
@ -590,7 +590,7 @@
{"name":"sh_blur_zoom","order":5,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",}, {"name":"sh_blur_zoom","order":5,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",},
{"name":"node_isosurf","order":4,"path":"scripts/node_isosurf/node_isosurf.yy",}, {"name":"node_isosurf","order":4,"path":"scripts/node_isosurf/node_isosurf.yy",},
{"name":"__add_node_item","order":13,"path":"scripts/__add_node_item/__add_node_item.yy",}, {"name":"__add_node_item","order":13,"path":"scripts/__add_node_item/__add_node_item.yy",},
{"name":"node_VFX_renderer","order":3,"path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",}, {"name":"node_VFX_renderer","order":2,"path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",},
{"name":"s_node_pb_fx_stack","order":2,"path":"sprites/s_node_pb_fx_stack/s_node_pb_fx_stack.yy",}, {"name":"s_node_pb_fx_stack","order":2,"path":"sprites/s_node_pb_fx_stack/s_node_pb_fx_stack.yy",},
{"name":"fd_draw_sprite_to_collision_mask_surface","order":1,"path":"scripts/fd_draw_sprite_to_collision_mask_surface/fd_draw_sprite_to_collision_mask_surface.yy",}, {"name":"fd_draw_sprite_to_collision_mask_surface","order":1,"path":"scripts/fd_draw_sprite_to_collision_mask_surface/fd_draw_sprite_to_collision_mask_surface.yy",},
{"name":"node_fluid_render","order":2,"path":"scripts/node_fluid_render/node_fluid_render.yy",}, {"name":"node_fluid_render","order":2,"path":"scripts/node_fluid_render/node_fluid_render.yy",},
@ -632,6 +632,7 @@
{"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",}, {"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",},
{"name":"o_dialog_lua_reference","order":5,"path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",}, {"name":"o_dialog_lua_reference","order":5,"path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},
{"name":"__node_custom","order":14,"path":"scripts/__node_custom/__node_custom.yy",}, {"name":"__node_custom","order":14,"path":"scripts/__node_custom/__node_custom.yy",},
{"name":"node_VFX_trail_path","order":10,"path":"scripts/node_VFX_trail_path/node_VFX_trail_path.yy",},
{"name":"s_node_note","order":35,"path":"sprites/s_node_note/s_node_note.yy",}, {"name":"s_node_note","order":35,"path":"sprites/s_node_note/s_node_note.yy",},
{"name":"node_strand_gravity","order":4,"path":"scripts/node_strand_gravity/node_strand_gravity.yy",}, {"name":"node_strand_gravity","order":4,"path":"scripts/node_strand_gravity/node_strand_gravity.yy",},
{"name":"palette_functions","order":3,"path":"scripts/palette_functions/palette_functions.yy",}, {"name":"palette_functions","order":3,"path":"scripts/palette_functions/palette_functions.yy",},
@ -860,7 +861,6 @@
{"name":"s_node_blur_simple","order":43,"path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",}, {"name":"s_node_blur_simple","order":43,"path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",},
{"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",}, {"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",},
{"name":"project_data","order":17,"path":"scripts/project_data/project_data.yy",}, {"name":"project_data","order":17,"path":"scripts/project_data/project_data.yy",},
{"name":"node_VFX_spawner","order":1,"path":"scripts/node_VFX_spawner/node_VFX_spawner.yy",},
{"name":"_draw_defines","order":21,"path":"scripts/_draw_defines/_draw_defines.yy",}, {"name":"_draw_defines","order":21,"path":"scripts/_draw_defines/_draw_defines.yy",},
{"name":"sh_color_replace","order":8,"path":"shaders/sh_color_replace/sh_color_replace.yy",}, {"name":"sh_color_replace","order":8,"path":"shaders/sh_color_replace/sh_color_replace.yy",},
{"name":"s_node_3d_meterial","order":12,"path":"sprites/s_node_3d_meterial/s_node_3d_meterial.yy",}, {"name":"s_node_3d_meterial","order":12,"path":"sprites/s_node_3d_meterial/s_node_3d_meterial.yy",},
@ -892,7 +892,7 @@
{"name":"sh_shape","order":3,"path":"shaders/sh_shape/sh_shape.yy",}, {"name":"sh_shape","order":3,"path":"shaders/sh_shape/sh_shape.yy",},
{"name":"draw_line_width2","order":2,"path":"scripts/draw_line_width2/draw_line_width2.yy",}, {"name":"draw_line_width2","order":2,"path":"scripts/draw_line_width2/draw_line_width2.yy",},
{"name":"matrixGrid","order":23,"path":"scripts/matrixGrid/matrixGrid.yy",}, {"name":"matrixGrid","order":23,"path":"scripts/matrixGrid/matrixGrid.yy",},
{"name":"node_VFX_override","order":16,"path":"scripts/node_VFX_override/node_VFX_override.yy",}, {"name":"node_VFX_override","order":7,"path":"scripts/node_VFX_override/node_VFX_override.yy",},
{"name":"fd_README","order":6,"path":"scripts/fd_README/fd_README.yy",}, {"name":"fd_README","order":6,"path":"scripts/fd_README/fd_README.yy",},
{"name":"ase_object","order":7,"path":"scripts/ase_object/ase_object.yy",}, {"name":"ase_object","order":7,"path":"scripts/ase_object/ase_object.yy",},
{"name":"node_rigid_object","order":1,"path":"scripts/node_rigid_object/node_rigid_object.yy",}, {"name":"node_rigid_object","order":1,"path":"scripts/node_rigid_object/node_rigid_object.yy",},
@ -907,7 +907,7 @@
{"name":"o_dialog_preset","order":1,"path":"objects/o_dialog_preset/o_dialog_preset.yy",}, {"name":"o_dialog_preset","order":1,"path":"objects/o_dialog_preset/o_dialog_preset.yy",},
{"name":"s_node_mesh_transform","order":1,"path":"sprites/s_node_mesh_transform/s_node_mesh_transform.yy",}, {"name":"s_node_mesh_transform","order":1,"path":"sprites/s_node_mesh_transform/s_node_mesh_transform.yy",},
{"name":"s_node_erode","order":23,"path":"sprites/s_node_erode/s_node_erode.yy",}, {"name":"s_node_erode","order":23,"path":"sprites/s_node_erode/s_node_erode.yy",},
{"name":"node_particle","order":14,"path":"scripts/node_particle/node_particle.yy",}, {"name":"node_particle","order":5,"path":"scripts/node_particle/node_particle.yy",},
{"name":"node_pb_box_contract","order":8,"path":"scripts/node_pb_box_contract/node_pb_box_contract.yy",}, {"name":"node_pb_box_contract","order":8,"path":"scripts/node_pb_box_contract/node_pb_box_contract.yy",},
{"name":"ac_ripple","order":1,"path":"animcurves/ac_ripple/ac_ripple.yy",}, {"name":"ac_ripple","order":1,"path":"animcurves/ac_ripple/ac_ripple.yy",},
{"name":"histogram_drawer","order":2,"path":"scripts/histogram_drawer/histogram_drawer.yy",}, {"name":"histogram_drawer","order":2,"path":"scripts/histogram_drawer/histogram_drawer.yy",},
@ -998,7 +998,7 @@
{"name":"sh_blend_replace","order":50,"path":"shaders/sh_blend_replace/sh_blend_replace.yy",}, {"name":"sh_blend_replace","order":50,"path":"shaders/sh_blend_replace/sh_blend_replace.yy",},
{"name":"node_rigid_render","order":3,"path":"scripts/node_rigid_render/node_rigid_render.yy",}, {"name":"node_rigid_render","order":3,"path":"scripts/node_rigid_render/node_rigid_render.yy",},
{"name":"node_image_splice_sheet","order":4,"path":"scripts/node_image_splice_sheet/node_image_splice_sheet.yy",}, {"name":"node_image_splice_sheet","order":4,"path":"scripts/node_image_splice_sheet/node_image_splice_sheet.yy",},
{"name":"node_VFX_renderer_output","order":17,"path":"scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy",}, {"name":"node_VFX_renderer_output","order":8,"path":"scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy",},
{"name":"sh_posterize_palette","order":12,"path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",}, {"name":"sh_posterize_palette","order":12,"path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",},
{"name":"fd_rectangle_set_material_maccormack_weight","order":6,"path":"scripts/fd_rectangle_set_material_maccormack_weight/fd_rectangle_set_material_maccormack_weight.yy",}, {"name":"fd_rectangle_set_material_maccormack_weight","order":6,"path":"scripts/fd_rectangle_set_material_maccormack_weight/fd_rectangle_set_material_maccormack_weight.yy",},
{"name":"collection_data","order":9,"path":"scripts/collection_data/collection_data.yy",}, {"name":"collection_data","order":9,"path":"scripts/collection_data/collection_data.yy",},
@ -1417,7 +1417,7 @@
{"name":"node_3d_modify_round","order":1,"path":"scripts/node_3d_modify_round/node_3d_modify_round.yy",}, {"name":"node_3d_modify_round","order":1,"path":"scripts/node_3d_modify_round/node_3d_modify_round.yy",},
{"name":"s_node_array_add","order":1,"path":"sprites/s_node_array_add/s_node_array_add.yy",}, {"name":"s_node_array_add","order":1,"path":"sprites/s_node_array_add/s_node_array_add.yy",},
{"name":"s_node_image_sequence_to_anim","order":6,"path":"sprites/s_node_image_sequence_to_anim/s_node_image_sequence_to_anim.yy",}, {"name":"s_node_image_sequence_to_anim","order":6,"path":"sprites/s_node_image_sequence_to_anim/s_node_image_sequence_to_anim.yy",},
{"name":"_node_VFX_spawner","order":13,"path":"scripts/_node_VFX_spawner/_node_VFX_spawner.yy",}, {"name":"_node_VFX_spawner","order":4,"path":"scripts/_node_VFX_spawner/_node_VFX_spawner.yy",},
{"name":"s_node_bar_graph","order":27,"path":"sprites/s_node_bar_graph/s_node_bar_graph.yy",}, {"name":"s_node_bar_graph","order":27,"path":"sprites/s_node_bar_graph/s_node_bar_graph.yy",},
{"name":"sh_channel_B_grey","order":9,"path":"shaders/sh_channel_B_grey/sh_channel_B_grey.yy",}, {"name":"sh_channel_B_grey","order":9,"path":"shaders/sh_channel_B_grey/sh_channel_B_grey.yy",},
{"name":"s_node_pb_fx_hash","order":8,"path":"sprites/s_node_pb_fx_hash/s_node_pb_fx_hash.yy",}, {"name":"s_node_pb_fx_hash","order":8,"path":"sprites/s_node_pb_fx_hash/s_node_pb_fx_hash.yy",},

View file

@ -1242,6 +1242,7 @@
{"id":{"name":"node_PCX_fn_math","path":"scripts/node_PCX_fn_math/node_PCX_fn_math.yy",},}, {"id":{"name":"node_PCX_fn_math","path":"scripts/node_PCX_fn_math/node_PCX_fn_math.yy",},},
{"id":{"name":"o_dialog_lua_reference","path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},}, {"id":{"name":"o_dialog_lua_reference","path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},},
{"id":{"name":"__node_custom","path":"scripts/__node_custom/__node_custom.yy",},}, {"id":{"name":"__node_custom","path":"scripts/__node_custom/__node_custom.yy",},},
{"id":{"name":"node_VFX_trail_path","path":"scripts/node_VFX_trail_path/node_VFX_trail_path.yy",},},
{"id":{"name":"node_surface_data","path":"scripts/node_surface_data/node_surface_data.yy",},}, {"id":{"name":"node_surface_data","path":"scripts/node_surface_data/node_surface_data.yy",},},
{"id":{"name":"s_node_note","path":"sprites/s_node_note/s_node_note.yy",},}, {"id":{"name":"s_node_note","path":"sprites/s_node_note/s_node_note.yy",},},
{"id":{"name":"node_strand_gravity","path":"scripts/node_strand_gravity/node_strand_gravity.yy",},}, {"id":{"name":"node_strand_gravity","path":"scripts/node_strand_gravity/node_strand_gravity.yy",},},

View file

@ -24,6 +24,9 @@ function __part(_node) constructor {
turning = 0; turning = 0;
turnSpd = 0; turnSpd = 0;
x_history = [];
y_history = [];
drawx = 0; drawx = 0;
drawy = 0; drawy = 0;
drawrot = 0; drawrot = 0;
@ -56,6 +59,7 @@ function __part(_node) constructor {
life = 0; life = 0;
life_total = 0; life_total = 0;
life_incr = 0;
step_int = 0; step_int = 0;
anim_speed = 1; anim_speed = 1;
@ -85,9 +89,13 @@ function __part(_node) constructor {
x = _x; x = _x;
y = _y; y = _y;
life_incr = 0;
life = _life; life = _life;
life_total = life; life_total = life;
if(node.onPartCreate != noone) node.onPartCreate(self); if(node.onPartCreate != noone) node.onPartCreate(self);
x_history = array_create(life);
y_history = array_create(life);
} #endregion } #endregion
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) { #region static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) { #region
@ -197,6 +205,11 @@ function __part(_node) constructor {
if(node.onPartStep != noone && step_int > 0 && safe_mod(life, step_int) == 0) if(node.onPartStep != noone && step_int > 0 && safe_mod(life, step_int) == 0)
node.onPartStep(self); node.onPartStep(self);
x_history[life_incr] = x;
y_history[life_incr] = y;
life_incr++;
if(life-- < 0) kill(); if(life-- < 0) kill();
if(prevx != undefined) { if(prevx != undefined) {

View file

@ -226,7 +226,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m); var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m);
widH = wd_h - (TEXTBOX_HEIGHT * !breakLine); widH = wd_h - (TEXTBOX_HEIGHT * !breakLine);
#endregion #endregion
} else if(jun.editWidget) { #region edit widget } else if(jun.editWidget && jun.display_type != VALUE_DISPLAY.none) { #region edit widget
jun.editWidget.setFocusHover(_focus, _hover); jun.editWidget.setFocusHover(_focus, _hover);
if(jun.connect_type == JUNCTION_CONNECT.input) { if(jun.connect_type == JUNCTION_CONNECT.input) {

View file

@ -21,10 +21,12 @@ function Node_3D_Particle(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _gr
for( var i = 0; i < part_pool_size; i++ ) for( var i = 0; i < part_pool_size; i++ )
parts[i].reset(_sed++); parts[i].reset(_sed++);
} else {
for( var i = 0; i < part_pool_size; i++ ) return;
parts[i].step();
} }
for( var i = 0; i < part_pool_size; i++ )
parts[i].step();
} }
static processData = function(_output, _data, _output_index, _array_index = 0) { static processData = function(_output, _data, _output_index, _array_index = 0) {

View file

@ -0,0 +1,121 @@
function Node_VXF_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Trail Path";
previewable = false;
w = 96;
length = [];
lengthAcc = [];
lines = [];
inputs[| 0] = nodeValue("Point array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
.setVisible(true, true)
.setArrayDepth(2);
outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
draw_set_color(COLORS._main_accent);
for( var i = 0, n = array_length(lines); i < n; i++ ) {
var _line = lines[i];
for( var j = 1, m = array_length(_line); j < m; j++ ) {
var p0 = _line[j - 1];
var p1 = _line[j - 0];
draw_line(_x + p0[0] * _s, _y + p0[1] * _s,
_x + p1[0] * _s, _y + p1[1] * _s);
}
}
} #endregion
static getLineCount = function() { return array_length(lines); }
static getSegmentCount = function() { return array_length(lines); }
static getLength = function(index) { return array_safe_get(length, index); }
static getAccuLength = function(index) { return array_safe_get(lengthAcc, index, []); }
static getPointRatio = function(_rat, _ind = 0) { #region
var _p0, _p1;
var _x, _y;
var line = array_safe_get(lines, _ind, []);
var _st = _rat * (array_length(line) - 1);
_p0 = array_safe_get(line, floor(_st) + 0);
_p1 = array_safe_get(line, floor(_st) + 1);
if(!is_array(_p0)) return new __vec2();
if(!is_array(_p1)) return new __vec2();
_x = lerp(_p0[0], _p1[0], frac(_st));
_y = lerp(_p0[1], _p1[1], frac(_st));
return new __vec2( _x, _y );
} #endregion
static getPointDistance = function(_dist, ind = 0) { return getPointRatio(_dist / length[ind], ind); }
static getBoundary = function() { #region
var boundary = new BoundingBox();
for( var i = 0, n = array_length(lines); i < n; i++ ) {
var _line = lines[i];
for( var j = 0, m = array_length(_line); j < m; j++ )
boundary.addPoint(_line[j][0], _line[j][1]);
}
return boundary;
} #endregion
static update = function() { #region
var _lines = getInputData(0);
if(array_empty(_lines)) return;
lines = _lines;
if(!is_array(_lines[0][0]))
lines = [ lines ];
var _len = array_length(lines);
length = array_create(_len);
lengthAcc = array_create(_len);
for( var i = 0; i < _len; i++ ) {
var _line = lines[i];
var _lngh = 0;
var _lenA = [];
var _ox = _line[0], _nx;
for( var j = 1, m = array_length(_line); j < m; j++ ) {
_nx = _line[j];
var p0x = array_safe_get(_ox, 0);
var p0y = array_safe_get(_ox, 1);
var p1x = array_safe_get(_nx, 0);
var p1y = array_safe_get(_nx, 1);
p0x = is_real(p0x)? p0x : 0;
p0y = is_real(p0y)? p0y : 0;
p1x = is_real(p1x)? p1x : 0;
p1y = is_real(p1y)? p1y : 0;
var dist = point_distance(p0x, p0y, p1x, p1y);
_lngh += dist;
array_push(_lenA, dist);
_ox = _nx;
}
length[i] = _lngh;
lengthAcc[i] = _lenA;
}
outputs[| 0].setValue(self);
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_path_builder, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_VFX_trail_path",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "VFX",
"path": "folders/nodes/data/simulation/VFX.yy",
},
}

View file

@ -15,36 +15,43 @@ function Node_VFX_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) constr
input_display_list = [ 0 ]; input_display_list = [ 0 ];
outputs[| 0] = nodeValue("Positions", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] ) outputs[| 0] = nodeValue("Positions", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] )
.setDisplay(VALUE_DISPLAY.vector) .setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 1] = nodeValue("Scales", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] ) outputs[| 1] = nodeValue("Scales", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] )
.setDisplay(VALUE_DISPLAY.vector) .setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 2] = nodeValue("Rotations", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) outputs[| 2] = nodeValue("Rotations", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 3] = nodeValue("Blending", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, 0 ) outputs[| 3] = nodeValue("Blending", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 4] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) outputs[| 4] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 5] = nodeValue("Life", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) outputs[| 5] = nodeValue("Life", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 6] = nodeValue("Max life", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) outputs[| 6] = nodeValue("Max life", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 7] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ) outputs[| 7] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 8] = nodeValue("Velocity", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] ) outputs[| 8] = nodeValue("Velocity", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [] )
.setDisplay(VALUE_DISPLAY.vector) .setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
outputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) outputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.none)
.setVisible(false); .setVisible(false);
static update = function(frame = CURRENT_FRAME) { static update = function(frame = CURRENT_FRAME) {

View file

@ -3,37 +3,26 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
previewable = false; previewable = false;
w = 96; w = 96;
length = 0; length = [];
lengthAcc = []; lengthAcc = [];
lines = []; lines = [];
connected = false;
inputs[| 0] = nodeValue("Point array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, []) inputs[| 0] = nodeValue("Point array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
.setVisible(true, true) .setVisible(true, true)
.setArrayDepth(2); .setArrayDepth(2);
inputs[| 1] = nodeValue("Connected", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "If set to true, will draw a single path from one point to another. If not set will treat each pair of points as an individual line.");
outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
if(connected) { for( var i = 0, n = array_length(lines); i < n; i++ ) {
for( var i = 1, n = array_length(lines); i < n; i++ ) { var _line = lines[i];
var p0 = lines[i - 1];
var p1 = lines[i - 0];
draw_line(_x + p0[0] * _s, _y + p0[1] * _s, for( var j = 1, m = array_length(_line); j < m; j++ ) {
_x + p1[0] * _s, _y + p1[1] * _s); var p0 = _line[j - 1];
} var p1 = _line[j - 0];
} else {
var len = floor(array_length(lines) / 2) * 2;
for( var i = 0; i < len; i += 2 ) {
var p0 = lines[i + 0];
var p1 = lines[i + 1];
draw_line(_x + p0[0] * _s, _y + p0[1] * _s, draw_line(_x + p0[0] * _s, _y + p0[1] * _s,
_x + p1[0] * _s, _y + p1[1] * _s); _x + p1[0] * _s, _y + p1[1] * _s);
@ -41,108 +30,85 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
} #endregion } #endregion
static getLineCount = function() { #region static getLineCount = function() { return array_length(lines); }
return connected? 1 : floor(array_length(lines) / 2); static getSegmentCount = function() { return array_length(lines); }
} #endregion static getLength = function(index) { return array_safe_get(length, index); }
static getAccuLength = function(index) { return array_safe_get(lengthAcc, index, []); }
static getSegmentCount = function() { #region
return connected? array_length(lines) - 1 : 1;
} #endregion
static getLength = function(index) { return is_array(length)? array_safe_get(length, index) : length; }
static getAccuLength = function(index) { return array_safe_get(lengthAcc, index, []); }
static getPointRatio = function(_rat, _ind = 0) { #region static getPointRatio = function(_rat, _ind = 0) { #region
var _p0, _p1; var _p0, _p1;
var _x, _y; var _x, _y;
if(connected) { var line = array_safe_get(lines, _ind, []);
var _st = _rat * (array_length(lines) - 1);
_p0 = array_safe_get(lines, floor(_st) + 0,, ARRAY_OVERFLOW._default);
_p1 = array_safe_get(lines, floor(_st) + 1,, ARRAY_OVERFLOW._default);
if(!is_array(_p0)) return new __vec2(); var _st = _rat * (array_length(line) - 1);
if(!is_array(_p1)) return new __vec2(); _p0 = array_safe_get(line, floor(_st) + 0);
_p1 = array_safe_get(line, floor(_st) + 1);
_x = lerp(_p0[0], _p1[0], frac(_st)); if(!is_array(_p0)) return new __vec2();
_y = lerp(_p0[1], _p1[1], frac(_st)); if(!is_array(_p1)) return new __vec2();
return new __vec2( _x, _y ); _x = lerp(_p0[0], _p1[0], frac(_st));
} else { _y = lerp(_p0[1], _p1[1], frac(_st));
_p0 = array_safe_get(lines, _ind * 2 + 0,, ARRAY_OVERFLOW._default);
_p1 = array_safe_get(lines, _ind * 2 + 1,, ARRAY_OVERFLOW._default);
if(!is_array(_p0)) return new __vec2(); return new __vec2( _x, _y );
if(!is_array(_p1)) return new __vec2();
_x = lerp(_p0[0], _p1[0], _rat);
_y = lerp(_p0[1], _p1[1], _rat);
return new __vec2( _x, _y );
}
} #endregion } #endregion
static getPointDistance = function(_dist, ind = 0) { #region static getPointDistance = function(_dist, ind = 0) { return getPointRatio(_dist / length[ind], ind); }
if(connected) return getPointRatio(_dist / length);
else return getPointRatio(_dist / length[ind], ind);
} #endregion
static getBoundary = function() { #region static getBoundary = function() { #region
var boundary = new BoundingBox(); var boundary = new BoundingBox();
var lines = getInputData(0);
for( var i = 0, n = array_length(lines); i < n; i++ ) for( var i = 0, n = array_length(lines); i < n; i++ ) {
boundary.addPoint(lines[i][0], lines[i][1]); var _line = lines[i];
for( var j = 0, m = array_length(_line); j < m; j++ )
boundary.addPoint(_line[j][0], _line[j][1]);
}
return boundary; return boundary;
} #endregion } #endregion
static update = function() { #region static update = function() { #region
lines = []; var _lines = getInputData(0);
array_spread(getInputData(0), lines, 1); if(array_empty(_lines)) return;
connected = getInputData(1);
if(connected) { lines = _lines;
length = 0; if(!is_array(_lines[0][0]))
lengthAcc = []; lines = [ lines ];
for( var i = 1, n = array_length(lines); i < n; i++ ) { var _len = array_length(lines);
var p0 = lines[i - 1]; length = array_create(_len);
var p1 = lines[i - 0]; lengthAcc = array_create(_len);
var dist = point_distance(p0[0], p0[1], p1[0], p1[1]); for( var i = 0; i < _len; i++ ) {
var _line = lines[i];
var _lngh = 0;
var _lenA = [];
length += dist; var _ox = _line[0], _nx;
array_push(lengthAcc, length);
}
} else {
length = [];
lengthAcc = [];
var len = floor(array_length(lines) / 2) * 2; for( var j = 1, m = array_length(_line); j < m; j++ ) {
_nx = _line[j];
for( var i = 0; i < len; i += 2 ) { var p0x = array_safe_get(_ox, 0);
var p0 = lines[i + 0]; var p0y = array_safe_get(_ox, 1);
var p1 = lines[i + 1]; var p1x = array_safe_get(_nx, 0);
var p1y = array_safe_get(_nx, 1);
var p0x = array_safe_get(p0, 0);
var p0y = array_safe_get(p0, 1);
var p1x = array_safe_get(p1, 0);
var p1y = array_safe_get(p1, 1);
p0x = is_real(p0x)? p0x : 0; p0x = is_real(p0x)? p0x : 0;
p0y = is_real(p0y)? p0y : 0; p0y = is_real(p0y)? p0y : 0;
p1x = is_real(p1x)? p1x : 0; p1x = is_real(p1x)? p1x : 0;
p1y = is_real(p1y)? p1y : 0; p1y = is_real(p1y)? p1y : 0;
lines[i + 0] = [ p0x, p0y ];
lines[i + 1] = [ p1x, p1y ];
var dist = point_distance(p0x, p0y, p1x, p1y); var dist = point_distance(p0x, p0y, p1x, p1y);
_lngh += dist;
array_push(_lenA, dist);
array_push(length, dist); _ox = _nx;
array_push(lengthAcc, [ dist ]);
} }
length[i] = _lngh;
lengthAcc[i] = _lenA;
} }
outputs[| 0].setValue(self); outputs[| 0].setValue(self);

View file

@ -418,8 +418,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
ds_list_add(d3d, "Modify"); ds_list_add(d3d, "Modify");
addNodeObject(d3d, "Discretize vertex", s_node_3d_discretize, "Node_3D_Round_Vertex", [1, Node_3D_Round_Vertex]).setVersion(11560); addNodeObject(d3d, "Discretize vertex", s_node_3d_discretize, "Node_3D_Round_Vertex", [1, Node_3D_Round_Vertex]).setVersion(11560);
addNodeObject(d3d, "Set Material", s_node_3d_set_material, "Node_3D_Set_Material", [1, Node_3D_Set_Material]).setVersion(11560); addNodeObject(d3d, "Set Material", s_node_3d_set_material, "Node_3D_Set_Material", [1, Node_3D_Set_Material]).setVersion(11560);
/**/ addNodeObject(d3d, "3D Instancer", s_node_3d_set_material, "Node_3D_Instancer", [1, Node_3D_Instancer]).setVersion(11560); ///**/ addNodeObject(d3d, "3D Instancer", s_node_3d_set_material, "Node_3D_Instancer", [1, Node_3D_Instancer]).setVersion(11560);
/**/ addNodeObject(d3d, "3D Particle", s_node_3d_set_material, "Node_3D_Particle", [1, Node_3D_Particle]).setVersion(11560); ///**/ addNodeObject(d3d, "3D Particle", s_node_3d_set_material, "Node_3D_Particle", [1, Node_3D_Particle]).setVersion(11560);
ds_list_add(d3d, "Legacy"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// ds_list_add(d3d, "Legacy"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////
addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated(); addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated();

View file

@ -62,6 +62,7 @@ enum VALUE_TYPE {
enum VALUE_DISPLAY { enum VALUE_DISPLAY {
_default, _default,
none,
range, range,
//Int //Int