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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-09-17 19:22:42 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-21 10:42:27 +0300
commit41e40793650aa23ad525c395706eae15ec82bff9 (patch)
tree96b8844cc7ec1dc26ec9d73d257ac5c133d2e4b4
parenta5b6d6de0a2b3cec82cd914d58d0c435dace55b0 (diff)
Fix T80437: Auto IK Double Generates IK constraints
Caused by rB9a7f5f1bb422. If using Auto IK (or targetless IK and Auto IK together), two temporary constraints were added. - from pose_grab_with_ik_add (even for targetless IK) - from add_pose_transdata (even for Auto IK) Since both both do similar things, but cannot work in tandem (with possibly different chainlengths for example), we have to decide which type to prefer over the other (as in: do not create a constraint for the other). It seems better to ignore the 'Auto IK' option on bones that will have targetless IK set up for them specificallly [e.g. defining special chainlength]. This way you can still work with 'Auto IK' ON generally [with interactive chainlength control], but also have specific bones that need their own custom chainlength. For now, the most straightforward fix is to - only add constraints for Auto IK from pose_grab_with_ik_add() - only add constraints for targetless IK from add_pose_transdata() Note: this area has some potential for later refactoring: - move creation of all temporary constraints to a single place [preferably pose_grab_with_ik_add] - use only those temporary constraints in transform code [atm. we still flip CONSTRAINT_IK_AUTO around on the "original" -- unneccesarily, after rB9a7f5f1bb422 a dedicated temporary constraint is now always available] - clarify CONSTRAINT_IK_AUTO vs. CONSTRAINT_IK_TEMP - obeying standard rotation locks on bones in the chain (not just the the IK locks) is not consistent between targetless IK and Auto IK Potential candidate for 2.90.1 as well as 2.83 LTS Maniphest Tasks: T80437 Differential Revision: https://developer.blender.org/D8930
-rw-r--r--source/blender/editors/transform/transform_convert_armature.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c
index 9885c8fc3a6..5cc6a62894d 100644
--- a/source/blender/editors/transform/transform_convert_armature.c
+++ b/source/blender/editors/transform/transform_convert_armature.c
@@ -349,6 +349,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
}
}
}
+
+ /* Return early (as in: don't actually create a temporary constraint here), since adding
+ * will take place later in add_pose_transdata() for targetless constraints. */
+ return 0;
}
}
@@ -702,10 +706,14 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* Add a temporary auto IK constraint here, as we will only temporarily active this
* targetless bone during transform. (Targetless IK constraints are treated as if they are
- * disabled unless they are transformed). */
- add_temporary_ik_constraint(pchan, data);
- Main *bmain = CTX_data_main(t->context);
- update_deg_with_temporary_ik(bmain, ob);
+ * disabled unless they are transformed).
+ * Only do this for targetless IK though, AutoIK already added a constraint in
+ * pose_grab_with_ik_add() beforehand. */
+ if ((data->flag & CONSTRAINT_IK_TEMP) == 0) {
+ add_temporary_ik_constraint(pchan, data);
+ Main *bmain = CTX_data_main(t->context);
+ update_deg_with_temporary_ik(bmain, ob);
+ }
/* only object matrix correction */
copy_m3_m3(td->mtx, omat);
@@ -1350,10 +1358,14 @@ static void pose_transform_mirror_update(TransInfo *t, TransDataContainer *tc, O
data->flag |= CONSTRAINT_IK_AUTO;
/* Add a temporary auto IK constraint here, as we will only temporarily active this
* target-less bone during transform. (Target-less IK constraints are treated as if they are
- * disabled unless they are transformed) */
- add_temporary_ik_constraint(pchan, data);
- Main *bmain = CTX_data_main(t->context);
- update_deg_with_temporary_ik(bmain, ob);
+ * disabled unless they are transformed).
+ * Only do this for targetless IK though, AutoIK already added a constraint in
+ * pose_grab_with_ik_add() beforehand. */
+ if ((data->flag & CONSTRAINT_IK_TEMP) == 0) {
+ add_temporary_ik_constraint(pchan, data);
+ Main *bmain = CTX_data_main(t->context);
+ update_deg_with_temporary_ik(bmain, ob);
+ }
}
if (pid) {