diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-04 02:25:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-04 02:25:22 +0400 |
commit | 281902d6eed8be1f2de0a9c3877303672aa8644a (patch) | |
tree | 1e1d0b01f4fd4f18a99f9a2d4a55d44117a6de6f /source/blender/editors/space_sequencer | |
parent | 6e5a436f56a6d7e69a61393d3a34940aecbf8a92 (diff) |
sequencer re-assign inputs back
Diffstat (limited to 'source/blender/editors/space_sequencer')
3 files changed, 64 insertions, 30 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index b994b0877d7..246355f547e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -677,36 +677,6 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen return 1; } -void reassign_inputs_seq_effect(Scene *scene) -{ - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene); - char *error_msg; - - if(last_seq==0 || !(last_seq->type & SEQ_EFFECT)) return; - if(ed==NULL) return; - - if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) { - //BKE_report(op->reports, RPT_ERROR, error_msg); // XXX operatorify - return; - } - /* see reassigning would create a cycle */ - if( seq_is_predecessor(seq1, last_seq) || - seq_is_predecessor(seq2, last_seq) || - seq_is_predecessor(seq3, last_seq) - ) { - //BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed"); // XXX operatorify - return; - } - - last_seq->seq1 = seq1; - last_seq->seq2 = seq2; - last_seq->seq3 = seq3; - - update_changed_seq_and_deps(scene, last_seq, 1, 1); - -} - static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) { Sequence *seq1, *seq2, *seq3; @@ -1458,6 +1428,67 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene); + char *error_msg; + + if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) { + BKE_report(op->reports, RPT_ERROR, error_msg); + return OPERATOR_CANCELLED; + } + /* see reassigning would create a cycle */ + if( seq_is_predecessor(seq1, last_seq) || + seq_is_predecessor(seq2, last_seq) || + seq_is_predecessor(seq3, last_seq) + ) { + BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed"); + return OPERATOR_CANCELLED; + } + + last_seq->seq1 = seq1; + last_seq->seq2 = seq2; + last_seq->seq3 = seq3; + + update_changed_seq_and_deps(scene, last_seq, 1, 1); + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +int sequencer_effect_poll(bContext *C) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + + if(ed) { + Sequence *last_seq= seq_active_get(scene); + if(last_seq && (last_seq->type & SEQ_EFFECT)) { + return 1; + } + } + + return 0; +} + +void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Reassign Inputs"; + ot->idname= "SEQUENCER_OT_reassign_inputs"; + ot->description="Reassign the inputs for the effects strip"; + + /* api callbacks */ + ot->exec= sequencer_reassign_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 71953ff3ddd..df426e91075 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -85,6 +85,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot); 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_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 69457e5c6e8..9f5a97d4446 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -63,6 +63,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_unlock); 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_duplicate); WM_operatortype_append(SEQUENCER_OT_delete); WM_operatortype_append(SEQUENCER_OT_images_separate); @@ -134,6 +135,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); |