diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-30 14:04:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-30 14:04:48 +0300 |
commit | 2142288eae7322b923e0369c07d5013d9a160774 (patch) | |
tree | afe606e541dc9102fc468ccb12ca9470672ba6a3 /source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc | |
parent | 543685fe3d62841a12c1b86ccb1cf419d8752b67 (diff) | |
parent | 87b551e8365954d03d1c27303b9776deefd4e4d3 (diff) |
Merge remote-tracking branch 'origin/blender-v2.82-release'
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 55c14fc9b2d..12cd6936a13 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -193,6 +193,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 */ @@ -245,6 +248,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 = nullptr; + 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 == nullptr) { + 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 */ |