Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-10-06 18:49:57 +0300
committerJeroen Bakker <jeroen@blender.org>2020-10-07 11:15:56 +0300
commit3f2b1f1b667d00494b01ed4b9d65196f45eb75d3 (patch)
treea5f7826e694d90da22f6000c6a109cbce6059a49
parentf7c5296f1d918b94255f50a15a984978c46bf81e (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
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 4fb893b350c..182404a848b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1453,6 +1453,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
* which will affect the evaluation of corresponding pose bones. */
Bone *bone = (Bone *)property_entry_key.ptr.data;
if (bone != nullptr) {
+ 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) {
@@ -1462,8 +1465,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
if (object->data == id_ptr && object->pose != nullptr) {
bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name);
if (pchan != nullptr) {
- 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");
}
}