From 61fe88aedc27759bcf8abcaa862dfb2cc9164081 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 11 Jun 2012 05:05:05 +0000 Subject: Bugfix [#27886] Transform constraint maps wrongly with negative scale AFAIK, it is impossible to determine exactly which axes may have negative scaling values from a 4x4 matrix (which is the underlying cause of this bug). However, we can figure out if there is some negative scaling going on in that matrix (i.e. one of the axes has negative scale). So, the fix here is to negatively scale everything if we detect this happening. WARNING: do not rely on being able to accurately detecting positive/negative values for more than a single axis per bone controller. Weird results may occur. You have been warned. --- source/blender/blenkernel/intern/constraint.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/blenkernel/intern/constraint.c') diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 0150646a96c..9d36a66843b 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3278,6 +3278,15 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t switch (data->from) { case 2: /* scale */ mat4_to_size(dvec, ct->matrix); + + if (is_negative_m4(ct->matrix)) { + /* Bugfix [#27886] + * We can't be sure which axis/axes are negative, though we know that something is negative. + * Assume we don't care about negativity of separate axes. <--- This is a limitation that + * riggers will have to live with for now. + */ + negate_v3(dvec); + } break; case 1: /* rotation (convert to degrees first) */ mat4_to_eulO(dvec, cob->rotOrder, ct->matrix); -- cgit v1.2.3