Fix T85886: Rotate Tool and Adjust Last Operation - angles inverted

The constraint was not set when redoing.

This commit also removes `postInputRotation`. I really couldn't see a use for it.
This commit is contained in:
Germano Cavalcante 2021-02-27 17:10:18 -03:00
parent aad2f1510a
commit 92743cc895
Notes: blender-bot 2023-02-13 19:29:49 +01:00
Referenced by issue #85958, Potential candidates for corrective releases
Referenced by issue #85886, [2.92.0 RC] Rotate Tool and Adjust Last Operation - angles inverted
7 changed files with 6 additions and 21 deletions

View File

@ -572,7 +572,7 @@ static void constraints_rotation_impl(TransInfo *t,
break;
}
/* don't flip axis if asked to or if num input */
if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
if (r_angle && !((mode & CON_NOFLIP) || hasNumInput(&t->num) || (t->flag & T_INPUT_IS_VALUES_FINAL))) {
float view_vector[3];
view_vector_calc(t, t->center_global, view_vector);
if (dot_v3v3(r_vec, view_vector) > 0.0f) {

View File

@ -381,12 +381,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
bool constraint_axis[3] = {false, false, false};
if (t->flag & T_INPUT_IS_VALUES_FINAL) {
if (t_values_set_is_array) {
/* For operators whose `t->values` is array, set constraint so that the
* orientation is more intuitive in the Redo Panel. */
constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true;
}
if (t_values_set_is_array && t->flag & T_INPUT_IS_VALUES_FINAL) {
/* For operators whose `t->values` is array (as Move and Scale), set constraint so that the
* orientation is more intuitive in the Redo Panel. */
constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true;
}
else if (RNA_property_is_set(op->ptr, prop)) {
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);

View File

@ -554,15 +554,6 @@ void headerRotation(TransInfo *t, char str[UI_MAX_DRAW_STR], float final)
}
}
void postInputRotation(TransInfo *t, float values[3])
{
float axis_final[3];
copy_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
t->con.applyRot(t, NULL, NULL, axis_final, values);
}
}
/**
* Applies values of rotation to `td->loc` and `td->ext->quat`
* based on a rotation matrix (mat) and a pivot (center).

View File

@ -47,7 +47,6 @@ void protectedTransBits(short protectflag, float vec[3]);
void protectedSizeBits(short protectflag, float size[3]);
void constraintTransLim(TransInfo *t, TransData *td);
void constraintSizeLim(TransInfo *t, TransData *td);
void postInputRotation(TransInfo *t, float values[3]);
void headerRotation(TransInfo *t, char *str, float final);
void ElementRotation_ex(TransInfo *t,
TransDataContainer *tc,

View File

@ -254,7 +254,6 @@ void initBend(TransInfo *t)
t->transform = Bend;
t->handleEvent = handleEventBend;
setInputPostFct(&t->mouse, postInputRotation);
initMouseInputMode(t, &t->mouse, INPUT_ANGLE_SPRING);
t->idx_max = 1;

View File

@ -127,7 +127,6 @@ void initNormalRotation(TransInfo *t)
t->mode = TFM_NORMAL_ROTATION;
t->transform = applyNormalRotation;
setInputPostFct(&t->mouse, postInputRotation);
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
t->idx_max = 0;

View File

@ -197,7 +197,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
float final = t->values[0];
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
t->con.applyRot(t, NULL, NULL, axis_final, NULL);
t->con.applyRot(t, NULL, NULL, axis_final, &final);
}
else {
negate_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
@ -234,7 +234,6 @@ void initRotation(TransInfo *t)
t->tsnap.applySnap = ApplySnapRotation;
t->tsnap.distance = RotationBetween;
setInputPostFct(&t->mouse, postInputRotation);
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
t->idx_max = 0;