diff options
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_channels.h | 34 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_iterator.h | 3 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_render.h | 5 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_transform.h | 7 | ||||
-rw-r--r-- | source/blender/sequencer/intern/channels.c | 83 | ||||
-rw-r--r-- | source/blender/sequencer/intern/effects.c | 8 | ||||
-rw-r--r-- | source/blender/sequencer/intern/iterator.c | 10 | ||||
-rw-r--r-- | source/blender/sequencer/intern/prefetch.c | 13 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.c | 31 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.h | 4 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.c | 19 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_edit.c | 14 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_time.c | 6 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_transform.c | 7 | ||||
-rw-r--r-- | source/blender/sequencer/intern/utils.c | 6 |
16 files changed, 224 insertions, 28 deletions
diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt index 58a364bad8a..30aec24a024 100644 --- a/source/blender/sequencer/CMakeLists.txt +++ b/source/blender/sequencer/CMakeLists.txt @@ -32,6 +32,7 @@ set(INC_SYS set(SRC SEQ_add.h SEQ_animation.h + SEQ_channels.h SEQ_clipboard.h SEQ_edit.h SEQ_effects.h @@ -49,6 +50,7 @@ set(SRC SEQ_utils.h intern/animation.c + intern/channels.c intern/clipboard.c intern/disk_cache.c intern/disk_cache.h diff --git a/source/blender/sequencer/SEQ_channels.h b/source/blender/sequencer/SEQ_channels.h new file mode 100644 index 00000000000..1d87875fb26 --- /dev/null +++ b/source/blender/sequencer/SEQ_channels.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. All rights reserved. */ + +#pragma once + +/** \file + * \ingroup sequencer + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct Editing; +struct ListBase; +struct Scene; +struct SeqTimelineChannel; + +struct ListBase *SEQ_channels_displayed_get(struct Editing *ed); +void SEQ_channels_displayed_set(struct Editing *ed, struct ListBase *channels); +void SEQ_channels_ensure(struct ListBase *channels); +void SEQ_channels_duplicate(struct ListBase *channels_dst, struct ListBase *channels_src); +void SEQ_channels_free(struct ListBase *channels); + +struct SeqTimelineChannel *SEQ_channel_get_by_index(const struct ListBase *channels, + const int channel_index); +char *SEQ_channel_name_get(struct ListBase *channels, const int channel_index); +bool SEQ_channel_is_locked(const struct SeqTimelineChannel *channel); +bool SEQ_channel_is_muted(const struct SeqTimelineChannel *channel); +int SEQ_channel_index_get(const struct SeqTimelineChannel *channel); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index 7465b3c42cd..8cb20d41ba2 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -208,7 +208,8 @@ SeqCollection *SEQ_query_all_strips_recursive(ListBase *seqbase); * \param displayed_channel: viewed channel. when set to 0, no channel filter is applied * \return strip collection */ -SeqCollection *SEQ_query_rendered_strips(ListBase *seqbase, +SeqCollection *SEQ_query_rendered_strips(ListBase *channels, + ListBase *seqbase, int timeline_frame, int displayed_channel); /** diff --git a/source/blender/sequencer/SEQ_render.h b/source/blender/sequencer/SEQ_render.h index fcf9f2365e1..bfe10d3eae9 100644 --- a/source/blender/sequencer/SEQ_render.h +++ b/source/blender/sequencer/SEQ_render.h @@ -104,6 +104,11 @@ struct StripElem *SEQ_render_give_stripelem(struct Sequence *seq, int timeline_f void SEQ_render_imbuf_from_sequencer_space(struct Scene *scene, struct ImBuf *ibuf); void SEQ_render_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4]); +/** + * Check if `seq` is muted for rendering. + * This function also checks `SeqTimelineChannel` flag. + */ +bool SEQ_render_is_muted(const struct ListBase *channels, const struct Sequence *seq); #ifdef __cplusplus } diff --git a/source/blender/sequencer/SEQ_transform.h b/source/blender/sequencer/SEQ_transform.h index 223077894b2..eb910a5a5d1 100644 --- a/source/blender/sequencer/SEQ_transform.h +++ b/source/blender/sequencer/SEQ_transform.h @@ -11,6 +11,7 @@ extern "C" { #endif +struct Editing; struct ListBase; struct Scene; struct SeqCollection; @@ -67,6 +68,12 @@ void SEQ_transform_offset_after_frame(struct Scene *scene, int delta, int timeline_frame); +/** + * Check if `seq` can be moved. + * This function also checks `SeqTimelineChannel` flag. + */ +bool SEQ_transform_is_locked(struct ListBase *channels, struct Sequence *seq); + /* Image transformation. */ void SEQ_image_transform_mirror_factor_get(const struct Sequence *seq, float r_mirror[2]); diff --git a/source/blender/sequencer/intern/channels.c b/source/blender/sequencer/intern/channels.c new file mode 100644 index 00000000000..e8e82af03f5 --- /dev/null +++ b/source/blender/sequencer/intern/channels.c @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. All rights reserved. */ + +/** \file + * \ingroup sequencer + */ + +#include <string.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_listBase.h" +#include "DNA_scene_types.h" +#include "DNA_sequence_types.h" + +#include "BLI_blenlib.h" + +#include "SEQ_channels.h" +#include "SEQ_iterator.h" +#include "SEQ_relations.h" +#include "SEQ_sequencer.h" + +ListBase *SEQ_channels_displayed_get(Editing *ed) +{ + return ed->displayed_channels; +} + +void SEQ_channels_displayed_set(Editing *ed, ListBase *channels) +{ + ed->displayed_channels = channels; +} + +void SEQ_channels_ensure(ListBase *channels) +{ + /* Allocate channels. Channel 0 is never used, but allocated to prevent off by 1 issues. */ + for (int i = 0; i < MAXSEQ + 1; i++) { + SeqTimelineChannel *channel = MEM_callocN(sizeof(SeqTimelineChannel), "seq timeline channel"); + BLI_snprintf(channel->name, sizeof(channel->name), "Channel %d", i); + channel->index = i; + BLI_addtail(channels, channel); + } +} + +void SEQ_channels_duplicate(ListBase *channels_dst, ListBase *channels_src) +{ + LISTBASE_FOREACH (SeqTimelineChannel *, channel, channels_src) { + SeqTimelineChannel *channel_duplicate = MEM_dupallocN(channel); + BLI_addtail(channels_dst, channel_duplicate); + } +} + +void SEQ_channels_free(ListBase *channels) +{ + LISTBASE_FOREACH_MUTABLE (SeqTimelineChannel *, channel, channels) { + MEM_freeN(channel); + } +} + +SeqTimelineChannel *SEQ_channel_get_by_index(const ListBase *channels, const int channel_index) +{ + return BLI_findlink(channels, channel_index); +} + +char *SEQ_channel_name_get(ListBase *channels, const int channel_index) +{ + SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, channel_index); + return channel->name; +} + +int SEQ_channel_index_get(const SeqTimelineChannel *channel) +{ + return channel->index; +} + +bool SEQ_channel_is_locked(const SeqTimelineChannel *channel) +{ + return (channel->flag & SEQ_CHANNEL_LOCK) != 0; +} + +bool SEQ_channel_is_muted(const SeqTimelineChannel *channel) +{ + return (channel->flag & SEQ_CHANNEL_MUTE) != 0; +} diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index a4ab7671eb0..70f83485bb5 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -2422,6 +2422,7 @@ static ImBuf *do_multicam(const SeqRenderData *context, ImBuf *out; Editing *ed; ListBase *seqbasep; + ListBase *channels = &seq->channels; if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) { return NULL; @@ -2436,7 +2437,8 @@ static ImBuf *do_multicam(const SeqRenderData *context, return NULL; } - out = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->multicam_source, seqbasep); + out = seq_render_give_ibuf_seqbase( + context, timeline_frame, seq->multicam_source, channels, seqbasep); return out; } @@ -2462,6 +2464,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl { Editing *ed; ListBase *seqbasep; + ListBase *channels = &seq->channels; ImBuf *i = NULL; ed = context->scene->ed; @@ -2474,7 +2477,8 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl timeline_frame = clamp_i(timeline_frame, seq->startdisp, seq->enddisp - 1); if (seq->machine > 1) { - i = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->machine - 1, seqbasep); + i = seq_render_give_ibuf_seqbase( + context, timeline_frame, seq->machine - 1, channels, seqbasep); } /* Found nothing? so let's work the way up the meta-strip stack, so diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c index 4b378738c89..a4d8cf79d1f 100644 --- a/source/blender/sequencer/intern/iterator.c +++ b/source/blender/sequencer/intern/iterator.c @@ -20,6 +20,7 @@ #include "BKE_scene.h" #include "SEQ_iterator.h" +#include "SEQ_render.h" #include "SEQ_time.h" #include "render.h" @@ -285,14 +286,14 @@ static bool must_render_strip(const Sequence *seq, SeqCollection *strips_at_time } /* Remove strips we don't want to render from collection. */ -static void collection_filter_rendered_strips(SeqCollection *collection) +static void collection_filter_rendered_strips(ListBase *channels, SeqCollection *collection) { Sequence *seq; /* Remove sound strips and muted strips from collection, because these are not rendered. * Function #must_render_strip() don't have to check for these strips anymore. */ SEQ_ITERATOR_FOREACH (seq, collection) { - if (seq->type == SEQ_TYPE_SOUND_RAM || (seq->flag & SEQ_MUTE) != 0) { + if (seq->type == SEQ_TYPE_SOUND_RAM || SEQ_render_is_muted(channels, seq)) { SEQ_collection_remove_strip(seq, collection); } } @@ -305,7 +306,8 @@ static void collection_filter_rendered_strips(SeqCollection *collection) } } -SeqCollection *SEQ_query_rendered_strips(ListBase *seqbase, +SeqCollection *SEQ_query_rendered_strips(ListBase *channels, + ListBase *seqbase, const int timeline_frame, const int displayed_channel) { @@ -313,7 +315,7 @@ SeqCollection *SEQ_query_rendered_strips(ListBase *seqbase, if (displayed_channel != 0) { collection_filter_channel_up_to_incl(collection, displayed_channel); } - collection_filter_rendered_strips(collection); + collection_filter_rendered_strips(channels, collection); return collection; } diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index 0b5ab0dd86c..01f581bc6c1 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -37,6 +37,7 @@ #include "DEG_depsgraph_debug.h" #include "DEG_depsgraph_query.h" +#include "SEQ_channels.h" #include "SEQ_iterator.h" #include "SEQ_prefetch.h" #include "SEQ_relations.h" @@ -387,19 +388,20 @@ static bool seq_prefetch_seq_has_disk_cache(PrefetchJob *pfjob, } static bool seq_prefetch_scene_strip_is_rendered(PrefetchJob *pfjob, + ListBase *channels, ListBase *seqbase, SeqCollection *scene_strips, bool is_recursive_check) { float cfra = seq_prefetch_cfra(pfjob); Sequence *seq_arr[MAXSEQ + 1]; - int count = seq_get_shown_sequences(seqbase, cfra, 0, seq_arr); + int count = seq_get_shown_sequences(channels, seqbase, cfra, 0, seq_arr); /* Iterate over rendered strips. */ for (int i = 0; i < count; i++) { Sequence *seq = seq_arr[i]; if (seq->type == SEQ_TYPE_META && - seq_prefetch_scene_strip_is_rendered(pfjob, &seq->seqbase, scene_strips, true)) { + seq_prefetch_scene_strip_is_rendered(pfjob, channels, &seq->seqbase, scene_strips, true)) { return true; } @@ -433,10 +435,10 @@ static SeqCollection *query_scene_strips(ListBase *seqbase) /* Prefetch must avoid rendering scene strips, because rendering in background locks UI and can * make it unresponsive for long time periods. */ -static bool seq_prefetch_must_skip_frame(PrefetchJob *pfjob, ListBase *seqbase) +static bool seq_prefetch_must_skip_frame(PrefetchJob *pfjob, ListBase *channels, ListBase *seqbase) { SeqCollection *scene_strips = query_scene_strips(seqbase); - if (seq_prefetch_scene_strip_is_rendered(pfjob, seqbase, scene_strips, false)) { + if (seq_prefetch_scene_strip_is_rendered(pfjob, channels, seqbase, scene_strips, false)) { SEQ_collection_free(scene_strips); return true; } @@ -485,7 +487,8 @@ static void *seq_prefetch_frames(void *job) pfjob->scene_eval->ed->prefetch_job = pfjob; ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene_eval)); - if (seq_prefetch_must_skip_frame(pfjob, seqbase)) { + ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(pfjob->scene_eval)); + if (seq_prefetch_must_skip_frame(pfjob, channels, seqbase)) { pfjob->num_frames_prefetched++; continue; } diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 3f4d1e875f3..18b0794dc72 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -50,6 +50,7 @@ #include "RE_engine.h" #include "RE_pipeline.h" +#include "SEQ_channels.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" #include "SEQ_modifier.h" @@ -72,6 +73,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, + ListBase *channels, ListBase *seqbasep, float timeline_frame, int chanshown); @@ -256,12 +258,14 @@ static int seq_channel_cmp_fn(const void *a, const void *b) return (*(Sequence **)a)->machine - (*(Sequence **)b)->machine; } -int seq_get_shown_sequences(ListBase *seqbase, +int seq_get_shown_sequences(ListBase *channels, + ListBase *seqbase, const int timeline_frame, const int chanshown, Sequence **r_seq_arr) { - SeqCollection *collection = SEQ_query_rendered_strips(seqbase, timeline_frame, chanshown); + SeqCollection *collection = SEQ_query_rendered_strips( + channels, seqbase, timeline_frame, chanshown); const int strip_count = BLI_gset_len(collection->set); if (strip_count > MAXSEQ) { @@ -1582,6 +1586,7 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, { ImBuf *ibuf = NULL; ListBase *seqbase = NULL; + ListBase *channels = &seq->channels; int offset; seqbase = SEQ_get_seqbase_from_sequence(seq, &offset); @@ -1594,6 +1599,7 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, ibuf = seq_render_strip_stack(context, state, + channels, seqbase, /* scene strips don't have their start taken into account */ frame_index + offset, @@ -1809,6 +1815,7 @@ static ImBuf *seq_render_strip_stack_apply_effect( static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, + ListBase *channels, ListBase *seqbasep, float timeline_frame, int chanshown) @@ -1818,7 +1825,8 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, int i; ImBuf *out = NULL; - count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); + count = seq_get_shown_sequences( + channels, seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); if (count == 0) { return NULL; @@ -1909,6 +1917,7 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, Scene *scene = context->scene; Editing *ed = SEQ_editing_get(scene); ListBase *seqbasep; + ListBase *channels; if (ed == NULL) { return NULL; @@ -1918,9 +1927,11 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int count = BLI_listbase_count(&ed->metastack); count = max_ii(count + chanshown, 0); seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep; + channels = ((MetaStack *)BLI_findlink(&ed->metastack, count))->old_channels; } else { seqbasep = ed->seqbasep; + channels = ed->displayed_channels; } SeqRenderState state; @@ -1929,7 +1940,7 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, Sequence *seq_arr[MAXSEQ + 1]; int count; - count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr); + count = seq_get_shown_sequences(channels, seqbasep, timeline_frame, chanshown, seq_arr); if (count) { out = seq_cache_get(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT); @@ -1941,7 +1952,7 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, if (count && !out) { BLI_mutex_lock(&seq_render_mutex); - out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); + out = seq_render_strip_stack(context, &state, channels, seqbasep, timeline_frame, chanshown); if (context->is_prefetch_render) { seq_cache_put(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out); @@ -1961,12 +1972,13 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, ImBuf *seq_render_give_ibuf_seqbase(const SeqRenderData *context, float timeline_frame, int chan_shown, + ListBase *channels, ListBase *seqbasep) { SeqRenderState state; seq_render_state_init(&state); - return seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chan_shown); + return seq_render_strip_stack(context, &state, channels, seqbasep, timeline_frame, chan_shown); } ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, @@ -2135,4 +2147,11 @@ void SEQ_render_thumbnails_base_set(const SeqRenderData *context, } } +bool SEQ_render_is_muted(const ListBase *channels, const Sequence *seq) +{ + + SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, seq->machine); + return seq->flag & SEQ_MUTE || SEQ_channel_is_muted(channel); +} + /** \} */ diff --git a/source/blender/sequencer/intern/render.h b/source/blender/sequencer/intern/render.h index 9a41cd8888a..d41a0e3f86f 100644 --- a/source/blender/sequencer/intern/render.h +++ b/source/blender/sequencer/intern/render.h @@ -33,6 +33,7 @@ void seq_render_state_init(SeqRenderState *state); struct ImBuf *seq_render_give_ibuf_seqbase(const struct SeqRenderData *context, float timeline_frame, int chan_shown, + struct ListBase *channels, struct ListBase *seqbasep); struct ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const struct SeqRenderData *context, @@ -43,7 +44,8 @@ struct ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, struct ImBuf *ibuf2, struct ImBuf *ibuf3); void seq_imbuf_to_sequencer_space(struct Scene *scene, struct ImBuf *ibuf, bool make_float); -int seq_get_shown_sequences(struct ListBase *seqbase, +int seq_get_shown_sequences(struct ListBase *channels, + struct ListBase *seqbase, int timeline_frame, int chanshown, struct Sequence **r_seq_arr); diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 345d26718fd..baa06e133b7 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -27,6 +27,7 @@ #include "IMB_colormanagement.h" #include "IMB_imbuf.h" +#include "SEQ_channels.h" #include "SEQ_edit.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" @@ -135,6 +136,10 @@ Sequence *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int seq->color_tag = SEQUENCE_COLOR_NONE; + if (seq->type == SEQ_TYPE_META) { + SEQ_channels_ensure(&seq->channels); + } + SEQ_relations_session_uuid_generate(seq); return seq; @@ -201,6 +206,9 @@ static void seq_sequence_free_ex(Scene *scene, SEQ_relations_invalidate_cache_raw(scene, seq); } } + if (seq->type == SEQ_TYPE_META) { + SEQ_channels_free(&seq->channels); + } MEM_freeN(seq); } @@ -260,6 +268,7 @@ void SEQ_editing_free(Scene *scene, const bool do_id_user) BLI_freelistN(&ed->metastack); SEQ_sequence_lookup_free(scene); + SEQ_channels_free(&ed->channels); MEM_freeN(ed); scene->ed = NULL; @@ -386,6 +395,7 @@ MetaStack *SEQ_meta_stack_alloc(Editing *ed, Sequence *seq_meta) BLI_addtail(&ed->metastack, ms); ms->parseq = seq_meta; ms->oldbasep = ed->seqbasep; + ms->old_channels = ed->displayed_channels; copy_v2_v2_int(ms->disp_range, &ms->parseq->startdisp); return ms; } @@ -460,6 +470,9 @@ static Sequence *seq_dupli(const Scene *scene_src, BLI_listbase_clear(&seqn->seqbase); /* WARNING: This meta-strip is not recursively duplicated here - do this after! */ // seq_dupli_recursive(&seq->seqbase, &seqn->seqbase); + + BLI_listbase_clear(&seqn->channels); + SEQ_channels_duplicate(&seqn->channels, &seq->channels); } else if (seq->type == SEQ_TYPE_SCENE) { seqn->strip->stripdata = NULL; @@ -686,6 +699,10 @@ static bool seq_write_data_cb(Sequence *seq, void *userdata) } SEQ_modifier_blend_write(writer, &seq->modifiers); + + LISTBASE_FOREACH (SeqTimelineChannel *, channel, &seq->channels) { + BLO_write_struct(writer, SeqTimelineChannel, channel); + } return true; } @@ -753,6 +770,8 @@ static bool seq_read_data_cb(Sequence *seq, void *user_data) } SEQ_modifier_blend_read_data(reader, &seq->modifiers); + + BLO_read_list(reader, &seq->channels); return true; } void SEQ_blend_read(BlendDataReader *reader, ListBase *seqbase) diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c index 2f76b6240cf..d678518e3b0 100644 --- a/source/blender/sequencer/intern/strip_edit.c +++ b/source/blender/sequencer/intern/strip_edit.c @@ -31,6 +31,7 @@ #include "SEQ_effects.h" #include "SEQ_iterator.h" #include "SEQ_relations.h" +#include "SEQ_render.h" #include "SEQ_sequencer.h" #include "SEQ_time.h" #include "SEQ_transform.h" @@ -91,7 +92,10 @@ int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_ return 1; } -static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute) +static void seq_update_muting_recursive(ListBase *channels, + ListBase *seqbasep, + Sequence *metaseq, + int mute) { Sequence *seq; int seqmute; @@ -99,7 +103,7 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i /* For sound we go over full meta tree to update muted state, * since sound is played outside of evaluating the imbufs. */ for (seq = seqbasep->first; seq; seq = seq->next) { - seqmute = (mute || (seq->flag & SEQ_MUTE)); + seqmute = (mute || SEQ_render_is_muted(channels, seq)); if (seq->type == SEQ_TYPE_META) { /* if this is the current meta sequence, unmute because @@ -108,7 +112,7 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i seqmute = 0; } - seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute); + seq_update_muting_recursive(&seq->channels, &seq->seqbase, metaseq, seqmute); } else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { if (seq->scene_sound) { @@ -125,10 +129,10 @@ void SEQ_edit_update_muting(Editing *ed) MetaStack *ms = ed->metastack.last; if (ms) { - seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1); + seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, 1); } else { - seq_update_muting_recursive(&ed->seqbase, NULL, 0); + seq_update_muting_recursive(&ed->channels, &ed->seqbase, NULL, 0); } } } diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index ec908dcdc93..06571b7ad43 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -20,6 +20,7 @@ #include "DNA_sound_types.h" #include "IMB_imbuf.h" +#include "SEQ_channels.h" #include "SEQ_iterator.h" #include "SEQ_render.h" #include "SEQ_sequencer.h" @@ -321,6 +322,7 @@ int SEQ_time_find_next_prev_edit(Scene *scene, const bool do_unselected) { Editing *ed = SEQ_editing_get(scene); + ListBase *channels = SEQ_channels_displayed_get(ed); Sequence *seq; int dist, best_dist, best_frame = timeline_frame; @@ -338,7 +340,7 @@ int SEQ_time_find_next_prev_edit(Scene *scene, for (seq = ed->seqbasep->first; seq; seq = seq->next) { int i; - if (do_skip_mute && (seq->flag & SEQ_MUTE)) { + if (do_skip_mute && SEQ_render_is_muted(channels, seq)) { continue; } @@ -442,7 +444,7 @@ void SEQ_timeline_expand_boundbox(const ListBase *seqbase, rctf *rect) if (rect->xmax < seq->enddisp + 1) { rect->xmax = seq->enddisp + 1; } - if (rect->ymax < seq->machine + 2) { + if (rect->ymax < seq->machine) { rect->ymax = seq->machine + 2; } } diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c index ddf75f3d664..618fed079f4 100644 --- a/source/blender/sequencer/intern/strip_transform.c +++ b/source/blender/sequencer/intern/strip_transform.c @@ -17,6 +17,7 @@ #include "BKE_sound.h" #include "SEQ_animation.h" +#include "SEQ_channels.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" #include "SEQ_relations.h" @@ -391,6 +392,12 @@ void SEQ_transform_offset_after_frame(Scene *scene, } } +bool SEQ_transform_is_locked(ListBase *channels, Sequence *seq) +{ + SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, seq->machine); + return seq->flag & SEQ_LOCK || SEQ_channel_is_locked(channel); +} + void SEQ_image_transform_mirror_factor_get(const Sequence *seq, float r_mirror[2]) { r_mirror[0] = 1.0f; diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index 0c37fb11c04..da422c4228f 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -24,6 +24,7 @@ #include "BKE_scene.h" #include "SEQ_animation.h" +#include "SEQ_channels.h" #include "SEQ_edit.h" #include "SEQ_iterator.h" #include "SEQ_relations.h" @@ -380,7 +381,8 @@ void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile) const Sequence *SEQ_get_topmost_sequence(const Scene *scene, int frame) { - const Editing *ed = scene->ed; + Editing *ed = scene->ed; + ListBase *channels = SEQ_channels_displayed_get(ed); const Sequence *seq, *best_seq = NULL; int best_machine = -1; @@ -389,7 +391,7 @@ const Sequence *SEQ_get_topmost_sequence(const Scene *scene, int frame) } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if (seq->flag & SEQ_MUTE || !SEQ_time_strip_intersects_frame(seq, frame)) { + if (SEQ_render_is_muted(channels, seq) || !SEQ_time_strip_intersects_frame(seq, frame)) { continue; } /* Only use strips that generate an image, not ones that combine |