diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-06-11 09:05:05 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-06-11 09:05:05 +0400 |
commit | 61fe88aedc27759bcf8abcaa862dfb2cc9164081 (patch) | |
tree | 630aa895d6e05249e48634de2a03dd3426560079 | |
parent | 1022d0c257a395f032023416c6a52ecdda3e4b93 (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |