From ccfe952f3455d4328ade1bb24d948a167a183f28 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 30 Oct 2023 10:34:09 +0100 Subject: [PATCH] Depsgraph: Hard-code visibility for "from IDs" builder `FromIDsBuilderPipeline` is used to build a minimal depsgraph from a set of IDs. However, the "visibility" of those IDs is still calculated based on things like the view layer and the relations. Typically we want all of these to be visible, the builder just happened to be used in cases when all of the IDs were already visible so far. This is needed for node tools which may reference objects or other IDs from outside of the active depsgraph. Co-authored by: "Sergey Sharybin " --- source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 4 ++-- source/blender/depsgraph/intern/builder/deg_builder_nodes.h | 2 +- source/blender/depsgraph/intern/builder/pipeline_from_ids.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index bd5af4d3d48..ba255e7e4fb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -544,7 +544,7 @@ void DepsgraphNodeBuilder::end_build() update_invalid_cow_pointers(); } -void DepsgraphNodeBuilder::build_id(ID *id) +void DepsgraphNodeBuilder::build_id(ID *id, const bool force_be_visible) { if (id == nullptr) { return; @@ -575,7 +575,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) * If this happened to be affecting visible object, then it is up to * deg_graph_build_flush_visibility() to ensure visibility of the * object is true. */ - build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); + build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, force_be_visible); break; case ID_KE: build_shapekeys((Key *)id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index d97db3c380e..e391a8b4162 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -156,7 +156,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { OperationNode *find_operation_node(const OperationKey &key); - virtual void build_id(ID *id); + virtual void build_id(ID *id, bool force_be_visible = false); /* Build function for ID types that do not need their own build_xxx() function. */ virtual void build_generic_id(ID *id); diff --git a/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc b/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc index b3744186699..9b055811c32 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc @@ -96,7 +96,7 @@ void FromIDsBuilderPipeline::build_nodes(DepsgraphNodeBuilder &node_builder) { node_builder.build_view_layer(scene_, view_layer_, DEG_ID_LINKED_DIRECTLY); for (ID *id : ids_) { - node_builder.build_id(id); + node_builder.build_id(id, true); } }