1
1

Compare commits

...

2 Commits

Author SHA1 Message Date
9f31b33f8e Print function for new depsgraph nodes for debug. 2021-08-01 20:50:07 +01:00
0895eef4fb Add a read-only flag to indicate depsgraph update.
The NODE_DEPSGRAPH_UPDATED flag indicates that a node has triggered a
depsgraph update. This can be accessed in a depsgraph "pre" handler
to find nodes which have changed through user actions.
The depsgraph clears this flag for the next update.
2021-08-01 19:21:36 +01:00
7 changed files with 26 additions and 0 deletions

View File

@@ -4500,6 +4500,7 @@ void nodeUpdate(bNodeTree *ntree, bNode *node)
}
ntree->is_updating = true;
node->flag |= NODE_DEPSGRAPH_UPDATED;
if (node->typeinfo->updatefunc) {
node->typeinfo->updatefunc(ntree, node);
}

View File

@@ -1711,6 +1711,14 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
/* General parameters. */
build_parameters(&ntree->id);
build_idproperties(ntree->id.properties);
add_operation_node(&ntree->id,
NodeType::PARAMETERS,
OperationCode::NODETREE_UPDATE,
[ntree](::Depsgraph *depsgraph) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
node->flag &= ~NODE_DEPSGRAPH_UPDATED;
}
});
/* Animation, */
build_animdata(&ntree->id);
/* Shading update. */

View File

@@ -204,6 +204,9 @@ const char *operationCodeAsString(OperationCode opcode)
return "DUPLI";
case OperationCode::SIMULATION_EVAL:
return "SIMULATION_EVAL";
/* Node tree*/
case OperationCode::NODETREE_UPDATE:
return "NODETREE_UPDATE";
}
BLI_assert_msg(0, "Unhandled operation code, should never happen.");
return "UNKNOWN";

View File

@@ -206,6 +206,9 @@ enum class OperationCode {
/* Simulation. ---------------------------------------------------------- */
SIMULATION_EVAL,
/* Nodes. --------------------------------------------------------------- */
NODETREE_UPDATE,
};
const char *operationCodeAsString(OperationCode opcode);

View File

@@ -177,6 +177,8 @@ void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree, bNode *node)
if (!node_connected_to_output(bmain, ntree, node)) {
do_tag_update = false;
}
node->flag |= NODE_DEPSGRAPH_UPDATED;
}
/* Look through all datablocks to support groups. */

View File

@@ -361,6 +361,9 @@ typedef struct bNode {
/* A preview for the data in this node can be displayed in the spreadsheet editor. */
#define __NODE_ACTIVE_PREVIEW (1 << 18) /* deprecated */
/* Read-only flag to indicate that changes to the node have triggered a depsgraph update. */
#define NODE_DEPSGRAPH_UPDATED (1 << 19)
/* node->update */
/* XXX NODE_UPDATE is a generic update flag. More fine-grained updates
* might be used in the future, but currently all work the same way.

View File

@@ -11483,6 +11483,12 @@ static void rna_def_node(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "depsgraph_updated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DEPSGRAPH_UPDATED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
RNA_def_property_ui_text(prop, "Depsgraph Updated", "Changes to the node have triggered a depsgraph update");
/* generic property update function */
func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
RNA_def_function_ui_description(func, "Update after property changes");