diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-11 14:04:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-11 14:04:55 +0400 |
commit | 6ce6dfba1697adc01353cf6b0a608165e0b2b726 (patch) | |
tree | d731af5cd6d4028f8519957917a63bbb6ebf9a68 /source/blender/blenkernel | |
parent | 9d91bc38d303e4937bb56dc75d95f11936de5ff9 (diff) |
- dont create scene.sequence_editor on read, means data-browser or autocomplete will allocate a sequencer.
... instead add scene.sequencer_editor_create / clear, these match id.animation_data_* functions.
- refactor for names, for scene level functions call them BKE_sequencer_*
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 57 |
3 files changed, 51 insertions, 32 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 598d1b681bc..decbf5d0d2a 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -170,6 +170,22 @@ struct ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, struct Seq struct ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chan_shown, struct ListBase *seqbasep); void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown); + +/* ********************************************************************** + * sequencer scene functions + * ********************************************************************** */ +struct Editing *BKE_sequencer_editing_get(struct Scene *scene, int alloc); +struct Editing *BKE_sequencer_editing_ensure(struct Scene *scene); +void BKE_sequencer_editing_free(struct Scene *scene); + +void BKE_sequencer_sort(struct Scene *scene); + +struct Sequence *BKE_sequencer_active_get(struct Scene *scene); +int BKE_sequencer_active_get_pair(struct Scene *scene, + struct Sequence **seq_act, struct Sequence **seq_other); +void BKE_sequencer_active_set(struct Scene *scene, struct Sequence *seq); + + /* apply functions recursively */ int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg); int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg); @@ -179,14 +195,12 @@ int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence void seq_free_sequence(struct Scene *scene, struct Sequence *seq); void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq); void seq_free_strip(struct Strip *strip); -void seq_free_editing(struct Scene *scene); + void seq_free_clipboard(void); -struct Editing *seq_give_editing(struct Scene *scene, int alloc); const char *give_seqname(struct Sequence *seq); void calc_sequence(struct Scene *scene, struct Sequence *seq); void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range); -void sort_seq(struct Scene *scene); void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq, int (*test_func)(struct Sequence * seq)); int evaluate_seq_frame(struct Scene *scene, int cfra); @@ -296,10 +310,6 @@ void clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); struct Sequence *get_seq_by_name(struct ListBase *seqbase, const char *name, int recursive); -struct Sequence *seq_active_get(struct Scene *scene); -void seq_active_set(struct Scene *scene, struct Sequence *seq); -int seq_active_pair_get(struct Scene *scene, struct Sequence **seq_act, struct Sequence **seq_other); - /* api for adding new sequence strips */ typedef struct SeqLoadInfo { int start_frame; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 968f49357e6..f2b963a7edb 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -266,7 +266,7 @@ void BKE_scene_free(Scene *sce) } BLI_freelistN(&sce->base); - seq_free_editing(sce); + BKE_sequencer_editing_free(sce); BKE_free_animdata((ID *)sce); BKE_keyingsets_free(&sce->keyingsets); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index f36c123e227..9c3c1da5f55 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -216,13 +216,10 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq) } -Editing *seq_give_editing(Scene *scene, int alloc) +Editing *BKE_sequencer_editing_get(Scene *scene, int alloc) { - if (scene->ed == NULL && alloc) { - Editing *ed; - - ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq"); - ed->seqbasep = &ed->seqbase; + if (alloc) { + BKE_sequencer_editing_ensure(scene); } return scene->ed; } @@ -250,7 +247,19 @@ void seq_free_clipboard(void) seqbase_clipboard.first = seqbase_clipboard.last = NULL; } -void seq_free_editing(Scene *scene) +Editing *BKE_sequencer_editing_ensure(Scene *scene) +{ + if (scene->ed == NULL) { + Editing *ed; + + ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq"); + ed->seqbasep = &ed->seqbase; + } + + return scene->ed; +} + +void BKE_sequencer_editing_free(Scene *scene) { Editing *ed = scene->ed; MetaStack *ms; @@ -754,11 +763,11 @@ void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range) calc_sequence(scene, seq); } -void sort_seq(Scene *scene) +void BKE_sequencer_sort(Scene *scene) { /* all strips together per kind, and in order of y location ("machine") */ ListBase seqbase, effbase; - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq, *seqt; @@ -1075,7 +1084,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr int evaluate_seq_frame(Scene *scene, int cfra) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq_arr[MAXSEQ + 1]; if (ed == NULL) return 0; @@ -2530,7 +2539,7 @@ static ImBuf *seq_render_strip_stack( ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown) { - Editing *ed = seq_give_editing(context.scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(context.scene, FALSE); int count; ListBase *seqbasep; @@ -3007,7 +3016,7 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq; if (ed == NULL) return; @@ -3254,7 +3263,7 @@ void seq_sound_init(Scene *scene, Sequence *seq) Sequence *seq_foreground_frame_get(Scene *scene, int frame) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq, *best_seq = NULL; int best_machine = -1; @@ -3660,26 +3669,26 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive) } -Sequence *seq_active_get(Scene *scene) +Sequence *BKE_sequencer_active_get(Scene *scene) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); if (ed == NULL) return NULL; return ed->act_seq; } -void seq_active_set(Scene *scene, Sequence *seq) +void BKE_sequencer_active_set(Scene *scene, Sequence *seq) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); if (ed == NULL) return; ed->act_seq = seq; } -int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other) +int BKE_sequencer_active_get_pair(Scene *scene, Sequence **seq_act, Sequence **seq_other) { - Editing *ed = seq_give_editing(scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); - *seq_act = seq_active_get(scene); + *seq_act = BKE_sequencer_active_get(scene); if (*seq_act == NULL) { return 0; @@ -3718,7 +3727,7 @@ void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load) if (seq_load->flag & SEQ_LOAD_REPLACE_SEL) { seq_load->flag |= SELECT; - seq_active_set(scene, seq); + BKE_sequencer_active_set(scene, seq); } if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) { @@ -3785,7 +3794,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); /* only for sound */ - Editing *ed = seq_give_editing(scene, TRUE); + Editing *ed = BKE_sequencer_editing_get(scene, TRUE); bSound *sound; Sequence *seq; /* generic strip vars */ @@ -4015,7 +4024,7 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, { Sequence *seq; Sequence *seqn = NULL; - Sequence *last_seq = seq_active_get(scene); + Sequence *last_seq = BKE_sequencer_active_get(scene); for (seq = seqbase->first; seq; seq = seq->next) { seq->tmp = NULL; @@ -4033,7 +4042,7 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, if (dupe_flag & SEQ_DUPE_CONTEXT) { if (seq == last_seq) { - seq_active_set(scene, seqn); + BKE_sequencer_active_set(scene, seqn); } } } |