diff options
Diffstat (limited to 'source/blender/editors/space_sequencer')
3 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 1989502fc35..b9a593b520c 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1498,6 +1498,43 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot) } +static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Sequence *seq, *last_seq = seq_active_get(scene); + char *error_msg; + + if(last_seq->seq1==NULL || last_seq->seq2 == NULL) { + BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap"); + return OPERATOR_CANCELLED; + } + + seq = last_seq->seq1; + last_seq->seq1 = last_seq->seq2; + last_seq->seq2 = seq; + + update_changed_seq_and_deps(scene, last_seq, 1, 1); + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} +void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Swap Inputs"; + ot->idname= "SEQUENCER_OT_swap_inputs"; + ot->description="Swap the first two inputs for the effects strip"; + + /* api callbacks */ + ot->exec= sequencer_swap_inputs_exec; + ot->poll= sequencer_effect_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + + /* cut operator */ static EnumPropertyItem prop_cut_types[] = { {SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""}, diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index bf0dfff8e98..116786c3009 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -87,6 +87,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot); void SEQUENCER_OT_reload(struct wmOperatorType *ot); void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot); void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot); +void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot); void SEQUENCER_OT_duplicate(struct wmOperatorType *ot); void SEQUENCER_OT_delete(struct wmOperatorType *ot); void SEQUENCER_OT_images_separate(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 041b475223b..62c478f916f 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -60,6 +60,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_reload); WM_operatortype_append(SEQUENCER_OT_refresh_all); WM_operatortype_append(SEQUENCER_OT_reassign_inputs); + WM_operatortype_append(SEQUENCER_OT_swap_inputs); WM_operatortype_append(SEQUENCER_OT_duplicate); WM_operatortype_append(SEQUENCER_OT_delete); WM_operatortype_append(SEQUENCER_OT_images_separate); @@ -169,6 +170,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_RIGHT); WM_keymap_add_item(keymap, "SEQUENCER_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_swap_inputs", SKEY, KM_PRESS, KM_ALT, 0); /* multicam editing keyboard layout, switch to camera 1-10 using regular number keys */ |