fixes for several nodes when create in step event.

This commit is contained in:
Tanasart 2024-02-25 20:59:15 +07:00
parent dcf87a4e20
commit c011a22906
14 changed files with 30 additions and 32 deletions

View file

@ -6,7 +6,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
manual_ungroupable = false; manual_ungroupable = false;
inputs[| 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF) inputs[| 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.") inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.")
@ -91,9 +91,9 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
inputs[| 3].setVisible(_typ == PARTICLE_RENDER_TYPE.line); inputs[| 3].setVisible(_typ == PARTICLE_RENDER_TYPE.line);
var _outSurf = outputs[| 0].getValue(); //var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); // _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf); //outputs[| 0].setValue(_outSurf);
if(previewing && is_instanceof(group, Node_VFX_Group)) if(previewing && is_instanceof(group, Node_VFX_Group))
group.preview_node = self; group.preview_node = self;

View file

@ -106,6 +106,8 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
} #endregion } #endregion
static step = function() { #region static step = function() { #region
if(outParent == undefined) return;
var _dim = getInputData(0); var _dim = getInputData(0);
var _typ = getInputData(2); var _typ = getInputData(2);

View file

@ -127,6 +127,8 @@ function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) const
} #endregion } #endregion
static drawNode = function(_x, _y, _mx, _my, _s) { #region static drawNode = function(_x, _y, _mx, _my, _s) { #region
if(spr == noone) return noone;
x = smooth? lerp_float(x, pos_x, 4) : pos_x; x = smooth? lerp_float(x, pos_x, 4) : pos_x;
y = smooth? lerp_float(y, pos_y, 4) : pos_y; y = smooth? lerp_float(y, pos_y, 4) : pos_y;

View file

@ -34,15 +34,6 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
static onInspector2Update = function() { clearCache(); } static onInspector2Update = function() { clearCache(); }
static step = function() {
var _dim = getInputData(1);
var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) {
_outSurf = surface_create_valid(_dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
}
}
static update = function(frame = CURRENT_FRAME) { static update = function(frame = CURRENT_FRAME) {
if(recoverCache() || !PROJECT.animator.is_playing) if(recoverCache() || !PROJECT.animator.is_playing)
return; return;

View file

@ -21,6 +21,7 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
} }
static step = function() { static step = function() {
if(group == noone) return;
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
if(outputs[| 0].setType(group.inputs[| 0].type)) if(outputs[| 0].setType(group.inputs[| 0].type))
@ -28,6 +29,8 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
} }
static getPreviewValues = function() { #region static getPreviewValues = function() { #region
if(group == noone) return noone;
switch(group.inputs[| 0].type) { switch(group.inputs[| 0].type) {
case VALUE_TYPE.surface : case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurface : case VALUE_TYPE.dynaSurface :
@ -40,6 +43,8 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
} #endregion } #endregion
static getGraphPreviewSurface = function() { #region static getGraphPreviewSurface = function() { #region
if(group == noone) return noone;
switch(group.inputs[| 0].type) { switch(group.inputs[| 0].type) {
case VALUE_TYPE.surface : case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurface : case VALUE_TYPE.dynaSurface :

View file

@ -18,6 +18,7 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
} #endregion } #endregion
static step = function() { #region static step = function() { #region
if(group == noone) return noone;
if(!variable_struct_exists(group, "iterated")) return; if(!variable_struct_exists(group, "iterated")) return;
if(outputs[| 0].setType(group.inputs[| 0].type)) if(outputs[| 0].setType(group.inputs[| 0].type))
@ -25,6 +26,8 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
} #endregion } #endregion
static getPreviewValues = function() { #region static getPreviewValues = function() { #region
if(group == noone) return noone;
switch(group.inputs[| 0].type) { switch(group.inputs[| 0].type) {
case VALUE_TYPE.surface : case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurface : case VALUE_TYPE.dynaSurface :
@ -37,6 +40,8 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
} #endregion } #endregion
static getGraphPreviewSurface = function() { #region static getGraphPreviewSurface = function() { #region
if(group == noone) return noone;
switch(group.inputs[| 0].type) { switch(group.inputs[| 0].type) {
case VALUE_TYPE.surface : case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurface : case VALUE_TYPE.dynaSurface :

View file

@ -24,6 +24,8 @@ function Node_PB_Box_Contract(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _gro
] ]
static step = function() { static step = function() {
if(array_empty(current_data)) return;
var _typ = current_data[2]; var _typ = current_data[2];
var _axs = current_data[5]; var _axs = current_data[5];

View file

@ -31,6 +31,8 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
] ]
static step = function() { static step = function() {
if(array_empty(current_data)) return;
var _type = current_data[3]; var _type = current_data[3];
inputs[| 2].setVisible(_type == 0); inputs[| 2].setVisible(_type == 0);

View file

@ -26,6 +26,8 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
] ]
static step = function() { static step = function() {
if(array_empty(current_data)) return noone;
var _typ = current_data[2]; var _typ = current_data[2];
var _axs = current_data[5]; var _axs = current_data[5];

View file

@ -25,6 +25,8 @@ function Node_PB_Draw_Trapezoid(_x, _y, _group = noone) : Node_PB_Draw(_x, _y, _
]; ];
static step = function() { static step = function() {
if(array_empty(current_data)) return;
var _type = current_data[4]; var _type = current_data[4];
inputs[| 5].setVisible(_type == 0); inputs[| 5].setVisible(_type == 0);

View file

@ -19,6 +19,8 @@ function Node_PB_Fx_Stack(_x, _y, _group = noone) : Node_PB_Fx(_x, _y, _group) c
]; ];
static step = function() { static step = function() {
if(array_empty(current_data)) return;
var _high = current_data[4]; var _high = current_data[4];
inputs[| 5].setVisible(_high); inputs[| 5].setVisible(_high);

View file

@ -9,8 +9,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
update_on_frame = true; update_on_frame = true;
inputs[| 0] = nodeValue("Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF) inputs[| 0] = nodeValue("Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector) .setDisplay(VALUE_DISPLAY.vector);
.rejectArray();
inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
@ -78,14 +77,6 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
} #endregion } #endregion
static step = function() { #region
var _dim = getInputData(0);
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
} #endregion
static update = function(frame = CURRENT_FRAME) { #region static update = function(frame = CURRENT_FRAME) { #region
if(recoverCache() || !PROJECT.animator.is_playing) if(recoverCache() || !PROJECT.animator.is_playing)
return; return;

View file

@ -96,14 +96,6 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
} }
} #endregion } #endregion
static step = function() { #region
var _dim = getInputData(0);
var _outSurf = outParent.getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outParent.setValue(_outSurf);
} #endregion
static update = function(frame = CURRENT_FRAME) { #region static update = function(frame = CURRENT_FRAME) { #region
if(!is_instanceof(outParent, NodeValue)) return noone; if(!is_instanceof(outParent, NodeValue)) return noone;

View file

@ -77,7 +77,7 @@ function __sortNode(_list, _node) { #region
for( var i = 0, n = array_length(_prev); i < n; i++ ) { for( var i = 0, n = array_length(_prev); i < n; i++ ) {
var _in = _prev[i]; var _in = _prev[i];
if(_in.topoSorted) continue; if(_in == noone || _in.topoSorted) continue;
array_push(_childs, _in); array_push(_childs, _in);
} }