Merge remote-tracking branch 'origin/blender-v2.82-release'
authorSybren A. Stüvel <sybren@blender.org>
Thu, 30 Jan 2020 11:04:13 +0000 (12:04 +0100)
committerSybren A. Stüvel <sybren@blender.org>
Thu, 30 Jan 2020 11:04:48 +0000 (12:04 +0100)
1  2 
source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc

index 55c14fc9b2df3e09695ba900903fc07c5646e82d,4a86b16627c03a89b19d304775594de4db941ebc..12cd6936a132100e3d73ae8be5b46dc1cf2ad022
@@@ -245,6 -247,33 +248,33 @@@ void DepsgraphRelationBuilder::build_sp
    }
    OperationKey pose_done_key(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE);
    add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link");
 -  bPoseChannel *deepest_root = NULL;
+   /* 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)
+ {
 -  if (deepest_root == NULL) {
++  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 */