mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-03 00:35:14 +01:00
- New Scatter Path node.
This commit is contained in:
parent
18dc64fbfd
commit
2426e9a3fb
13 changed files with 332 additions and 19 deletions
|
@ -924,6 +924,7 @@
|
||||||
{"name":"node_path_profile","order":10,"path":"scripts/node_path_profile/node_path_profile.yy",},
|
{"name":"node_path_profile","order":10,"path":"scripts/node_path_profile/node_path_profile.yy",},
|
||||||
{"name":"node_path_reverse","order":8,"path":"scripts/node_path_reverse/node_path_reverse.yy",},
|
{"name":"node_path_reverse","order":8,"path":"scripts/node_path_reverse/node_path_reverse.yy",},
|
||||||
{"name":"node_path_sample","order":4,"path":"scripts/node_path_sample/node_path_sample.yy",},
|
{"name":"node_path_sample","order":4,"path":"scripts/node_path_sample/node_path_sample.yy",},
|
||||||
|
{"name":"node_path_scatter","order":19,"path":"scripts/node_path_scatter/node_path_scatter.yy",},
|
||||||
{"name":"node_path_separate_folder","order":12,"path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},
|
{"name":"node_path_separate_folder","order":12,"path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},
|
||||||
{"name":"node_path_shift","order":5,"path":"scripts/node_path_shift/node_path_shift.yy",},
|
{"name":"node_path_shift","order":5,"path":"scripts/node_path_shift/node_path_shift.yy",},
|
||||||
{"name":"node_path_smooth","order":18,"path":"scripts/node_path_smooth/node_path_smooth.yy",},
|
{"name":"node_path_smooth","order":18,"path":"scripts/node_path_smooth/node_path_smooth.yy",},
|
||||||
|
@ -1902,6 +1903,7 @@
|
||||||
{"name":"s_node_path_plot","order":11,"path":"sprites/s_node_path_plot/s_node_path_plot.yy",},
|
{"name":"s_node_path_plot","order":11,"path":"sprites/s_node_path_plot/s_node_path_plot.yy",},
|
||||||
{"name":"s_node_path_reverse","order":12,"path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},
|
{"name":"s_node_path_reverse","order":12,"path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},
|
||||||
{"name":"s_node_path_sample","order":13,"path":"sprites/s_node_path_sample/s_node_path_sample.yy",},
|
{"name":"s_node_path_sample","order":13,"path":"sprites/s_node_path_sample/s_node_path_sample.yy",},
|
||||||
|
{"name":"s_node_path_scatter","order":19,"path":"sprites/s_node_path_scatter/s_node_path_scatter.yy",},
|
||||||
{"name":"s_node_path_shift","order":14,"path":"sprites/s_node_path_shift/s_node_path_shift.yy",},
|
{"name":"s_node_path_shift","order":14,"path":"sprites/s_node_path_shift/s_node_path_shift.yy",},
|
||||||
{"name":"s_node_path_smooth","order":15,"path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},
|
{"name":"s_node_path_smooth","order":15,"path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},
|
||||||
{"name":"s_node_path_transform","order":16,"path":"sprites/s_node_path_transform/s_node_path_transform.yy",},
|
{"name":"s_node_path_transform","order":16,"path":"sprites/s_node_path_transform/s_node_path_transform.yy",},
|
||||||
|
|
|
@ -1343,6 +1343,7 @@
|
||||||
{"id":{"name":"node_path_profile","path":"scripts/node_path_profile/node_path_profile.yy",},},
|
{"id":{"name":"node_path_profile","path":"scripts/node_path_profile/node_path_profile.yy",},},
|
||||||
{"id":{"name":"node_path_reverse","path":"scripts/node_path_reverse/node_path_reverse.yy",},},
|
{"id":{"name":"node_path_reverse","path":"scripts/node_path_reverse/node_path_reverse.yy",},},
|
||||||
{"id":{"name":"node_path_sample","path":"scripts/node_path_sample/node_path_sample.yy",},},
|
{"id":{"name":"node_path_sample","path":"scripts/node_path_sample/node_path_sample.yy",},},
|
||||||
|
{"id":{"name":"node_path_scatter","path":"scripts/node_path_scatter/node_path_scatter.yy",},},
|
||||||
{"id":{"name":"node_path_separate_folder","path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},},
|
{"id":{"name":"node_path_separate_folder","path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},},
|
||||||
{"id":{"name":"node_path_shift","path":"scripts/node_path_shift/node_path_shift.yy",},},
|
{"id":{"name":"node_path_shift","path":"scripts/node_path_shift/node_path_shift.yy",},},
|
||||||
{"id":{"name":"node_path_smooth","path":"scripts/node_path_smooth/node_path_smooth.yy",},},
|
{"id":{"name":"node_path_smooth","path":"scripts/node_path_smooth/node_path_smooth.yy",},},
|
||||||
|
@ -2465,6 +2466,7 @@
|
||||||
{"id":{"name":"s_node_path_plot","path":"sprites/s_node_path_plot/s_node_path_plot.yy",},},
|
{"id":{"name":"s_node_path_plot","path":"sprites/s_node_path_plot/s_node_path_plot.yy",},},
|
||||||
{"id":{"name":"s_node_path_reverse","path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},},
|
{"id":{"name":"s_node_path_reverse","path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},},
|
||||||
{"id":{"name":"s_node_path_sample","path":"sprites/s_node_path_sample/s_node_path_sample.yy",},},
|
{"id":{"name":"s_node_path_sample","path":"sprites/s_node_path_sample/s_node_path_sample.yy",},},
|
||||||
|
{"id":{"name":"s_node_path_scatter","path":"sprites/s_node_path_scatter/s_node_path_scatter.yy",},},
|
||||||
{"id":{"name":"s_node_path_shift","path":"sprites/s_node_path_shift/s_node_path_shift.yy",},},
|
{"id":{"name":"s_node_path_shift","path":"sprites/s_node_path_shift/s_node_path_shift.yy",},},
|
||||||
{"id":{"name":"s_node_path_smooth","path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},},
|
{"id":{"name":"s_node_path_smooth","path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},},
|
||||||
{"id":{"name":"s_node_path_transform","path":"sprites/s_node_path_transform/s_node_path_transform.yy",},},
|
{"id":{"name":"s_node_path_transform","path":"sprites/s_node_path_transform/s_node_path_transform.yy",},},
|
||||||
|
|
|
@ -76,7 +76,7 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
show_coord = true;
|
show_coord = true;
|
||||||
_data = array_clone(_data);
|
_data = array_clone(_data);
|
||||||
|
|
||||||
if(node_drag_typ == 0) {
|
if(node_drag_typ == 0) { //anchor
|
||||||
|
|
||||||
var _mx = (_m[0] - _x) / cw;
|
var _mx = (_m[0] - _x) / cw;
|
||||||
_mx = clamp(_mx * (maxx - minx) + minx, 0, 1);
|
_mx = clamp(_mx * (maxx - minx) + minx, 0, 1);
|
||||||
|
@ -93,9 +93,7 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
var bfx = _data[node_dragging - 6];
|
var bfx = _data[node_dragging - 6];
|
||||||
var afx = _data[node_dragging + 6];
|
var afx = _data[node_dragging + 6];
|
||||||
|
|
||||||
if(_mx == bfx) node_dragging -= 6;
|
if(_mx > bfx && _mx < afx) _data[node_dragging + 0] = _mx;
|
||||||
else if(_mx == afx) node_dragging += 6;
|
|
||||||
else _data[node_dragging + 0] = _mx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key_mod_press(CTRL) || grid_snap)
|
if(key_mod_press(CTRL) || grid_snap)
|
||||||
|
@ -115,6 +113,7 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
array_push(_xindex, _x0);
|
array_push(_xindex, _x0);
|
||||||
array_push(_pindex, _x0);
|
array_push(_pindex, _x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_sort(_xindex, true);
|
array_sort(_xindex, true);
|
||||||
|
|
||||||
if(node_point > 0 && node_point < points - 1) {
|
if(node_point > 0 && node_point < points - 1) {
|
||||||
|
@ -135,7 +134,9 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
UNDO_HOLDING = true;
|
UNDO_HOLDING = true;
|
||||||
} else if(onModify(_data))
|
} else if(onModify(_data))
|
||||||
UNDO_HOLDING = true;
|
UNDO_HOLDING = true;
|
||||||
} else {
|
|
||||||
|
} else { //control
|
||||||
|
|
||||||
var _px = _data[node_dragging + 0];
|
var _px = _data[node_dragging + 0];
|
||||||
var _py = _data[node_dragging + 1];
|
var _py = _data[node_dragging + 1];
|
||||||
|
|
||||||
|
@ -144,14 +145,16 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
|
|
||||||
var _my = 1 - (_m[1] - _y) / ch;
|
var _my = 1 - (_m[1] - _y) / ch;
|
||||||
_my = lerp(miny, maxy, _my);
|
_my = lerp(miny, maxy, _my);
|
||||||
|
|
||||||
|
var _w_spc = node_drag_typ > 0? _data[node_dragging + 6] - _px : _px - _data[node_dragging - 6];
|
||||||
|
|
||||||
if(key_mod_press(CTRL) || grid_snap) _mx = value_snap(_mx, grid_step);
|
if(key_mod_press(CTRL) || grid_snap) _mx = value_snap(_mx, grid_step);
|
||||||
_data[node_dragging - 2] = (_px - _mx) * node_drag_typ;
|
_data[node_dragging - 2] = (_px - _mx) * node_drag_typ / _w_spc;
|
||||||
_data[node_dragging + 2] = (_mx - _px) * node_drag_typ;
|
_data[node_dragging + 2] = (_mx - _px) * node_drag_typ / _w_spc;
|
||||||
|
|
||||||
if(key_mod_press(CTRL) || grid_snap) _my = value_snap(_my, grid_step);
|
if(key_mod_press(CTRL) || grid_snap) _my = value_snap(_my, grid_step);
|
||||||
_data[node_dragging - 1] = clamp(_py - _my, -1, 1) * node_drag_typ;
|
_data[node_dragging - 1] = clamp(_py - _my, -1, 1) * node_drag_typ / _w_spc;
|
||||||
_data[node_dragging + 3] = clamp(_my - _py, -1, 1) * node_drag_typ;
|
_data[node_dragging + 3] = clamp(_my - _py, -1, 1) * node_drag_typ / _w_spc;
|
||||||
|
|
||||||
display_pos_x = node_drag_typ? _data[node_dragging - 2] : _data[node_dragging + 2];
|
display_pos_x = node_drag_typ? _data[node_dragging - 2] : _data[node_dragging + 2];
|
||||||
display_pos_y = node_drag_typ? _data[node_dragging - 1] : _data[node_dragging + 3];
|
display_pos_y = node_drag_typ? _data[node_dragging - 1] : _data[node_dragging + 3];
|
||||||
|
@ -216,10 +219,14 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
var ind = i * 6;
|
var ind = i * 6;
|
||||||
var _x0 = _data[ind + 2];
|
var _x0 = _data[ind + 2];
|
||||||
var _y0 = _data[ind + 3];
|
var _y0 = _data[ind + 3];
|
||||||
var bx0 = _x0 + _data[ind + 0];
|
|
||||||
var by0 = _y0 + _data[ind + 1];
|
var _w_prev = i > 0? _x0 - _data[ind - 6 + 2] : 1;
|
||||||
var ax0 = _x0 + _data[ind + 4];
|
var _w_next = i < points - 1? _data[ind + 6 + 2] - _x0 : 1;
|
||||||
var ay0 = _y0 + _data[ind + 5];
|
|
||||||
|
var bx0 = _x0 + _data[ind + 0] * _w_prev;
|
||||||
|
var by0 = _y0 + _data[ind + 1] * _w_prev;
|
||||||
|
var ax0 = _x0 + _data[ind + 4] * _w_next;
|
||||||
|
var ay0 = _y0 + _data[ind + 5] * _w_next;
|
||||||
|
|
||||||
bx0 = get_x(bx0);
|
bx0 = get_x(bx0);
|
||||||
by0 = get_y(by0);
|
by0 = get_y(by0);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
LATEST_VERSION = 11700;
|
LATEST_VERSION = 11700;
|
||||||
VERSION = 11740;
|
VERSION = 11740;
|
||||||
SAVE_VERSION = 11700;
|
SAVE_VERSION = 11700;
|
||||||
VERSION_STRING = "1.17.4.005";
|
VERSION_STRING = "1.17.4.006";
|
||||||
BUILD_NUMBER = 11740;
|
BUILD_NUMBER = 11740;
|
||||||
|
|
||||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||||
|
|
|
@ -16,7 +16,6 @@ function Node_3D_Mesh_Export(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
||||||
["Export", false], 1, 2, 3,
|
["Export", false], 1, 2, 3,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
insp1UpdateTooltip = "Export";
|
insp1UpdateTooltip = "Export";
|
||||||
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||||
|
|
||||||
draw_line(x0, y0, x1, y1);
|
draw_line(x0, y0, x1, y1);
|
||||||
|
|
||||||
draw_circle(x0, y0, 4, false);
|
// draw_circle(x0, y0, 4, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -41,6 +41,8 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
["Anchors", false],
|
["Anchors", false],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
output_display_list = [ 1, 0, 2 ];
|
||||||
|
|
||||||
setDynamicInput(1, false);
|
setDynamicInput(1, false);
|
||||||
|
|
||||||
tool_pathDrawer = new NodeTool( "Draw path", THEME.path_tools_draw )
|
tool_pathDrawer = new NodeTool( "Draw path", THEME.path_tools_draw )
|
||||||
|
|
197
scripts/node_path_scatter/node_path_scatter.gml
Normal file
197
scripts/node_path_scatter/node_path_scatter.gml
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
|
name = "Scatter Path";
|
||||||
|
setDimension(96, 48);
|
||||||
|
|
||||||
|
inputs[| 0] = nodeValue("Base Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone)
|
||||||
|
.setVisible(true, true);
|
||||||
|
|
||||||
|
inputs[| 1] = nodeValue("Scatter Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone)
|
||||||
|
.setVisible(true, true);
|
||||||
|
|
||||||
|
inputs[| 2] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||||
|
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||||
|
|
||||||
|
inputs[| 3] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
|
||||||
|
|
||||||
|
inputs[| 4] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 1 ])
|
||||||
|
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||||
|
|
||||||
|
inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
|
||||||
|
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
|
||||||
|
|
||||||
|
inputs[| 6] = nodeValue("Scale over Length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
|
||||||
|
|
||||||
|
inputs[| 7] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 45, 135, 0, 0 ] )
|
||||||
|
.setDisplay(VALUE_DISPLAY.rotation_random);
|
||||||
|
|
||||||
|
inputs[| 8] = nodeValue("Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||||
|
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Uniform", "Random" ]);
|
||||||
|
|
||||||
|
inputs[| 9] = nodeValue("Trim over Length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
|
||||||
|
|
||||||
|
inputs[| 10] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||||
|
.setDisplay(VALUE_DISPLAY.slider);
|
||||||
|
|
||||||
|
inputs[| 11] = nodeValue("Flip if Negative", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||||
|
|
||||||
|
outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
|
||||||
|
|
||||||
|
input_display_list = [ 5,
|
||||||
|
["Paths", false], 0, 1, 10, 9,
|
||||||
|
["Scatter", false], 8, 3,
|
||||||
|
["Position", false], 2,
|
||||||
|
["Rotation", false], 7, 11,
|
||||||
|
["Scale", false], 4, 6,
|
||||||
|
];
|
||||||
|
|
||||||
|
cached_pos = ds_map_create();
|
||||||
|
paths = [];
|
||||||
|
segment_counts = [];
|
||||||
|
line_lengths = [];
|
||||||
|
accu_lengths = [];
|
||||||
|
line_amount = 0;
|
||||||
|
|
||||||
|
__temp_p = [ 0, 0 ];
|
||||||
|
|
||||||
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||||
|
var _path = getInputData(0);
|
||||||
|
if(_path && struct_has(_path, "drawOverlay")) _path.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||||
|
|
||||||
|
var _path = getInputData(1);
|
||||||
|
if(_path && struct_has(_path, "drawOverlay")) _path.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||||
|
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
static getLineCount = function() { return line_amount; }
|
||||||
|
static getSegmentCount = function(ind = 0) { return array_safe_get_fast(segment_counts, ind); }
|
||||||
|
static getLength = function(ind = 0) { return array_safe_get_fast(line_lengths, ind); }
|
||||||
|
static getAccuLength = function(ind = 0) { return array_safe_get_fast(accu_lengths, ind); }
|
||||||
|
|
||||||
|
static getPointRatio = function(_rat, ind = 0, out = undefined) { #region
|
||||||
|
if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; }
|
||||||
|
|
||||||
|
var _path = array_safe_get_fast(paths, ind, 0);
|
||||||
|
if(_path == 0) return out;
|
||||||
|
|
||||||
|
var _pathObj = _path.path;
|
||||||
|
if(!is_struct(_pathObj) || !struct_has(_pathObj, "getPointRatio"))
|
||||||
|
return out;
|
||||||
|
|
||||||
|
var _ori = _path.ori;
|
||||||
|
var _pos = _path.pos;
|
||||||
|
var _rot = _path.rot;
|
||||||
|
var _rotW = _path.rotW;
|
||||||
|
var _sca = _path.sca;
|
||||||
|
var _trm = _path.trim;
|
||||||
|
var _flip = _path.flip;
|
||||||
|
|
||||||
|
_rat *= _trm;
|
||||||
|
|
||||||
|
out = _pathObj.getPointRatio(_rat, 0, out);
|
||||||
|
|
||||||
|
var _px = out.x - _ori[0];
|
||||||
|
var _py = out.y - _ori[1];
|
||||||
|
|
||||||
|
if(_flip && angle_difference(_rotW, 90) < 0)
|
||||||
|
_px = -_px;
|
||||||
|
|
||||||
|
__temp_p = point_rotate(_px, _py, 0, 0, _rot, __temp_p);
|
||||||
|
|
||||||
|
out.x = _pos[0] + __temp_p[0] * _sca;
|
||||||
|
out.y = _pos[1] + __temp_p[1] * _sca;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
static getPointDistance = function(_dist, ind = 0, out = undefined) { return getPointRatio(_dist / getLength(ind), ind, out); }
|
||||||
|
|
||||||
|
static getBoundary = function(ind = 0) { #region
|
||||||
|
var _path = getInputData(0);
|
||||||
|
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
static update = function() { #region
|
||||||
|
ds_map_clear(cached_pos);
|
||||||
|
|
||||||
|
var path_base = getInputData(0);
|
||||||
|
var path_scat = getInputData(1);
|
||||||
|
var _range = getInputData(2);
|
||||||
|
var _amount = getInputData(3);
|
||||||
|
var _scale = getInputData(4);
|
||||||
|
var _seed = getInputData(5);
|
||||||
|
var _sca_wid = getInputData(6);
|
||||||
|
var _rotation = getInputData(7);
|
||||||
|
var _distrib = getInputData(8);
|
||||||
|
var _trim = getInputData(9);
|
||||||
|
var _trim_rng = getInputData(10);
|
||||||
|
var _flip = getInputData(11);
|
||||||
|
|
||||||
|
amount = 0;
|
||||||
|
|
||||||
|
if(path_base == noone) return;
|
||||||
|
if(path_scat == noone) return;
|
||||||
|
|
||||||
|
line_amount = _amount;
|
||||||
|
paths = array_create(_amount);
|
||||||
|
segment_counts = array_create(_amount);
|
||||||
|
line_lengths = array_create(_amount);
|
||||||
|
accu_lengths = array_create(_amount);
|
||||||
|
|
||||||
|
var p = new __vec2();
|
||||||
|
|
||||||
|
random_set_seed(_seed);
|
||||||
|
|
||||||
|
for (var i = 0, n = array_length(paths); i < n; i++) {
|
||||||
|
|
||||||
|
p = path_scat.getPointRatio(0, p);
|
||||||
|
var ori = [ p.x, p.y ];
|
||||||
|
|
||||||
|
var _prog_raw = _distrib? random_range(0, 1) : (i / max(1, line_amount - 1)) * 0.9999;
|
||||||
|
var _prog = lerp(_range[0], _range[1], _prog_raw);
|
||||||
|
|
||||||
|
p = path_base.getPointRatio(_prog, p);
|
||||||
|
var pos = [ p.x, p.y ];
|
||||||
|
|
||||||
|
p = path_base.getPointRatio(clamp(_prog - 0.001, 0., 0.9999), p);
|
||||||
|
var x0 = p.x;
|
||||||
|
var y0 = p.y;
|
||||||
|
|
||||||
|
p = path_base.getPointRatio(clamp(_prog + 0.001, 0., 0.9999), p);
|
||||||
|
var x1 = p.x;
|
||||||
|
var y1 = p.y;
|
||||||
|
|
||||||
|
var _dir = point_direction(x0, y0, x1, y1);
|
||||||
|
var _sca = random_range(_scale[0], _scale[1]);
|
||||||
|
_sca *= eval_curve_x(_sca_wid, _prog_raw);
|
||||||
|
|
||||||
|
var _rot = _dir;
|
||||||
|
var _rotW = angle_random_eval(_rotation);
|
||||||
|
_rot += _rotW;
|
||||||
|
|
||||||
|
var _trm = _trim_rng;
|
||||||
|
_trm *= eval_curve_x(_trim, _prog_raw);
|
||||||
|
|
||||||
|
paths[i] = {
|
||||||
|
path : path_scat,
|
||||||
|
ori : ori,
|
||||||
|
pos : pos,
|
||||||
|
rot : _rot,
|
||||||
|
rotW : _rotW,
|
||||||
|
sca : _sca,
|
||||||
|
trim : max(0, _trm),
|
||||||
|
flip : _flip,
|
||||||
|
}
|
||||||
|
|
||||||
|
segment_counts[i] = array_clone(path_scat.getSegmentCount(0));
|
||||||
|
line_lengths[i] = array_clone(path_scat.getLength(0));
|
||||||
|
accu_lengths[i] = array_clone(path_scat.getAccuLength(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
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_scatter, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||||
|
} #endregion
|
||||||
|
}
|
13
scripts/node_path_scatter/node_path_scatter.yy
Normal file
13
scripts/node_path_scatter/node_path_scatter.yy
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"$GMScript":"",
|
||||||
|
"%Name":"node_path_scatter",
|
||||||
|
"isCompatibility":false,
|
||||||
|
"isDnD":false,
|
||||||
|
"name":"node_path_scatter",
|
||||||
|
"parent":{
|
||||||
|
"name":"path",
|
||||||
|
"path":"folders/nodes/data/value/path.yy",
|
||||||
|
},
|
||||||
|
"resourceType":"GMScript",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
}
|
|
@ -673,7 +673,7 @@ function __initNodes() {
|
||||||
addNodeObject(d3d, "3D Cone", s_node_3d_cone, "Node_3D_Mesh_Cone", [1, Node_3D_Mesh_Cone]).setVersion(11510);
|
addNodeObject(d3d, "3D Cone", s_node_3d_cone, "Node_3D_Mesh_Cone", [1, Node_3D_Mesh_Cone]).setVersion(11510);
|
||||||
addNodeObject(d3d, "3D Terrain", s_node_3d_displace, "Node_3D_Mesh_Terrain", [1, Node_3D_Mesh_Terrain],, "Create 3D terrain from height map.").setVersion(11560);
|
addNodeObject(d3d, "3D Terrain", s_node_3d_displace, "Node_3D_Mesh_Terrain", [1, Node_3D_Mesh_Terrain],, "Create 3D terrain from height map.").setVersion(11560);
|
||||||
addNodeObject(d3d, "Surface Extrude", s_node_3d_extrude, "Node_3D_Mesh_Extrude", [1, Node_3D_Mesh_Extrude],, "Extrude 2D image into 3D object.").setVersion(11510);
|
addNodeObject(d3d, "Surface Extrude", s_node_3d_extrude, "Node_3D_Mesh_Extrude", [1, Node_3D_Mesh_Extrude],, "Extrude 2D image into 3D object.").setVersion(11510);
|
||||||
|
|
||||||
ds_list_add(d3d, "Light");
|
ds_list_add(d3d, "Light");
|
||||||
addNodeObject(d3d, "Directional Light", s_node_3d_light_directi, "Node_3D_Light_Directional", [1, Node_3D_Light_Directional],, "Create directional light directed at the origin point.").setVersion(11510);
|
addNodeObject(d3d, "Directional Light", s_node_3d_light_directi, "Node_3D_Light_Directional", [1, Node_3D_Light_Directional],, "Create directional light directed at the origin point.").setVersion(11510);
|
||||||
addNodeObject(d3d, "Point Light", s_node_3d_light_point, "Node_3D_Light_Point", [1, Node_3D_Light_Point],, "Create point light to illuminate surrounding area.").setVersion(11510);
|
addNodeObject(d3d, "Point Light", s_node_3d_light_point, "Node_3D_Light_Point", [1, Node_3D_Light_Point],, "Create point light to illuminate surrounding area.").setVersion(11510);
|
||||||
|
@ -686,7 +686,7 @@ function __initNodes() {
|
||||||
addNodeObject(d3d, "UV Remap", s_node_uv_remap, "Node_3D_UV_Remap", [1, Node_3D_UV_Remap],, "Remap UV map using plane.").setVersion(11570);
|
addNodeObject(d3d, "UV Remap", s_node_uv_remap, "Node_3D_UV_Remap", [1, Node_3D_UV_Remap],, "Remap UV map using plane.").setVersion(11570);
|
||||||
///**/ 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, "Points");
|
ds_list_add(d3d, "Points");
|
||||||
addNodeObject(d3d, "Point Affector", s_node_3d_point_affector, "Node_3D_Point_Affector", [1, Node_3D_Point_Affector],, "Generate array of 3D points interpolating between two values based on the distance.").setVersion(11570);
|
addNodeObject(d3d, "Point Affector", s_node_3d_point_affector, "Node_3D_Point_Affector", [1, Node_3D_Point_Affector],, "Generate array of 3D points interpolating between two values based on the distance.").setVersion(11570);
|
||||||
|
|
||||||
|
@ -900,6 +900,7 @@ function __initNodes() {
|
||||||
addNodeObject(values, "Bridge Path", s_node_path_bridge, "Node_Path_Bridge", [1, Node_Path_Bridge]).setVersion(11640);
|
addNodeObject(values, "Bridge Path", s_node_path_bridge, "Node_Path_Bridge", [1, Node_Path_Bridge]).setVersion(11640);
|
||||||
addNodeObject(values, "Bake Path", s_node_path_bake, "Node_Path_Bake", [1, Node_Path_Bake]).setVersion(11640);
|
addNodeObject(values, "Bake Path", s_node_path_bake, "Node_Path_Bake", [1, Node_Path_Bake]).setVersion(11640);
|
||||||
addNodeObject(values, "Map Path", s_node_path_mapp, "Node_Path_Map", [1, Node_Path_Map]).setVersion(11640);
|
addNodeObject(values, "Map Path", s_node_path_mapp, "Node_Path_Map", [1, Node_Path_Map]).setVersion(11640);
|
||||||
|
addNodeObject(values, "Scatter Path", s_node_path_scatter, "Node_Path_Scatter", [1, Node_Path_Scatter]).setVersion(11740);
|
||||||
|
|
||||||
ds_list_add(values, "Boolean");
|
ds_list_add(values, "Boolean");
|
||||||
addNodeObject(values, "Boolean", s_node_boolean, "Node_Boolean", [1, Node_Boolean]);
|
addNodeObject(values, "Boolean", s_node_boolean, "Node_Boolean", [1, Node_Boolean]);
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
90
sprites/s_node_path_scatter/s_node_path_scatter.yy
Normal file
90
sprites/s_node_path_scatter/s_node_path_scatter.yy
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"$GMSprite":"",
|
||||||
|
"%Name":"s_node_path_scatter",
|
||||||
|
"bboxMode":0,
|
||||||
|
"bbox_bottom":61,
|
||||||
|
"bbox_left":3,
|
||||||
|
"bbox_right":60,
|
||||||
|
"bbox_top":2,
|
||||||
|
"collisionKind":1,
|
||||||
|
"collisionTolerance":0,
|
||||||
|
"DynamicTexturePage":false,
|
||||||
|
"edgeFiltering":false,
|
||||||
|
"For3D":false,
|
||||||
|
"frames":[
|
||||||
|
{"$GMSpriteFrame":"","%Name":"02cb8882-7fbe-42bc-9a5e-e9fc2f54d2ab","name":"02cb8882-7fbe-42bc-9a5e-e9fc2f54d2ab","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||||
|
],
|
||||||
|
"gridX":0,
|
||||||
|
"gridY":0,
|
||||||
|
"height":64,
|
||||||
|
"HTile":false,
|
||||||
|
"layers":[
|
||||||
|
{"$GMImageLayer":"","%Name":"1bc10b85-a441-42ec-a5a5-2d4f6b3dfdcc","blendMode":0,"displayName":"default","isLocked":false,"name":"1bc10b85-a441-42ec-a5a5-2d4f6b3dfdcc","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||||
|
],
|
||||||
|
"name":"s_node_path_scatter",
|
||||||
|
"nineSlice":null,
|
||||||
|
"origin":4,
|
||||||
|
"parent":{
|
||||||
|
"name":"path",
|
||||||
|
"path":"folders/nodes/icons/value/path.yy",
|
||||||
|
},
|
||||||
|
"preMultiplyAlpha":false,
|
||||||
|
"resourceType":"GMSprite",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
"sequence":{
|
||||||
|
"$GMSequence":"",
|
||||||
|
"%Name":"s_node_path_scatter",
|
||||||
|
"autoRecord":true,
|
||||||
|
"backdropHeight":768,
|
||||||
|
"backdropImageOpacity":0.5,
|
||||||
|
"backdropImagePath":"",
|
||||||
|
"backdropWidth":1366,
|
||||||
|
"backdropXOffset":0.0,
|
||||||
|
"backdropYOffset":0.0,
|
||||||
|
"events":{
|
||||||
|
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||||
|
"Keyframes":[],
|
||||||
|
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
},
|
||||||
|
"eventStubScript":null,
|
||||||
|
"eventToFunction":{},
|
||||||
|
"length":1.0,
|
||||||
|
"lockOrigin":false,
|
||||||
|
"moments":{
|
||||||
|
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||||
|
"Keyframes":[],
|
||||||
|
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
},
|
||||||
|
"name":"s_node_path_scatter",
|
||||||
|
"playback":1,
|
||||||
|
"playbackSpeed":30.0,
|
||||||
|
"playbackSpeedType":0,
|
||||||
|
"resourceType":"GMSequence",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
"showBackdrop":true,
|
||||||
|
"showBackdropImage":false,
|
||||||
|
"timeUnits":1,
|
||||||
|
"tracks":[
|
||||||
|
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||||
|
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||||
|
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"02cb8882-7fbe-42bc-9a5e-e9fc2f54d2ab","path":"sprites/s_node_path_scatter/s_node_path_scatter.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||||
|
},"Disabled":false,"id":"1904a981-39d4-4ba3-b2bb-17009bb6c5e1","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||||
|
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||||
|
],
|
||||||
|
"visibleRange":null,
|
||||||
|
"volume":1.0,
|
||||||
|
"xorigin":32,
|
||||||
|
"yorigin":32,
|
||||||
|
},
|
||||||
|
"swatchColours":null,
|
||||||
|
"swfPrecision":0.5,
|
||||||
|
"textureGroupId":{
|
||||||
|
"name":"Default",
|
||||||
|
"path":"texturegroups/Default",
|
||||||
|
},
|
||||||
|
"type":0,
|
||||||
|
"VTile":false,
|
||||||
|
"width":64,
|
||||||
|
}
|
Loading…
Reference in a new issue