diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-01-29 11:17:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-01-29 11:17:33 +0300 |
commit | cd71d9e93648c6faf486cc19ec64d03bb9ada3b1 (patch) | |
tree | 977a0eea3b74d64aaa4e2a32fba42d209bb92016 /source/blender/editors/space_sequencer/sequencer_modifier.c | |
parent | 7d285854b0e36a4cb7720f0b910fb4f9c2d8804b (diff) |
Sequencer: It is now possible to append strip's modifiers to all selected ones
Previously it was only possible to replace all existing modifiers with the
new list, which isn't so great for grading.
Ideally we should also have some sort of merge policy here, but that's for
later.
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_modifier.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_modifier.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index 713e1618e39..aea0f6a3929 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -208,12 +208,20 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot) RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", ""); } -static int strip_modifier_copy_exec(bContext *C, wmOperator *UNUSED(op)) +/*********************** Copy to selected operator *************************/ + +enum { + SEQ_MODIFIER_COPY_REPLACE = 0, + SEQ_MODIFIER_COPY_APPEND = 1, +}; + +static int strip_modifier_copy_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Editing *ed = scene->ed; Sequence *seq = BKE_sequencer_active_get(scene); Sequence *seq_iter; + const int type = RNA_enum_get(op->ptr, "type"); if (!seq || !seq->modifiers.first) return OPERATOR_CANCELLED; @@ -224,16 +232,17 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *UNUSED(op)) if (seq_iter == seq) continue; - if (seq_iter->modifiers.first) { - SequenceModifierData *smd_tmp, *smd = seq_iter->modifiers.first; - - while (smd) { - smd_tmp = smd->next; - BLI_remlink(&seq_iter->modifiers, smd); - BKE_sequence_modifier_free(smd); - smd = smd_tmp; + if (type == SEQ_MODIFIER_COPY_REPLACE) { + if (seq_iter->modifiers.first) { + SequenceModifierData *smd_tmp, *smd = seq_iter->modifiers.first; + while (smd) { + smd_tmp = smd->next; + BLI_remlink(&seq_iter->modifiers, smd); + BKE_sequence_modifier_free(smd); + smd = smd_tmp; + } + BLI_listbase_clear(&seq_iter->modifiers); } - BLI_listbase_clear(&seq_iter->modifiers); } BKE_sequence_modifier_list_copy(seq_iter, seq); @@ -249,16 +258,27 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) { + static EnumPropertyItem type_items[] = { + {SEQ_MODIFIER_COPY_REPLACE, "REPLACE", 0, "Replace", + "Replace modifiers in desctination"}, + {SEQ_MODIFIER_COPY_APPEND, "APPEND", 0, "Append", + "Append active modifiers to selected strips"}, + {0, NULL, 0, NULL, NULL}}; + /* identifiers */ ot->name = "Copy to Selected Strips"; ot->idname = "SEQUENCER_OT_strip_modifier_copy"; ot->description = "Copy modifiers of the active strip to all selected strips"; /* api callbacks */ + ot->invoke = WM_menu_invoke; ot->exec = strip_modifier_copy_exec; ot->poll = strip_modifier_active_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + ot->prop = RNA_def_enum(ot->srna, "type", type_items, SEQ_MODIFIER_COPY_REPLACE, "Type", ""); } |