Depsgraph: Move scene evaluation node to own component

This node is needed to ensure evaluation order of scene and modifiers
which might access scene for custom data masks, or for the current
frame.

Move it to own component, so that evaluation of scene does not lead
to changes in the parameters component, hence does not trigger
driver evaluation.

Should be no functional changes.

Ref #117335
This commit is contained in:
Sergey Sharybin
2024-01-19 14:38:53 +01:00
committed by Sergey Sharybin
parent dfc220622c
commit 85ff988f99
9 changed files with 18 additions and 4 deletions
@@ -53,7 +53,9 @@ void DepsgraphNodeBuilder::build_scene_parameters(Scene *scene)
}
build_parameters(&scene->id);
build_idproperties(scene->id.properties);
add_operation_node(&scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
add_operation_node(&scene->id, NodeType::SCENE, OperationCode::SCENE_EVAL);
/* NOTE: This is a bit overkill and can potentially pull a bit too much into the graph, but:
*
* - We definitely need an ID node for the scene's compositor, otherwise re-mapping will no
@@ -2489,7 +2489,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
/* Special case: modifiers evaluation queries scene for various things like
* data mask to be used. We add relation here to ensure object is never
* evaluated prior to Scene's CoW is ready. */
OperationKey scene_key(&scene_->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
ComponentKey scene_key(&scene_->id, NodeType::SCENE);
add_relation(scene_key, obdata_ubereval_key, "CoW Relation", RELATION_FLAG_NO_FLUSH);
/* Relation to the instance, so that instancer can use geometry of this object. */
add_relation(ComponentKey(&object->id, NodeType::GEOMETRY),
@@ -56,7 +56,7 @@ void DepsgraphRelationBuilder::build_scene_parameters(Scene *scene)
build_parameters(&scene->id);
OperationKey parameters_eval_key(
&scene->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
OperationKey scene_eval_key(&scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
ComponentKey scene_eval_key(&scene->id, NodeType::SCENE);
add_relation(parameters_eval_key, scene_eval_key, "Parameters -> Scene Eval");
LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
@@ -154,7 +154,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene,
/* Make final scene evaluation dependent on view layer evaluation. */
OperationKey scene_view_layer_key(
&scene->id, NodeType::LAYER_COLLECTIONS, OperationCode::VIEW_LAYER_EVAL);
OperationKey scene_eval_key(&scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
ComponentKey scene_eval_key(&scene->id, NodeType::SCENE);
add_relation(scene_view_layer_key, scene_eval_key, "View Layer -> Scene Eval");
/* Sequencer. */
if (linked_state == DEG_ID_LINKED_DIRECTLY) {
@@ -412,6 +412,7 @@ static void deg_debug_graphviz_node(DotExportContext &ctx,
case NodeType::AUDIO:
case NodeType::ARMATURE:
case NodeType::GENERIC_DATABLOCK:
case NodeType::SCENE:
case NodeType::VISIBILITY:
case NodeType::NTREE_OUTPUT:
case NodeType::NTREE_GEOMETRY_PREPROCESS: {
@@ -97,6 +97,8 @@ const char *nodeTypeAsString(NodeType type)
return "ARMATURE";
case NodeType::GENERIC_DATABLOCK:
return "GENERIC_DATABLOCK";
case NodeType::SCENE:
return "SCENE";
case NodeType::VISIBILITY:
return "VISIBILITY";
case NodeType::NTREE_OUTPUT:
@@ -145,6 +147,7 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type)
case NodeType::AUDIO:
case NodeType::ARMATURE:
case NodeType::GENERIC_DATABLOCK:
case NodeType::SCENE:
case NodeType::PARTICLE_SYSTEM:
case NodeType::PARTICLE_SETTINGS:
case NodeType::POINT_CACHE:
@@ -228,6 +231,7 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type)
case NodeType::AUDIO:
case NodeType::ARMATURE:
case NodeType::GENERIC_DATABLOCK:
case NodeType::SCENE:
case NodeType::PARTICLE_SYSTEM:
case NodeType::PARTICLE_SETTINGS:
case NodeType::POINT_CACHE:
@@ -87,6 +87,10 @@ enum class NodeType {
* not have very distinctive update procedure. */
GENERIC_DATABLOCK,
/* Scene evaluation, for dependencies to other evaluation which might require accumulated custom
* data masks. */
SCENE,
/* Component which is used to define visibility relation between IDs, on the ID level.
*
* Consider two ID nodes NodeA and NodeB, with the relation between visibility components going
@@ -338,6 +338,7 @@ DEG_COMPONENT_NODE_DEFINE(Synchronization, SYNCHRONIZATION, 0);
DEG_COMPONENT_NODE_DEFINE(Audio, AUDIO, 0);
DEG_COMPONENT_NODE_DEFINE(Armature, ARMATURE, 0);
DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0);
DEG_COMPONENT_NODE_DEFINE(Scene, SCENE, 0);
DEG_COMPONENT_NODE_DEFINE(Visibility, VISIBILITY, 0);
DEG_COMPONENT_NODE_DEFINE(NTreeOutput, NTREE_OUTPUT, ID_RECALC_NTREE_OUTPUT);
DEG_COMPONENT_NODE_DEFINE(NTreeGeometryPreprocess, NTREE_GEOMETRY_PREPROCESS, 0);
@@ -373,6 +374,7 @@ void deg_register_component_depsnodes()
register_node_typeinfo(&DNTI_AUDIO);
register_node_typeinfo(&DNTI_ARMATURE);
register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
register_node_typeinfo(&DNTI_SCENE);
register_node_typeinfo(&DNTI_VISIBILITY);
register_node_typeinfo(&DNTI_NTREE_OUTPUT);
register_node_typeinfo(&DNTI_NTREE_GEOMETRY_PREPROCESS);
@@ -207,6 +207,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronization);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Audio);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Armature);
DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Scene);
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(Visibility);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Simulation);
DEG_COMPONENT_NODE_DECLARE_GENERIC(NTreeOutput);