Bugfix #4843 revisited

This is a new incarnation of compatible_eul(), a function called:

void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot)

It uses the two euler extraction methods as added by Brecht a while ago,
and checks for compatibility each, and then picks the best of the two
based on minimal difference with 'oldrot'.

Gives for rotation key inserting a much higher hitrate for OK eulers.
This commit is contained in:
2006-08-13 10:03:07 +00:00
parent e3d78dd4e1
commit bdb12f23cf
3 changed files with 52 additions and 54 deletions

View File

@@ -80,8 +80,6 @@
#include "BKE_utildefines.h"
#include "BKE_bad_level_calls.h"/* popmenu and error */
#include "BDR_editobject.h" /* compatible_eul */
#include "BSE_view.h"
#include "BLI_arithb.h"
@@ -1739,8 +1737,8 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
EulToMat3(eul, obmat);
/* mat = transform, obmat = object rotation */
Mat3MulMat3(fmat, mat, obmat);
Mat3ToEul(fmat, eul);
compatible_eul(eul, td->ext->irot);
Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
/* correct back for delta rot */
if(tdi->flag & TOB_IPODROT) {
@@ -1768,8 +1766,8 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
EulToMat3(eul, obmat);
/* mat = transform, obmat = object rotation */
Mat3MulMat3(fmat, smat, obmat);
Mat3ToEul(fmat, eul);
compatible_eul(eul, td->ext->irot);
Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
/* correct back for delta rot */
VecSubf(eul, eul, td->ext->drot);