- [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 #region debug
global.FLAG = { global.FLAG = {
render : 1, render : 0,
renderTime : false, renderTime : false,
keyframe_override : true, keyframe_override : true,
wav_import : 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) .setDisplay(VALUE_DISPLAY.vector)
.setArrayDepth(1); .setArrayDepth(1);
path_amount = 1;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var _path = getInputData(0); var _path = getInputData(0);
if(_path && struct_has(_path, "drawOverlay")) _path.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); 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 _segs = outputs[| 0].getValue();
var ox, oy, nx, ny; var ox, oy, nx, ny;
if(path_amount == 1) _segs = [ _segs ];
draw_set_color(COLORS._main_icon); draw_set_color(COLORS._main_icon);
for( var i = 0, n = array_length(_segs); i < n; i++ ) { for( var i = 0, n = array_length(_segs); i < n; i++ ) {
var _seg = _segs[i]; var _seg = _segs[i];
@ -41,8 +45,9 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(_path == noone) return; if(_path == noone) return;
if(_dist <= 0) return; if(_dist <= 0) return;
var _amo = _path.getLineCount(); var _amo = _path.getLineCount();
var _segs = array_create(_amo); path_amount = _amo;
var _segs = array_create(_amo);
var _p = new __vec2(); var _p = new __vec2();
@ -59,6 +64,7 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
_segs[i] = _seg; _segs[i] = _seg;
} }
if(_amo == 1) _segs = _segs[0];
outputs[| 0].setValue(_segs); outputs[| 0].setValue(_segs);
} #endregion } #endregion

View file

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