diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-11-14 06:13:40 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-11-14 06:13:40 +0300 |
commit | 7401c57fb36b5f807c84ba0a6af7d981a6794ec6 (patch) | |
tree | 8e1cd2cac050bb66e3c725ad934c908023f4b0b0 /source | |
parent | fece3f5e9716c4c214941e236eb8e94297031f14 (diff) |
Transform Roll Fixes for editbone. Special case for rotation, we don't need to guess in those case and the result is better if we use the real rotation.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/transform_generics.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index d8bc2158faa..229889d15ff 100644 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -509,24 +509,34 @@ void recalcData(TransInfo *t) } } - /* fix roll */ - for(i = 0; i < t->total; i++, td++) + + if (t->mode != TFM_BONE_ROLL) { - if (td->extra) + /* fix roll */ + for(i = 0; i < t->total; i++, td++) { - float vec[3], up_axis[3]; - float qrot[4]; - - ebo = td->extra; - - VecSubf(vec, ebo->tail, ebo->head); - Normalize(vec); - RotationBetweenVectorsToQuat(qrot, td->axismtx[1], vec); - - VECCOPY(up_axis, td->axismtx[2]); - QuatMulVecf(qrot, up_axis); - - ebo->roll = rollBoneToVector(ebo, up_axis); + if (td->extra) + { + float vec[3], up_axis[3]; + float qrot[4]; + + ebo = td->extra; + VECCOPY(up_axis, td->axismtx[2]); + + if (t->mode != TFM_ROTATION) + { + VecSubf(vec, ebo->tail, ebo->head); + Normalize(vec); + RotationBetweenVectorsToQuat(qrot, td->axismtx[1], vec); + QuatMulVecf(qrot, up_axis); + } + else + { + Mat3MulVecfl(t->mat, up_axis); + } + + ebo->roll = rollBoneToVector(ebo, up_axis); + } } } @@ -844,7 +854,10 @@ void restoreTransObjects(TransInfo *t) ((VObjectData*)vnode->data)->flag |= SCALE_SEND_READY; } #endif - } + } + + Mat3One(t->mat); + recalcData(t); } |