Update subgraph rendering for loop, collection

This commit is contained in:
Tanasart 2023-11-19 20:28:50 +07:00
parent 8e9b2b61dc
commit 8e0d66afd3
8 changed files with 24 additions and 19 deletions

View file

@ -65,7 +65,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
D3D_GLOBAL_PREVIEW.camera.resetCamera();
} #endregion
static postUpdate = function() { refreshPreview(); }
static postProcess = function() { refreshPreview(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
if(!is_surface(mesh_prev_surface)) return;

View file

@ -50,6 +50,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from Loop output");
var _nodes = [];
for( var i = 0; i < ds_list_size(nodes); i++ ) { // check if every node is updated
if(!nodes[| i].rendered) {
LOG_IF(global.FLAG.render == 1, $"Skipped due to node {nodes[| i].internalName} not rendered.");

View file

@ -89,7 +89,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
input_dummy = nodeValue("Add to group", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0);
draw_dummy = false;
input_dummy.onSetFrom = function(juncFrom) {
input_dummy.onSetFrom = function(juncFrom) { #region
ds_list_remove(juncFrom.value_to, input_dummy);
input_dummy.value_from = noone;
@ -104,7 +104,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
input.inParent.setFrom(juncFrom);
if(onNewInputFromGraph != noone) onNewInputFromGraph(juncFrom);
}
} #endregion
onNewInputFromGraph = noone;
@ -292,6 +292,15 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
LOG_BLOCK_END();
} #endregion
static isActiveDynamic = function(frame = CURRENT_FRAME) { #region
if(update_on_frame) return true;
for( var i = 0, n = ds_list_size(inputs); i < n; i++ )
if(inputs[| i].isActiveDynamic(frame) || !inputs[| i].from.rendered) return true;
return false;
} #endregion
static exitGroup = function() {}
static add = function(_node) { #region
@ -345,8 +354,6 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static onStep = function() {}
PATCH_STATIC
static onPreDraw = function(_x, _y, _s, _iny, _outy) { #region
var xx = x * _s + _x;
var yy = y * _s + _y;

View file

@ -526,7 +526,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
doUpdate();
} #endregion
static postupdate = function(frame = CURRENT_FRAME) {}
static postUpdate = function(frame = CURRENT_FRAME) {}
static doUpdate = function(frame = CURRENT_FRAME) { #region
if(PROJECT.safeMode) return;
@ -559,7 +559,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
}
}
postupdate(frame);
postUpdate(frame);
cached_manual = false;
if(!use_cache && PROJECT.onion_skin.enabled) {

View file

@ -1,9 +1,10 @@
function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Group Output";
destroy_when_upgroup = true;
color = COLORS.node_blend_collection;
previewable = false;
destroy_when_upgroup = true;
attributes.input_priority = 0;
if(!CLONING && !LOADING && !APPENDING && group != noone) attributes.input_priority = group.getOutputFreeOrder();
@ -16,7 +17,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
.setVisible(true, true);
attributes.inherit_name = !LOADING && !APPENDING;
outParent = undefined;
outParent = undefined;
output_index = -1;
_onSetDisplayName = function() { attributes.inherit_name = false; }
@ -140,10 +141,4 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
} #endregion
//static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
// var bbox = drawGetBbox(xx, yy, _s);
// draw_set_text(f_h5, fa_center, fa_center, c_white);
// draw_text(bbox.xc, bbox.yc, attributes.input_priority);
//} #endregion
}

View file

@ -330,10 +330,10 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
else processOutput();
processData_postbatch();
postUpdate();
postProcess();
} #endregion
static postUpdate = function() {}
static postProcess = function() {}
static processSerialize = function(_map) { #region
_map.array_process = attributes.array_process;

View file

@ -70,7 +70,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
update_on_frame = grup == 0;
} #endregion
static postupdate = function(frame = CURRENT_FRAME) {
static postProcess = function(frame = CURRENT_FRAME) {
if(LAST_FRAME) array_remove(RENDERING, node_id);
}

View file

@ -140,7 +140,9 @@ function __nodeIsRenderLeaf(_node) { #region
if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update [{_node.internalName}]"); return false; }
if(_node.passiveDynamic) { _node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); return false; }
if(_node.rendered && !_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); return false; }
if((_node.rendered || (is_instanceof(_node, Node_Collection) && !_node.managedRenderOrder)) && !_node.isActiveDynamic())
{ LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); return false; }
return true;
} #endregion