[Bf-blender-cvs] [d43e3f34d26] master: Fix T81218: Crash in pose mode using a driver on bendy bone Segment

Sybren A. Stüvel noreply at git.blender.org
Tue Oct 6 17:55:38 CEST 2020


Commit: d43e3f34d26daca4f2b0f4c524a35a98cc85d1ce
Author: Sybren A. Stüvel
Date:   Tue Oct 6 17:49:57 2020 +0200
Branches: master
https://developer.blender.org/rBd43e3f34d26daca4f2b0f4c524a35a98cc85d1ce

Fix T81218: Crash in pose mode using a driver on bendy bone Segment

The example file in T81218 has a driver that maps a bone's X-location to
the number of BBone segments. This caused a dependency cycle, which
resulted in bad thread serialisation, which caused the crash.

This patch breaks the dependency cycle `BONE_LOCAL` →
`DRIVER(bones["Bone"].bbone_segments)` → `BONE_LOCAL`. The 'Driver Data'
relation now points to `BONE_SEGMENTS` when the driven property starts
with `bbone_`.

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

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

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

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 26839c67324..c0630cd47c6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1489,6 +1489,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
       return;
     }
 
+    const char *prop_identifier = RNA_property_identifier(property_entry_key.prop);
+    const bool driver_targets_bbone = STRPREFIX(prop_identifier, "bbone_");
+
     /* Find objects which use this, and make their eval callbacks depend on this. */
     for (IDNode *to_node : graph_->id_nodes) {
       if (GS(to_node->id_orig->name) != ID_OB) {
@@ -1506,7 +1509,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
         continue;
       }
 
-      OperationKey bone_key(&object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
+      OperationCode target_op = driver_targets_bbone ? OperationCode::BONE_SEGMENTS :
+                                                       OperationCode::BONE_LOCAL;
+      OperationKey bone_key(&object->id, NodeType::BONE, pchan->name, target_op);
       add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
     }
     /* Make the driver depend on COW, similar to the generic case below. */



More information about the Bf-blender-cvs mailing list