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-01-30 14:04:13 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-01-30 14:04:48 +0300
commit2142288eae7322b923e0369c07d5013d9a160774 (patch)
treeafe606e541dc9102fc468ccb12ca9470672ba6a3 /source/blender/depsgraph
parent543685fe3d62841a12c1b86ccb1cf419d8752b67 (diff)
parent87b551e8365954d03d1c27303b9776deefd4e4d3 (diff)
Merge remote-tracking branch 'origin/blender-v2.82-release'
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h4
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc30
4 files changed, 36 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
index 61c23becfda..5483ff9c030 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
@@ -91,7 +91,7 @@ void RootPChanMap::add_bone(const char *bone, const char *root)
}
/* Check if there's a common root bone between two bones. */
-bool RootPChanMap::has_common_root(const char *bone1, const char *bone2)
+bool RootPChanMap::has_common_root(const char *bone1, const char *bone2) const
{
/* Ensure that both are in the map... */
if (BLI_ghash_haskey(map_, bone1) == false) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
index 0c1d22f9345..1442f547b08 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
@@ -39,7 +39,7 @@ struct RootPChanMap {
void add_bone(const char *bone, const char *root);
/* Check if there's a common root bone between two bones. */
- bool has_common_root(const char *bone1, const char *bone2);
+ bool has_common_root(const char *bone1, const char *bone2) const;
protected:
/* The actual map:
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index ed656354e30..11eb31c68f6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -257,6 +257,10 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
bPoseChannel *pchan,
bConstraint *con,
RootPChanMap *root_map);
+ virtual void build_inter_ik_chains(Object *object,
+ const OperationKey &solver_key,
+ const bPoseChannel *rootchan,
+ const RootPChanMap *root_map);
virtual void build_rig(Object *object);
virtual void build_proxy_rig(Object *object);
virtual void build_shapekeys(Key *key);
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 */