PATCH: [#13656] Bad rotation computing for manual rotation higher than 180 degrees

By Fabrice Tiercelin

This enables rotation angles of more than 180 degrees to result in the same rotation applied to the object (the result used to be clamps between -180 - 180 of the initial rotation).

The patch had to be modified to deal with IPO keys properly
This commit is contained in:
Martin Poirier 2008-06-09 16:54:54 +00:00
parent 4e2bb896b0
commit 83af2c1757

@ -2530,15 +2530,22 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
/* are there ipo keys? */
if(td->tdi) {
TransDataIpokey *tdi= td->tdi;
float current_rot[3];
float rot[3];
/* current IPO value for compatible euler */
current_rot[0] = tdi->rotx[0];
current_rot[1] = tdi->roty[0];
current_rot[2] = tdi->rotz[0];
VecMulf(current_rot, (float)(M_PI_2 / 9.0));
/* calculate the total rotatation in eulers */
VecAddf(eul, td->ext->irot, td->ext->drot);
EulToMat3(eul, obmat);
/* mat = transform, obmat = object rotation */
Mat3MulMat3(fmat, mat, obmat);
Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
Mat3ToCompatibleEul(fmat, eul, current_rot);
/* correct back for delta rot */
if(tdi->flag & TOB_IPODROT) {
@ -2567,7 +2574,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
/* mat = transform, obmat = object rotation */
Mat3MulMat3(fmat, smat, obmat);
Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
Mat3ToCompatibleEul(fmat, eul, td->ext->rot);
/* correct back for delta rot */
VecSubf(eul, eul, td->ext->drot);