Fix T71455, T73852, T73860: Transform, Redo doesn't work properly in time editors
The redo panel does not consider the position of the mouse. So it is not possible to know the direction to redo the operator. The solution is to add a new `direction` parameter that can be saved and used for redo. Differential Revision: https://developer.blender.org/D6852
This commit is contained in:
@@ -153,6 +153,7 @@ int BIF_countTransformOrientation(const struct bContext *C);
|
||||
#define P_GPENCIL_EDIT (1 << 13)
|
||||
#define P_CURSOR_EDIT (1 << 14)
|
||||
#define P_CLNOR_INVALIDATE (1 << 15)
|
||||
#define P_MOUSE (1 << 16)
|
||||
|
||||
void Transform_Properties(struct wmOperatorType *ot, int flags);
|
||||
|
||||
|
||||
@@ -1637,6 +1637,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "mouse_coordinate_override"))) {
|
||||
/* Important for redo operations. */
|
||||
RNA_property_int_set_array(op->ptr, prop, t->mouse.imval);
|
||||
}
|
||||
|
||||
if (t->flag & T_PROP_EDIT_ALL) {
|
||||
if (t->flag & T_PROP_EDIT) {
|
||||
proportional |= PROP_EDIT_USE;
|
||||
|
||||
@@ -1374,6 +1374,24 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
bGPdata *gpd = CTX_data_gpencil_data(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_float_get_array(op->ptr, prop, t->center_global);
|
||||
mul_v3_v3(t->center_global, t->aspect);
|
||||
t->flag |= T_OVERRIDE_CENTER;
|
||||
}
|
||||
|
||||
if (op && (prop = RNA_struct_find_property(op->ptr, "mouse_coordinate_override")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_int_get_array(op->ptr, prop, t->mval);
|
||||
}
|
||||
else if (event) {
|
||||
copy_v2_v2_int(t->mval, event->mval);
|
||||
}
|
||||
else {
|
||||
zero_v2_int(t->mval);
|
||||
}
|
||||
|
||||
t->depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
t->scene = sce;
|
||||
t->view_layer = view_layer;
|
||||
@@ -1402,21 +1420,12 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
t->redraw = TREDRAW_HARD; /* redraw first time */
|
||||
|
||||
if (event) {
|
||||
t->mouse.imval[0] = event->mval[0];
|
||||
t->mouse.imval[1] = event->mval[1];
|
||||
}
|
||||
else {
|
||||
t->mouse.imval[0] = 0;
|
||||
t->mouse.imval[1] = 0;
|
||||
}
|
||||
t->mouse.imval[0] = t->mval[0];
|
||||
t->mouse.imval[1] = t->mval[1];
|
||||
|
||||
t->con.imval[0] = t->mouse.imval[0];
|
||||
t->con.imval[1] = t->mouse.imval[1];
|
||||
|
||||
t->mval[0] = t->mouse.imval[0];
|
||||
t->mval[1] = t->mouse.imval[1];
|
||||
|
||||
t->transform = NULL;
|
||||
t->handleEvent = NULL;
|
||||
|
||||
@@ -1771,13 +1780,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
setTransformViewAspect(t, t->aspect);
|
||||
|
||||
if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_float_get_array(op->ptr, prop, t->center_global);
|
||||
mul_v3_v3(t->center_global, t->aspect);
|
||||
t->flag |= T_OVERRIDE_CENTER;
|
||||
}
|
||||
|
||||
setTransformViewMatrices(t);
|
||||
initNumInput(&t->num);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ void initTimeTranslate(TransInfo *t)
|
||||
t->state = TRANS_CANCEL;
|
||||
}
|
||||
|
||||
t->mode = TFM_TIME_TRANSLATE;
|
||||
t->transform = applyTimeTranslate;
|
||||
|
||||
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
||||
|
||||
@@ -384,7 +384,6 @@ void initTranslation(TransInfo *t)
|
||||
t->state = TRANS_CANCEL;
|
||||
}
|
||||
|
||||
t->mode = TFM_TRANSLATION;
|
||||
t->transform = applyTranslation;
|
||||
|
||||
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
|
||||
|
||||
@@ -694,6 +694,14 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
|
||||
RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)");
|
||||
}
|
||||
|
||||
if (flags & P_MOUSE) {
|
||||
prop = RNA_def_property(ot->srna, "mouse_coordinate_override", PROP_INT, PROP_XYZ);
|
||||
RNA_def_property_array(prop, 2);
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Mouse Coordinate Override", "Force using this mouse value (when set)");
|
||||
}
|
||||
|
||||
if ((flags & P_NO_DEFAULTS) == 0) {
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"release_confirm",
|
||||
@@ -1239,7 +1247,7 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
|
||||
|
||||
Transform_Properties(ot,
|
||||
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER);
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_MOUSE);
|
||||
}
|
||||
|
||||
static int transform_from_gizmo_invoke(bContext *C,
|
||||
|
||||
Reference in New Issue
Block a user