[Bf-blender-cvs] [a57fec986d2] master: Depsgraph: fix dependencies for drivers and animation on Bone properties.

Sergey Sharybin noreply at git.blender.org
Mon Apr 29 12:35:35 CEST 2019


Commit: a57fec986d2d7093fc8148188315274e4f150857
Author: Sergey Sharybin
Date:   Sun Apr 28 20:04:55 2019 +0300
Branches: master
https://developer.blender.org/rBa57fec986d2d7093fc8148188315274e4f150857

Depsgraph: fix dependencies for drivers and animation on Bone properties.

The driver code was almost there, but didn't work because ID nodes
have no outlinks - and using links won't be safe anyway because of
ordering issues. Instead, just loop over all IDNodes.

Animation is fixed simply by referring to ARMATURE_EVAL instead of
BONE in construct_node_identifier - the bArmature ID doesn't have
BONE components in any case, so the old identifier can't work.

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

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

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 23856a59da3..9ea41e54a59 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1336,25 +1336,24 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
                           fcu->rna_path ? fcu->rna_path : "",
                           fcu->array_index);
   const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
-  if (GS(id->name) == ID_AR && strstr(rna_path, "bones[")) {
+  if (GS(id->name) == ID_AR && STRPREFIX(rna_path, "bones[")) {
     /* Drivers on armature-level bone settings (i.e. bbone stuff),
      * which will affect the evaluation of corresponding pose bones. */
-    IDNode *arm_node = graph_->find_id_node(id);
     char *bone_name = BLI_str_quoted_substrN(rna_path, "bones[");
-    if (arm_node != NULL && bone_name != NULL) {
+    if (bone_name != NULL) {
       /* Find objects which use this, and make their eval callbacks
        * depend on this. */
-      for (Relation *rel : arm_node->outlinks) {
-        IDNode *to_node = (IDNode *)rel->to;
-        /* We only care about objects with pose data which use this. */
+      for (IDNode *to_node : graph_->id_nodes) {
         if (GS(to_node->id_orig->name) == ID_OB) {
           Object *object = (Object *)to_node->id_orig;
-          // NOTE: object->pose may be NULL
-          bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone_name);
-          if (pchan != NULL) {
-            OperationKey bone_key(
-                &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
-            add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
+          /* We only care about objects with pose data which use this. */
+          if (object->data == id && object->pose != NULL) {
+            bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone_name);
+            if (pchan != NULL) {
+              OperationKey bone_key(
+                  &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
+              add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
+            }
           }
         }
       }
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index 810d3ee3f66..27899abc972 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -202,12 +202,11 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
     return node_identifier;
   }
   else if (ptr->type == &RNA_Bone) {
-    const Bone *bone = static_cast<const Bone *>(ptr->data);
-    /* Armature-level bone, but it ends up going to bone component
-     * anyway. */
-    // NOTE: the ID in this case will end up being bArmature.
-    node_identifier.type = NodeType::BONE;
-    node_identifier.component_name = bone->name;
+    /* Armature-level bone mapped to Armature Eval, and thus Pose Init.
+     * Drivers have special code elsewhere that links them to the pose
+     * bone components, instead of using this generic code. */
+    node_identifier.type = NodeType::PARAMETERS;
+    node_identifier.operation_code = OperationCode::ARMATURE_EVAL;
     return node_identifier;
   }
   else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {



More information about the Bf-blender-cvs mailing list