Fix #31852: Sequencer duplicate cant move strips on Y axis in a meta

Issue was caused by some stuff happenign in wm_operator_finish() which uses
to somehow restore changes made by transformation invoke function.

Solved by not calling translation operator directly from duplication operator
(which is in fact really tricky) and use macros instead. This macros calls
duplication operator which simply duplicates strip, and then calls translation
operator.
This commit is contained in:
Sergey Sharybin 2012-06-20 14:20:03 +00:00
parent 72f7ab441d
commit aa30e20272
5 changed files with 18 additions and 14 deletions

@ -256,7 +256,7 @@ class SEQUENCER_MT_strip(Menu):
layout.operator("sequencer.rebuild_proxy")
layout.separator()
layout.operator("sequencer.duplicate")
layout.operator("sequencer.duplicate_move")
layout.operator("sequencer.delete")
strip = act_strip(context)

@ -33,4 +33,6 @@ struct Sequence;
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, int deselect_all);
void ED_sequencer_deselect_all(struct Scene *scene);
void ED_operatormacros_sequencer(void);
#endif /* __ED_SEQUENCER_H__ */

@ -63,6 +63,7 @@
#include "ED_logic.h"
#include "ED_clip.h"
#include "ED_mask.h"
#include "ED_sequencer.h"
#include "io_ops.h"
@ -139,7 +140,8 @@ void ED_spacetypes_init(void)
ED_operatormacros_clip();
ED_operatormacros_curve();
ED_operatormacros_mask();
ED_operatormacros_sequencer();
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();
for (type = spacetypes->first; type; type = type->next) {

@ -1570,16 +1570,6 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
sequencer_add_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);
return OPERATOR_FINISHED;
}
void SEQUENCER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
@ -1588,7 +1578,6 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
ot->description = "Duplicate the selected strips";
/* api callbacks */
ot->invoke = sequencer_add_duplicate_invoke;
ot->exec = sequencer_add_duplicate_exec;
ot->poll = ED_operator_sequencer_active;

@ -167,7 +167,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", DELKEY, KM_PRESS, 0, 0);
@ -321,3 +321,14 @@ void sequencer_keymap(wmKeyConfig *keyconf)
#endif
}
void ED_operatormacros_sequencer(void)
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
ot = WM_operatortype_append_macro("SEQUENCER_OT_duplicate_move", "Duplicate Strips",
"Duplicate selected strips and move them", OPTYPE_UNDO | OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "SEQUENCER_OT_duplicate");
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
}