diff options
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/SEQ_time.h | 3 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sound.c | 4 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_add.c | 11 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_edit.c | 11 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_relations.c | 3 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_time.c | 29 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_transform.c | 13 | ||||
-rw-r--r-- | source/blender/sequencer/intern/utils.c | 15 | ||||
-rw-r--r-- | source/blender/sequencer/intern/utils.h | 3 |
9 files changed, 60 insertions, 32 deletions
diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h index 732e9bb985a..c9024614dfd 100644 --- a/source/blender/sequencer/SEQ_time.h +++ b/source/blender/sequencer/SEQ_time.h @@ -42,8 +42,7 @@ int SEQ_time_find_next_prev_edit(struct Scene *scene, const bool do_skip_mute, const bool do_center, const bool do_unselected); -void SEQ_time_update_sequence(struct Scene *scene, struct Sequence *seq); -void SEQ_time_update_sequence_bounds(struct Scene *scene, struct Sequence *seq); +void SEQ_time_update_sequence(struct Scene *scene, struct ListBase *seqbase, struct Sequence *seq); bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, const int timeline_frame); void SEQ_time_update_meta_strip_range(struct Scene *scene, struct Sequence *seq_meta); diff --git a/source/blender/sequencer/intern/sound.c b/source/blender/sequencer/intern/sound.c index c53aacddcfe..9fe9e644a74 100644 --- a/source/blender/sequencer/intern/sound.c +++ b/source/blender/sequencer/intern/sound.c @@ -51,7 +51,7 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, for (seq = seqbase->first; seq; seq = seq->next) { if (seq->type == SEQ_TYPE_META) { if (sequencer_refresh_sound_length_recursive(bmain, scene, &seq->seqbase)) { - SEQ_time_update_sequence(scene, seq); + SEQ_time_update_sequence(scene, seqbase, seq); changed = true; } } @@ -67,7 +67,7 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, seq->endofs *= fac; seq->start += (old - seq->startofs); /* So that visual/"real" start frame does not change! */ - SEQ_time_update_sequence(scene, seq); + SEQ_time_update_sequence(scene, seqbase, seq); changed = true; } } diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c index aa3f7c92dd8..6f635b5db5f 100644 --- a/source/blender/sequencer/intern/strip_add.c +++ b/source/blender/sequencer/intern/strip_add.c @@ -100,7 +100,7 @@ void SEQ_add_load_data_init(SeqLoadData *load_data, static void seq_add_generic_update(Scene *scene, ListBase *seqbase, Sequence *seq) { SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq); - SEQ_time_update_sequence_bounds(scene, seq); + SEQ_time_update_sequence(scene, seqbase, seq); SEQ_sort(seqbase); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -472,7 +472,7 @@ Sequence *SEQ_add_meta_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_ /* Set frames start and length. */ seqm->start = load_data->start_frame; seqm->len = 1; - SEQ_time_update_sequence(scene, seqm); + SEQ_time_update_sequence(scene, seqbase, seqm); return seqm; } @@ -644,7 +644,9 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo if (lock_range) { /* keep so we don't have to move the actual start and end points (only the data) */ - SEQ_time_update_sequence_bounds(scene, seq); + Editing *ed = SEQ_editing_get(scene); + ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); + SEQ_time_update_sequence(scene, seqbase, seq); prev_startdisp = seq->startdisp; prev_enddisp = seq->enddisp; } @@ -794,7 +796,8 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo SEQ_transform_fix_single_image_seq_offsets(seq); } - SEQ_time_update_sequence(scene, seq); + ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); + SEQ_time_update_sequence(scene, seqbase, seq); } void SEQ_add_movie_reload_if_needed(struct Main *bmain, diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c index cfac243e68f..747f0eb3deb 100644 --- a/source/blender/sequencer/intern/strip_edit.c +++ b/source/blender/sequencer/intern/strip_edit.c @@ -267,8 +267,9 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, SEQ_relations_invalidate_cache_preprocessed(scene, seq); /* Update meta. */ + ListBase *meta_seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, dst_seqm); SEQ_time_update_meta_strip_range(scene, dst_seqm); - SEQ_time_update_sequence(scene, dst_seqm); + SEQ_time_update_sequence(scene, meta_seqbase, dst_seqm); if (SEQ_transform_test_overlap(&dst_seqm->seqbase, seq)) { SEQ_transform_seqbase_shuffle(&dst_seqm->seqbase, seq, scene); } @@ -359,6 +360,7 @@ static bool seq_edit_split_effect_intersect_check(const Sequence *seq, const int static void seq_edit_split_handle_strip_offsets(Main *bmain, Scene *scene, + ListBase *seqbase, Sequence *left_seq, Sequence *right_seq, const int timeline_frame, @@ -374,7 +376,7 @@ static void seq_edit_split_handle_strip_offsets(Main *bmain, SEQ_add_reload_new_file(bmain, scene, right_seq, false); break; } - SEQ_time_update_sequence(scene, right_seq); + SEQ_time_update_sequence(scene, seqbase, right_seq); } if (seq_edit_split_effect_intersect_check(left_seq, timeline_frame)) { @@ -387,7 +389,7 @@ static void seq_edit_split_handle_strip_offsets(Main *bmain, SEQ_add_reload_new_file(bmain, scene, left_seq, false); break; } - SEQ_time_update_sequence(scene, left_seq); + SEQ_time_update_sequence(scene, seqbase, left_seq); } } @@ -509,7 +511,8 @@ Sequence *SEQ_edit_strip_split(Main *bmain, SEQ_collection_append_strip(right_seq, strips_to_delete); } - seq_edit_split_handle_strip_offsets(bmain, scene, left_seq, right_seq, timeline_frame, method); + seq_edit_split_handle_strip_offsets( + bmain, scene, seqbase, left_seq, right_seq, timeline_frame, method); left_seq = left_seq->next; right_seq = right_seq->next; } diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c index 444d3581b3d..d17a37cb9d8 100644 --- a/source/blender/sequencer/intern/strip_relations.c +++ b/source/blender/sequencer/intern/strip_relations.c @@ -330,7 +330,8 @@ static bool update_changed_seq_recurs( } if (len_change) { - SEQ_time_update_sequence(scene, seq); + ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); + SEQ_time_update_sequence(scene, seqbase, seq); } } diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index fd6c0805c23..3c80e1dba27 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -148,7 +148,7 @@ void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) scene, metaseq, metaseq_start(metaseq), metaseq_end(metaseq)); } -void SEQ_time_update_sequence_bounds(Scene *scene, Sequence *seq) +static void seq_time_update_sequence_bounds(Scene *scene, Sequence *seq) { if (seq->startofs && seq->startstill) { seq->startstill = 0; @@ -195,7 +195,7 @@ void SEQ_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta) SEQ_transform_set_right_handle_frame(seq_meta, seq_meta->enddisp); } -void SEQ_time_update_sequence(Scene *scene, Sequence *seq) +void SEQ_time_update_sequence(Scene *scene, ListBase *seqbase, Sequence *seq) { Sequence *seqm; @@ -203,7 +203,7 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq) seqm = seq->seqbase.first; while (seqm) { if (seqm->seqbase.first) { - SEQ_time_update_sequence(scene, seqm); + SEQ_time_update_sequence(scene, &seqm->seqbase, seqm); } seqm = seqm->next; } @@ -241,22 +241,25 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq) seq->len = seq->enddisp - seq->startdisp; } else { - SEQ_time_update_sequence_bounds(scene, seq); + seq_time_update_sequence_bounds(scene, seq); } } + else if (seq->type == SEQ_TYPE_META) { + seq_time_update_meta_strip(scene, seq); + } else { - if (seq->type == SEQ_TYPE_META) { - seq_time_update_meta_strip(scene, seq); - } + seq_time_update_sequence_bounds(scene, seq); + } - Editing *ed = SEQ_editing_get(scene); - MetaStack *ms = SEQ_meta_stack_active_get(ed); - if (ms != NULL) { - SEQ_time_update_meta_strip_range(scene, ms->parseq); - } + Editing *ed = SEQ_editing_get(scene); - SEQ_time_update_sequence_bounds(scene, seq); + /* Strip is inside meta strip */ + if (seqbase != &ed->seqbase) { + Sequence *meta = SEQ_get_meta_by_seqbase(&ed->seqbase, seqbase); + SEQ_time_update_meta_strip_range(scene, meta); } + + seq_time_update_sequence_bounds(scene, seq); } int SEQ_time_find_next_prev_edit(Scene *scene, diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c index 54ca4ef487f..8c214f66b96 100644 --- a/source/blender/sequencer/intern/strip_transform.c +++ b/source/blender/sequencer/intern/strip_transform.c @@ -253,7 +253,8 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delt SEQ_transform_set_right_handle_frame(seq, seq->enddisp + delta); } - SEQ_time_update_sequence(evil_scene, seq); + ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(evil_scene)); + SEQ_time_update_sequence(evil_scene, seqbase, seq); } /* return 0 if there weren't enough space */ @@ -266,7 +267,7 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, BLI_assert(ELEM(channel_delta, -1, 1)); test->machine += channel_delta; - SEQ_time_update_sequence(evil_scene, test); + SEQ_time_update_sequence(evil_scene, seqbasep, test); while (SEQ_transform_test_overlap(seqbasep, test)) { if ((channel_delta > 0) ? (test->machine >= MAXSEQ) : (test->machine < 1)) { break; @@ -275,7 +276,7 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, test->machine += channel_delta; /* XXX: I don't think this is needed since were only moving vertically, Campbell. */ - SEQ_time_update_sequence(evil_scene, test); + SEQ_time_update_sequence(evil_scene, seqbasep, test); } if (!SEQ_valid_strip_channel(test)) { @@ -295,7 +296,7 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, new_frame = new_frame + (test->start - test->startdisp); /* adjust by the startdisp */ SEQ_transform_translate_sequence(evil_scene, test, new_frame - test->start); - SEQ_time_update_sequence(evil_scene, test); + SEQ_time_update_sequence(evil_scene, seqbasep, test); return false; } @@ -355,7 +356,7 @@ static int shuffle_seq_time_offset(SeqCollection *strips_to_shuffle, } SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { - SEQ_time_update_sequence_bounds(scene, seq); /* corrects dummy startdisp/enddisp values */ + SEQ_time_update_sequence(scene, seqbasep, seq); /* corrects dummy startdisp/enddisp values */ } return tot_ofs; @@ -408,7 +409,7 @@ void SEQ_transform_offset_after_frame(Scene *scene, LISTBASE_FOREACH (Sequence *, seq, seqbase) { if (seq->startdisp >= timeline_frame) { SEQ_transform_translate_sequence(scene, seq, delta); - SEQ_time_update_sequence(scene, seq); + SEQ_time_update_sequence(scene, seqbase, seq); SEQ_relations_invalidate_cache_preprocessed(scene, seq); } } diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index 8421aab5217..71686065882 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -450,6 +450,21 @@ ListBase *SEQ_get_seqbase_by_seq(ListBase *seqbase, Sequence *seq) return NULL; } +Sequence *SEQ_get_meta_by_seqbase(ListBase *seqbase_main, ListBase *meta_seqbase) +{ + SeqCollection *strips = SEQ_query_all_strips_recursive(seqbase_main); + + Sequence *seq; + SEQ_ITERATOR_FOREACH (seq, strips) { + if (seq->type == SEQ_TYPE_META && &seq->seqbase == meta_seqbase) { + break; + } + } + + SEQ_collection_free(strips); + return seq; +} + /** * Only use as last resort when the StripElem is available but no the Sequence. * (needed for RNA) diff --git a/source/blender/sequencer/intern/utils.h b/source/blender/sequencer/intern/utils.h index 7aee7d229c9..512647ed2e2 100644 --- a/source/blender/sequencer/intern/utils.h +++ b/source/blender/sequencer/intern/utils.h @@ -28,9 +28,12 @@ extern "C" { #endif struct Scene; +struct ListBase; bool sequencer_seq_generates_image(struct Sequence *seq); void seq_open_anim_file(struct Scene *scene, struct Sequence *seq, bool openfile); +Sequence *SEQ_get_meta_by_seqbase(struct ListBase *seqbase_main, struct ListBase *meta_seqbase); + #ifdef __cplusplus } #endif |