Fix T62241: Repeat last translate, wrong direction

Only use orientation value when the operator uses orientation axis.

Own error in 03da3b6593
This commit is contained in:
Campbell Barton
2019-03-06 18:08:27 +11:00
parent 0294e1d27f
commit 3b1e2a4f56

View File

@@ -2160,6 +2160,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
} }
/* Orientation used for redo. */ /* Orientation used for redo. */
const bool use_orient_axis = (
t->orient_matrix_is_set &&
(RNA_struct_find_property(op->ptr, "orient_axis") != NULL));
short orientation; short orientation;
if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_APPLY) {
orientation = t->con.orientation; orientation = t->con.orientation;
@@ -2177,10 +2180,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{ {
orientation = RNA_property_enum_get(op->ptr, prop); orientation = RNA_property_enum_get(op->ptr, prop);
} }
else { else if (use_orient_axis) {
/* We're not using an orientation, use the fallback. */ /* We're not using an orientation, use the fallback. */
orientation = t->orientation.unset; orientation = t->orientation.unset;
} }
else {
orientation = V3D_ORIENT_GLOBAL;
}
if ((prop = RNA_struct_find_property(op->ptr, "orient_axis"))) { if ((prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
@@ -2212,7 +2218,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_APPLY) {
RNA_float_set_array(op->ptr, "orient_matrix", &t->con.mtx[0][0]); RNA_float_set_array(op->ptr, "orient_matrix", &t->con.mtx[0][0]);
} }
else if (t->orient_matrix_is_set) { else if (use_orient_axis) {
RNA_float_set_array(op->ptr, "orient_matrix", &t->orient_matrix[0][0]); RNA_float_set_array(op->ptr, "orient_matrix", &t->orient_matrix[0][0]);
} }
else { else {