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.
This commit is contained in:
parent
7d285854b0
commit
cd71d9e936
|
@ -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", "");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue