- [Bake Path] Baking a single path will returns 2D array instead of 3D.

This commit is contained in:
Tanasart 2024-06-21 08:52:35 +07:00
parent b19dad22db
commit bc0fd6e430
3 changed files with 10 additions and 4 deletions

View File

@ -196,7 +196,7 @@
#region debug
global.FLAG = {
render : 1,
render : 0,
renderTime : false,
keyframe_override : true,
wav_import : true,

View File

@ -11,6 +11,8 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
.setDisplay(VALUE_DISPLAY.vector)
.setArrayDepth(1);
path_amount = 1;
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);
@ -18,7 +20,9 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _segs = outputs[| 0].getValue();
var ox, oy, nx, ny;
if(path_amount == 1) _segs = [ _segs ];
draw_set_color(COLORS._main_icon);
for( var i = 0, n = array_length(_segs); i < n; i++ ) {
var _seg = _segs[i];
@ -42,6 +46,7 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(_dist <= 0) return;
var _amo = _path.getLineCount();
path_amount = _amo;
var _segs = array_create(_amo);
var _p = new __vec2();
@ -59,6 +64,7 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
_segs[i] = _seg;
}
if(_amo == 1) _segs = _segs[0];
outputs[| 0].setValue(_segs);
} #endregion

View File

@ -1,6 +1,6 @@
function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Path Builder";
setDimension(96, 48);;
setDimension(96, 48);
#region ---- path ----
path_loop = false;