diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 16:10:43 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-30 13:59:50 +0300 |
commit | 87b551e8365954d03d1c27303b9776deefd4e4d3 (patch) | |
tree | 2417b1bbf4737c05b119e432c7cd70ce57303ea9 /source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc | |
parent | 5a570be9f500d495535639cbd1363c1423084790 (diff) |
Fix T73051: Multiple IK chains influencing the same bone don't work
This patch fixes {T73051}. The cause of the issue was the absence of
relations in the depsgraph between IK solvers of overlapping IK chains.
Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D6700
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index e254f8df0d2..4a86b16627c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -192,6 +192,9 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, } OperationKey pose_done_key(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE); add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link"); + + /* Add relation when the root of this IK chain is influenced by another IK chain. */ + build_inter_ik_chains(object, solver_key, rootchan, root_map); } /* Spline IK Eval Steps */ @@ -244,6 +247,33 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, } OperationKey pose_done_key(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE); add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link"); + + /* Add relation when the root of this IK chain is influenced by another IK chain. */ + build_inter_ik_chains(object, solver_key, rootchan, root_map); +} + +void DepsgraphRelationBuilder::build_inter_ik_chains(Object *object, + const OperationKey &solver_key, + const bPoseChannel *rootchan, + const RootPChanMap *root_map) +{ + bPoseChannel *deepest_root = NULL; + const char *root_name = rootchan->name; + + /* Find shared IK chain root. */ + for (bPoseChannel *parchan = rootchan->parent; parchan; parchan = parchan->parent) { + if (!root_map->has_common_root(root_name, parchan->name)) { + break; + } + deepest_root = parchan; + } + if (deepest_root == NULL) { + return; + } + + OperationKey other_bone_key( + &object->id, NodeType::BONE, deepest_root->name, OperationCode::BONE_DONE); + add_relation(other_bone_key, solver_key, "IK Chain Overlap"); } /* Pose/Armature Bones Graph */ |