[#14398] In Object- and EditMode, global rotate manual input is different than mouse
The sign of the rotation angle was sometimes different between num input and mouse input.
This commit is contained in:
parent
abda1a9ec1
commit
dac3434b03
@ -102,9 +102,9 @@ typedef struct TransCon {
|
||||
/* Apply function pointer for linear vectorial transformation */
|
||||
/* The last three parameters are pointers to the in/out/printable vectors */
|
||||
void (*applySize)(struct TransInfo *, struct TransData *, float [3][3]);
|
||||
/* Apply function pointer for rotation transformation (prototype will change */
|
||||
void (*applyRot)(struct TransInfo *, struct TransData *, float [3]);
|
||||
/* Apply function pointer for rotation transformation (prototype will change */
|
||||
/* Apply function pointer for size transformation */
|
||||
void (*applyRot)(struct TransInfo *, struct TransData *, float [3], float *);
|
||||
/* Apply function pointer for rotation transformation */
|
||||
} TransCon;
|
||||
|
||||
typedef struct TransDataIpokey {
|
||||
|
@ -2621,7 +2621,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
|
||||
continue;
|
||||
|
||||
if (t->con.applyRot) {
|
||||
t->con.applyRot(t, td, axis);
|
||||
t->con.applyRot(t, td, axis, NULL);
|
||||
VecRotToMat3(axis, angle * td->factor, mat);
|
||||
}
|
||||
else if (t->flag & T_PROP_EDIT) {
|
||||
@ -2654,7 +2654,7 @@ int Rotation(TransInfo *t, short mval[2])
|
||||
snapGrid(t, &final);
|
||||
|
||||
if (t->con.applyRot) {
|
||||
t->con.applyRot(t, NULL, axis);
|
||||
t->con.applyRot(t, NULL, axis, &final);
|
||||
}
|
||||
|
||||
applySnapping(t, &final);
|
||||
@ -3314,7 +3314,7 @@ int PushPull(TransInfo *t, short mval[2])
|
||||
}
|
||||
|
||||
if (t->con.applyRot && t->con.mode & CON_APPLY) {
|
||||
t->con.applyRot(t, NULL, axis);
|
||||
t->con.applyRot(t, NULL, axis, NULL);
|
||||
}
|
||||
|
||||
for(i = 0 ; i < t->total; i++, td++) {
|
||||
@ -3326,7 +3326,7 @@ int PushPull(TransInfo *t, short mval[2])
|
||||
|
||||
VecSubf(vec, t->center, td->center);
|
||||
if (t->con.applyRot && t->con.mode & CON_APPLY) {
|
||||
t->con.applyRot(t, td, axis);
|
||||
t->con.applyRot(t, td, axis, NULL);
|
||||
if (isLockConstraint(t)) {
|
||||
float dvec[3];
|
||||
Projf(dvec, vec, axis);
|
||||
|
@ -393,7 +393,7 @@ static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3]
|
||||
* (ie: not doing counterclockwise rotations when the mouse moves clockwise).
|
||||
*/
|
||||
|
||||
static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
|
||||
static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
|
||||
{
|
||||
if (!td && t->con.mode & CON_APPLY) {
|
||||
int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
||||
@ -413,9 +413,9 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
|
||||
break;
|
||||
}
|
||||
/* don't flip axis if asked to or if num input */
|
||||
if (!(mode & CON_NOFLIP) && hasNumInput(&t->num) == 0) {
|
||||
if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
|
||||
if (Inpf(vec, t->viewinv[2]) > 0.0f) {
|
||||
VecMulf(vec, -1.0f);
|
||||
*angle = -(*angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -435,10 +435,15 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
|
||||
* (ie: not doing counterclockwise rotations when the mouse moves clockwise).
|
||||
*/
|
||||
|
||||
static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3])
|
||||
static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
|
||||
{
|
||||
if (td && t->con.mode & CON_APPLY) {
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
||||
|
||||
/* on setup call, use first object */
|
||||
if (td == NULL) {
|
||||
td= t->data;
|
||||
}
|
||||
|
||||
switch(mode) {
|
||||
case CON_AXIS0:
|
||||
@ -454,9 +459,9 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3])
|
||||
VECCOPY(vec, td->axismtx[2]);
|
||||
break;
|
||||
}
|
||||
if (!(mode & CON_NOFLIP)) {
|
||||
if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
|
||||
if (Inpf(vec, t->viewinv[2]) > 0.0f) {
|
||||
VecMulf(vec, -1.0f);
|
||||
*angle = -(*angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3])
|
||||
if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
|
||||
float axis[3], tmp[3];
|
||||
|
||||
t->con.applyRot(t, NULL, axis);
|
||||
t->con.applyRot(t, NULL, axis, NULL);
|
||||
|
||||
Projf(tmp, end, axis);
|
||||
VecSubf(end, end, tmp);
|
||||
|
Loading…
Reference in New Issue
Block a user