diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-10-06 18:49:57 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-10-06 18:49:57 +0300 |
commit | d43e3f34d26daca4f2b0f4c524a35a98cc85d1ce (patch) | |
tree | de734e384142dabc1c0b6d77b314507ed2370e90 /source/blender/depsgraph/intern | |
parent | a2b184235892650102f1766015961a959518a9a1 (diff) |
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
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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. */ |