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 <sergey@blender.org>"
This commit is contained in:
Hans Goudey 2023-10-30 10:34:09 +01:00
parent e9ad267151
commit ccfe952f34
3 changed files with 4 additions and 4 deletions

@ -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);

@ -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);

@ -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);
}
}