Fix T97559: Undoing of NLA strip duplication requires two undo steps
Fix the issue where undoing a "duplicate NLA strip" operation would require two undo steps. The cause of this was that the operator was not using the operator macro system to combine both the duplication and the translate operators into one. Instead, the old code was simply manually invoking invoking the translate operator after the duplicate operator had completed. This patch requires the default keymap to be modified to include the two new macro operators, `NLA_OT_duplicate_move` and `NLA_OT_duplicate_linked_move` in favour of the old keymap that simply called `NLA_OT_duplicate` and passed along a `linked` argument. `duplicate_move` and `duplicate_move_linked` are two different enough operations to justify having their own operators from user's point-of-view, especially since we cannot yet have different tool-tips based on an operator's settings. Reviewed By: sybren, mont29 Differential Revision: https://developer.blender.org/D15086
This commit is contained in:
parent
4812eda3c5
commit
2f834bfc14
Notes:
blender-bot
2023-02-14 11:18:07 +01:00
Referenced by issue #97559, Undoing an NLA strip duplication leaves the duplicated NLA strip in an unexpected state
|
@ -2578,10 +2578,8 @@ def km_nla_editor(params):
|
|||
("nla.soundclip_add", {"type": 'K', "value": 'PRESS', "shift": True}, None),
|
||||
("nla.meta_add", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
|
||||
("nla.meta_remove", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None),
|
||||
("nla.duplicate", {"type": 'D', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("linked", False)]}),
|
||||
("nla.duplicate", {"type": 'D', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("linked", True)]}),
|
||||
("nla.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
("nla.duplicate_linked_move", {"type": 'D', "value": 'PRESS', "alt": True}, None),
|
||||
("nla.make_single_user", {"type": 'U', "value": 'PRESS'}, None),
|
||||
("nla.delete", {"type": 'X', "value": 'PRESS'}, None),
|
||||
("nla.delete", {"type": 'DEL', "value": 'PRESS'}, None),
|
||||
|
|
|
@ -1046,6 +1046,8 @@ void ED_keymap_anim(struct wmKeyConfig *keyconf);
|
|||
void ED_operatormacros_graph(void);
|
||||
/* space_action */
|
||||
void ED_operatormacros_action(void);
|
||||
/* space_nla*/
|
||||
void ED_operatormacros_nla(void);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@ void ED_spacemacros_init(void)
|
|||
ED_operatormacros_sequencer();
|
||||
ED_operatormacros_paint();
|
||||
ED_operatormacros_gpencil();
|
||||
ED_operatormacros_nla();
|
||||
|
||||
/* Register dropboxes (can use macros). */
|
||||
ED_dropboxes_ui();
|
||||
|
|
|
@ -1216,13 +1216,10 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
nlaedit_duplicate_exec(C, op);
|
||||
|
||||
RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr, event);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -1248,9 +1245,6 @@ void NLA_OT_duplicate(wmOperatorType *ot)
|
|||
false,
|
||||
"Linked",
|
||||
"When duplicating strips, assign new copies of the actions they use");
|
||||
|
||||
/* to give to transform */
|
||||
RNA_def_enum(ot->srna, "mode", rna_enum_transform_mode_types, TFM_TRANSLATION, "Mode", "");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "ED_anim_api.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
|
@ -138,6 +140,28 @@ void nla_operatortypes(void)
|
|||
WM_operatortype_append(NLA_OT_fmodifier_paste);
|
||||
}
|
||||
|
||||
void ED_operatormacros_nla()
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
wmOperatorTypeMacro *otmacro;
|
||||
|
||||
ot = WM_operatortype_append_macro("NLA_OT_duplicate_move",
|
||||
"Duplicate",
|
||||
"Duplicate selected strips and their Actions and move them",
|
||||
OPTYPE_UNDO | OPTYPE_REGISTER);
|
||||
otmacro = WM_operatortype_macro_define(ot, "NLA_OT_duplicate");
|
||||
RNA_boolean_set(otmacro->ptr, "linked", false);
|
||||
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
|
||||
ot = WM_operatortype_append_macro("NLA_OT_duplicate_linked_move",
|
||||
"Duplicate Linked",
|
||||
"Duplicate selected strips and move them",
|
||||
OPTYPE_UNDO | OPTYPE_REGISTER);
|
||||
otmacro = WM_operatortype_macro_define(ot, "NLA_OT_duplicate");
|
||||
RNA_boolean_set(otmacro->ptr, "linked", true);
|
||||
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
}
|
||||
|
||||
/* ************************** registration - keymaps **********************************/
|
||||
|
||||
void nla_keymap(wmKeyConfig *keyconf)
|
||||
|
|
Loading…
Reference in New Issue