diff options
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_edit.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 87 |
1 files changed, 23 insertions, 64 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index bf7d0e78c92..5dd453b9e30 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -39,7 +39,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_storage_types.h" #include "IMB_imbuf_types.h" @@ -140,21 +140,6 @@ typedef struct TransSeq { int len; } TransSeq; -Sequence *get_last_seq(Scene *scene) -{ - Editing *ed= seq_give_editing(scene, FALSE); - if(ed==NULL) return NULL; - return ed->act_seq; -} - -void set_last_seq(Scene *scene, Sequence *seq) -{ - Editing *ed= seq_give_editing(scene, FALSE); - if(ed==NULL) return; - - ed->act_seq= seq; -} - Sequence *get_foreground_frame_seq(Scene *scene, int frame) { Editing *ed= seq_give_editing(scene, FALSE); @@ -191,7 +176,7 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect { Editing *ed= seq_give_editing(scene, FALSE); struct SeqEffectHandle sh; - Sequence *last_seq= get_last_seq(scene); + Sequence *last_seq= active_seq_get(scene); if(last_seq && last_seq->type != SEQ_PLUGIN) return; @@ -489,29 +474,6 @@ void recurs_sel_seq(Sequence *seqm) } } -Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) -{ - Sequence *seq; - - /*ed= scene->ed;*/ - - seq= MEM_callocN( sizeof(Sequence), "addseq"); - BLI_addtail(lb, seq); - - //set_last_seq(scene, seq); // Probably not a great idea at such a low level anyway - Campbell - - *( (short *)seq->name )= ID_SEQ; - seq->name[2]= 0; - - seq->flag= SELECT; - seq->start= cfra; - seq->machine= machine; - seq->mul= 1.0; - seq->blend_opacity = 100.0; - - return seq; -} - int event_to_efftype(int event) { if(event==2) return SEQ_CROSS; @@ -537,7 +499,7 @@ static void reload_sound_strip(Scene *scene, char *name) Editing *ed; Sequence *seq, *seqact; SpaceFile *sfile; - Sequence *last_seq= get_last_seq(scene); + Sequence *last_seq= active_seq_get(scene); ed= scene->ed; @@ -579,7 +541,7 @@ static void reload_image_strip(Scene *scene, char *name) Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq=NULL, *seqact; SpaceFile *sfile=NULL; - Sequence *last_seq= get_last_seq(scene); + Sequence *last_seq= active_seq_get(scene); @@ -615,7 +577,7 @@ static void reload_image_strip(Scene *scene, char *name) void change_sequence(Scene *scene) { Editing *ed= seq_give_editing(scene, FALSE); - Sequence *last_seq= get_last_seq(scene); + Sequence *last_seq= active_seq_get(scene); Scene *sce; short event; @@ -717,7 +679,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen *error_str= NULL; if (!activeseq) - seq2= get_last_seq(scene); + seq2= active_seq_get(scene); for(seq=ed->seqbasep->first; seq; seq=seq->next) { if(seq->flag & SELECT) { @@ -780,7 +742,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen void reassign_inputs_seq_effect(Scene *scene) { Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq1, *seq2, *seq3, *last_seq = get_last_seq(scene); + Sequence *seq1, *seq2, *seq3, *last_seq = active_seq_get(scene); char *error_msg; if(last_seq==0 || !(last_seq->type & SEQ_EFFECT)) return; @@ -849,7 +811,7 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall) { Sequence *seq, *seqn; - Sequence *last_seq = get_last_seq(scene); + Sequence *last_seq = active_seq_get(scene); seq= lb->first; while(seq) { @@ -859,7 +821,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de seq->sound->id.us--; BLI_remlink(lb, seq); - if(seq==last_seq) set_last_seq(scene, NULL); + if(seq==last_seq) active_seq_set(scene, NULL); if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); if(seq->ipo) seq->ipo->id.us--; seq_free_sequence(scene, seq); @@ -987,7 +949,7 @@ static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new) { Sequence *seq; Sequence *seqn = 0; - Sequence *last_seq = get_last_seq(scene); + Sequence *last_seq = active_seq_get(scene); for(seq= old->first; seq; seq= seq->next) { seq->tmp= NULL; @@ -1002,7 +964,7 @@ static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new) recurs_dupli_seq(scene, &seq->seqbase,&seqn->seqbase); if (seq == last_seq) { - set_last_seq(scene, seqn); + active_seq_set(scene, seqn); } } } @@ -1299,7 +1261,7 @@ void set_filter_seq(Scene *scene) void seq_remap_paths(Scene *scene) { - Sequence *seq, *last_seq = get_last_seq(scene); + Sequence *seq, *last_seq = active_seq_get(scene); Editing *ed= seq_give_editing(scene, FALSE); char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX]; @@ -1701,7 +1663,7 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *op) if(ed==NULL) return OPERATOR_CANCELLED; - free_imbuf_seq(&ed->seqbase, FALSE); + free_imbuf_seq(scene, &ed->seqbase, FALSE); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1889,7 +1851,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op) if(ed==NULL) return OPERATOR_CANCELLED; - seq=get_last_seq(scene); + seq=active_seq_get(scene); if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */ nothingSelected = FALSE; } else { @@ -2057,7 +2019,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); - Sequence *last_seq= get_last_seq(scene); + Sequence *last_seq= active_seq_get(scene); MetaStack *ms; if(ed==NULL) @@ -2072,7 +2034,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) ed->seqbasep= &last_seq->seqbase; - set_last_seq(scene, NULL); + active_seq_set(scene, NULL); } else { @@ -2092,7 +2054,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) for(seq= ed->seqbasep->first; seq; seq= seq->next) calc_sequence(seq); - set_last_seq(scene, ms->parseq); + active_seq_set(scene, ms->parseq); ms->parseq->flag |= SELECT; recurs_sel_seq(ms->parseq); @@ -2141,10 +2103,6 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) while(seq) { if(seq->flag & SELECT) { tot++; - if (seq->type == SEQ_SOUND) { - BKE_report(op->reports, RPT_ERROR, "Can't make Meta Strip from audio"); - return OPERATOR_CANCELLED;; - } } seq= seq->next; } @@ -2202,7 +2160,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) seqm->strip->len= seqm->len; seqm->strip->us= 1; - set_last_seq(scene, seqm); + active_seq_set(scene, seqm); if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm); @@ -2243,7 +2201,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq, *last_seq = get_last_seq(scene); /* last_seq checks ed==NULL */ + Sequence *seq, *last_seq = active_seq_get(scene); /* last_seq checks ed==NULL */ if(last_seq==NULL || last_seq->type!=SEQ_META) return OPERATOR_CANCELLED; @@ -2591,7 +2549,7 @@ static int sequencer_swap_internal_exec(bContext *C, int side) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); - Sequence *active_seq = get_last_seq(scene); + Sequence *active_seq = active_seq_get(scene); Sequence *seq; if(ed==NULL) return OPERATOR_CANCELLED; @@ -2674,7 +2632,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *op) { int retval = OPERATOR_CANCELLED; Scene *scene= CTX_data_scene(C); - Sequence *active_seq = get_last_seq(scene); + Sequence *active_seq = active_seq_get(scene); if(active_seq==NULL) return OPERATOR_CANCELLED; @@ -2717,4 +2675,5 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ -}
\ No newline at end of file +} + |