[Bf-blender-cvs] [2f729bc1117] master: Fix T98525: depsgraph for indirectly referenced ID Properties in drivers.

Alexander Gavrilov noreply at git.blender.org
Wed Aug 31 18:00:53 CEST 2022


Commit: 2f729bc1117cddd809a8545ae7f4dd424e689dbc
Author: Alexander Gavrilov
Date:   Wed Jun 29 19:03:46 2022 +0300
Branches: master
https://developer.blender.org/rB2f729bc1117cddd809a8545ae7f4dd424e689dbc

Fix T98525: depsgraph for indirectly referenced ID Properties in drivers.

If the RNA path of a Single Property variable goes through a pointer
to a different ID, the property should be attached to that ID using
the owner reference in the RNA pointer. This already happened when
building some, but not all of the relations and nodes.

This patch fixes the remaining cases.

Differential Revision: https://developer.blender.org/D15323

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index dd62a6cdea2..d25adc279d7 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1219,11 +1219,11 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *rna_path
   if (RNA_struct_is_a(ptr.type, &RNA_PoseBone)) {
     const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr.data);
     ensure_operation_node(
-        id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, nullptr, prop_identifier);
+        ptr.owner_id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, nullptr, prop_identifier);
   }
   else {
     ensure_operation_node(
-        id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, prop_identifier);
+        ptr.owner_id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, prop_identifier);
   }
 }
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 730096e3110..313d4996dcf 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1865,18 +1865,20 @@ void DepsgraphRelationBuilder::build_driver_id_property(ID *id, const char *rna_
   if (RNA_struct_is_a(ptr.type, &RNA_PoseBone)) {
     const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr.data);
     id_property_key = OperationKey(
-        id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, prop_identifier);
+        ptr.owner_id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, prop_identifier);
     /* Create relation from the parameters component so that tagging armature for parameters update
      * properly propagates updates to all properties on bones and deeper (if needed). */
-    OperationKey parameters_init_key(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
+    OperationKey parameters_init_key(
+        ptr.owner_id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
     add_relation(
         parameters_init_key, id_property_key, "Init -> ID Property", RELATION_CHECK_BEFORE_ADD);
   }
   else {
     id_property_key = OperationKey(
-        id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, prop_identifier);
+        ptr.owner_id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, prop_identifier);
   }
-  OperationKey parameters_exit_key(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
+  OperationKey parameters_exit_key(
+      ptr.owner_id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
   add_relation(
       id_property_key, parameters_exit_key, "ID Property -> Done", RELATION_CHECK_BEFORE_ADD);
 }



More information about the Bf-blender-cvs mailing list