[Bf-blender-cvs] [f7c78b1c7c1] temp-T81218-bbone-segments-driver-crash: 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 16:51:03 CEST 2020


Commit: f7c78b1c7c1f6aceeb5e63e73e1ef9d841e9e2df
Author: Sybren A. Stüvel
Date:   Tue Oct 6 13:51:30 2020 +0200
Branches: temp-T81218-bbone-segments-driver-crash
https://developer.blender.org/rBf7c78b1c7c1f6aceeb5e63e73e1ef9d841e9e2df

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