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:
authorJoseph Brandenburg <TheAngerSpecialist>2020-10-27 14:03:44 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-10-27 14:03:49 +0300
commit4846342b95cd3a8c12250f742f64c844dbe10c73 (patch)
tree9123803afad3d6744f3825de5a9ad66a9715a9d3
parent4b188bb08cf5aaae3c68ab57bbcfa037eef1ac10 (diff)
Negate Shear in Copy Rotationtemp-D8915-copy-rotation-remove-sheer
This patch negates the effects of shear in the Copy Rotation constraint, which causes incorrect results and even flipping on rare occasions. Here is the bug report associated with the issue: T80970 This bug report has an example of the problem in a .blend file. This patch will change existing .blend files if a copy rotation constraint is used with a target that has shearing -- instead of pointing in the "wrong" direction (due to the shear), the constrained object will copy the final rotation of the target, with the shearing applied. Proposed Solution: Correct the matrix of the constraint target for shear. Limitations of proposed solution: - It's conceivable that someone has used the "incorrect behaviour" in a rig... although I doubt this. It may be necessary to create an "allow shear" checkbox that is disabled by default to maintain the legacy behaviour. No UI changes are needed for this patch :) Differential Revision: https://developer.blender.org/D8915
-rw-r--r--source/blender/blenkernel/intern/constraint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 274546132fb..19e418aaa15 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1814,6 +1814,10 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
if (VALID_CONS_TARGET(ct)) {
float loc[3], size[3], oldrot[3][3], newrot[3][3];
float eul[3], obeul[3], defeul[3];
+ float mat[4][4];
+
+ copy_m4_m4(mat, ct->matrix);
+ orthogonalize_m4_stable(mat, 1, true);
mat4_to_loc_rot_size(loc, oldrot, size, cob->matrix);
@@ -1828,7 +1832,7 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
mat4_to_eulO(obeul, rot_order, cob->matrix);
/* We must get compatible eulers from the beginning because
* some of them can be modified below (see bug T21875). */
- mat4_to_compatible_eulO(eul, obeul, rot_order, ct->matrix);
+ mat4_to_compatible_eulO(eul, obeul, rot_order, mat);
/* Prepare the copied euler rotation. */
bool legacy_offset = false;