Fix #106548: Repeat Last operator reuses orientation for extrusion #106569

Merged
Germano Cavalcante merged 1 commits from mano-wii/blender:fix_106548 into main 2023-04-06 15:17:16 +02:00
2 changed files with 19 additions and 2 deletions

View File

@ -420,8 +420,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
}
if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
RNA_property_is_set(op->ptr, prop))) {
/* The properties "orient_matrix" and "orient_matrix_type" are used to store the orientation
* calculated in the first operator call. This allows for reuse of the orientation during
* subsequent calls of the same operator. When making adjustments through the Redo panel
* (#OP_IS_REPEAT), reusing the orientation prevents unpredictable changes that can occur when
* using #V3D_ORIENT_VIEW. However, when activated by #SCREEN_OT_repeat_last
* (#OP_IS_REPEAT_LAST), it's best to avoid reusing the orientation to prevent unintended
* changes. */
if (op && !(op->flag & OP_IS_REPEAT_LAST) &&
((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
RNA_property_is_set(op->ptr, prop))) {
RNA_property_float_get_array(op->ptr, prop, &custom_matrix[0][0]);
if ((prop = RNA_struct_find_property(op->ptr, "orient_matrix_type")) &&

View File

@ -310,12 +310,17 @@ static int wm_macro_end(wmOperator *op, int retval)
static int wm_macro_exec(bContext *C, wmOperator *op)
{
int retval = OPERATOR_FINISHED;
const int op_inherited_flag = op->flag & (OP_IS_REPEAT | OP_IS_REPEAT_LAST);
wm_macro_start(op);
LISTBASE_FOREACH (wmOperator *, opm, &op->macro) {
if (opm->type->exec) {
opm->flag |= op_inherited_flag;
retval = opm->type->exec(C, opm);
opm->flag &= ~op_inherited_flag;
OPERATOR_RETVAL_CHECK(retval);
if (retval & OPERATOR_FINISHED) {
@ -340,15 +345,19 @@ static int wm_macro_invoke_internal(bContext *C,
wmOperator *opm)
{
int retval = OPERATOR_FINISHED;
const int op_inherited_flag = op->flag & (OP_IS_REPEAT | OP_IS_REPEAT_LAST);
/* start from operator received as argument */
for (; opm; opm = opm->next) {
opm->flag |= op_inherited_flag;
if (opm->type->invoke) {
retval = opm->type->invoke(C, opm, event);
}
else if (opm->type->exec) {
retval = opm->type->exec(C, opm);
}
opm->flag &= ~op_inherited_flag;
OPERATOR_RETVAL_CHECK(retval);