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.
This commit is contained in:
Joshua Leung 2012-06-11 05:05:05 +00:00
parent 1022d0c257
commit 61fe88aedc

@ -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);