diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-04-04 13:52:48 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-04-04 13:56:43 +0300 |
commit | 277fa2f441f4ab2c00e7f329ba34a3466956647c (patch) | |
tree | bde615d956239337f88575dc7ce79d26f0f6cf4f /source/blender/editors/transform | |
parent | 5a0b4e97e67446ef3a180acb0ad03b4cbf91b356 (diff) |
VSE: Add channel headers
This patch adds channel region to VSE timeline area for drawing channel
headers. It is synchronizedwith timeline region. 3 basic features are
implemented - channel visibility, locking and name.
Channel data is stored in `SeqTimelineChannel` which can be top-level
owned by `Editing`, or it is owned by meta strip to support nesting.
Strip properties are completely independent and channel properties are
applied on top of particular strip property, thus overriding it.
Implementation is separate from channel regions in other editors. This
is mainly because style and topology is quite different in VSE. But
also code seems to be much more readable this way.
Currently channels use functions similar to VSE timeline to draw
background to provide illusion of transparency, but only for background
and sfra/efra regions.
Great portion of this patch is change from using strip visibility and
lock status to include channel state - this is facilitated by functions
`SEQ_transform_is_locked` and `SEQ_render_is_muted`
Originally this included changes in D14263, but patch was split for
easier review.
Reviewed By: fsiddi, Severin
Differential Revision: https://developer.blender.org/D13836
Diffstat (limited to 'source/blender/editors/transform')
4 files changed, 35 insertions, 15 deletions
diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index 513d45ef4bf..b355b459c1e 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -17,8 +17,10 @@ #include "BKE_report.h" #include "ED_markers.h" +#include "ED_time_scrub_ui.h" #include "SEQ_animation.h" +#include "SEQ_channels.h" #include "SEQ_edit.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" @@ -66,17 +68,19 @@ typedef struct TransSeq { */ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_count, int *r_flag) { + Scene *scene = t->scene; + Editing *ed = SEQ_editing_get(t->scene); + ListBase *channels = SEQ_channels_displayed_get(ed); + /* for extend we need to do some tricks */ if (t->mode == TFM_TIME_EXTEND) { /* *** Extend Transform *** */ - - Scene *scene = t->scene; int cfra = CFRA; int left = SEQ_transform_get_left_handle_frame(seq); int right = SEQ_transform_get_right_handle_frame(seq); - if (((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) { + if (((seq->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, seq))) { *r_count = 0; *r_flag = 0; } @@ -115,7 +119,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_count, int *r_flag) /* Count */ /* Non nested strips (resect selection and handles) */ - if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) { + if ((seq->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, seq)) { *r_count = 0; *r_flag = 0; } @@ -771,6 +775,7 @@ static void flushTransSeq(TransInfo *t) seq->flag |= SEQ_OVERLAP; } } + SEQ_collection_free(transformed_strips); } diff --git a/source/blender/editors/transform/transform_convert_sequencer_image.c b/source/blender/editors/transform/transform_convert_sequencer_image.c index 4a7c8d74d8b..cbc2cab0a7a 100644 --- a/source/blender/editors/transform/transform_convert_sequencer_image.c +++ b/source/blender/editors/transform/transform_convert_sequencer_image.c @@ -15,6 +15,7 @@ #include "BKE_context.h" #include "BKE_report.h" +#include "SEQ_channels.h" #include "SEQ_iterator.h" #include "SEQ_relations.h" #include "SEQ_sequencer.h" @@ -121,7 +122,8 @@ void createTransSeqImageData(TransInfo *t) } ListBase *seqbase = SEQ_active_seqbase_get(ed); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, t->scene->r.cfra, 0); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, t->scene->r.cfra, 0); SEQ_filter_selected_strips(strips); const int count = SEQ_collection_len(strips); diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index 3b523708872..f2fb5b26305 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -36,6 +36,7 @@ #include "ED_screen.h" #include "ED_uvedit.h" +#include "SEQ_channels.h" #include "SEQ_iterator.h" #include "SEQ_sequencer.h" #include "SEQ_time.h" @@ -243,8 +244,10 @@ static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min } else if (area->spacetype == SPACE_SEQ) { Scene *scene = CTX_data_scene(C); - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, scene->r.cfra, 0); + Editing *ed = SEQ_editing_get(scene); + ListBase *seqbase = SEQ_active_seqbase_get(ed); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0); SEQ_filter_selected_strips(strips); int selected_strips = SEQ_collection_len(strips); if (selected_strips > 0) { @@ -303,7 +306,8 @@ static int gizmo2d_calc_transform_orientation(const bContext *C) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); ListBase *seqbase = SEQ_active_seqbase_get(ed); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, scene->r.cfra, 0); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0); SEQ_filter_selected_strips(strips); bool use_local_orient = SEQ_collection_len(strips) == 1; @@ -325,7 +329,8 @@ static float gizmo2d_calc_rotation(const bContext *C) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); ListBase *seqbase = SEQ_active_seqbase_get(ed); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, scene->r.cfra, 0); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0); SEQ_filter_selected_strips(strips); if (SEQ_collection_len(strips) == 1) { @@ -348,8 +353,10 @@ static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2]) { zero_v2(r_pivot); - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, scene->r.cfra, 0); + Editing *ed = SEQ_editing_get(scene); + ListBase *seqbase = SEQ_active_seqbase_get(ed); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0); SEQ_filter_selected_strips(strips); bool has_select = SEQ_collection_len(strips) != 0; @@ -385,8 +392,10 @@ static bool gizmo2d_calc_transform_pivot(const bContext *C, float r_pivot[2]) if (pivot_point == V3D_AROUND_CURSOR) { SEQ_image_preview_unit_to_px(scene, sseq->cursor, r_pivot); - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SeqCollection *strips = SEQ_query_rendered_strips(seqbase, scene->r.cfra, 0); + Editing *ed = SEQ_editing_get(scene); + ListBase *seqbase = SEQ_active_seqbase_get(ed); + ListBase *channels = SEQ_channels_displayed_get(ed); + SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0); SEQ_filter_selected_strips(strips); has_select = SEQ_collection_len(strips) != 0; SEQ_collection_free(strips); diff --git a/source/blender/editors/transform/transform_snap_sequencer.c b/source/blender/editors/transform/transform_snap_sequencer.c index 85e20d37278..cf229c9e9ec 100644 --- a/source/blender/editors/transform/transform_snap_sequencer.c +++ b/source/blender/editors/transform/transform_snap_sequencer.c @@ -18,8 +18,10 @@ #include "UI_view2d.h" +#include "SEQ_channels.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" +#include "SEQ_render.h" #include "SEQ_sequencer.h" #include "transform.h" @@ -121,14 +123,16 @@ static SeqCollection *seq_collection_extract_effects(SeqCollection *collection) static SeqCollection *query_snap_targets(const TransInfo *t, SeqCollection *snap_sources) { - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(t->scene)); + Editing *ed = SEQ_editing_get(t->scene); + ListBase *seqbase = SEQ_active_seqbase_get(ed); + ListBase *channels = SEQ_channels_displayed_get(ed); const short snap_flag = SEQ_tool_settings_snap_flag_get(t->scene); SeqCollection *snap_targets = SEQ_collection_create(__func__); LISTBASE_FOREACH (Sequence *, seq, seqbase) { if (seq->flag & SELECT) { continue; /* Selected are being transformed. */ } - if ((seq->flag & SEQ_MUTE) && (snap_flag & SEQ_SNAP_IGNORE_MUTED)) { + if (SEQ_render_is_muted(channels, seq) && (snap_flag & SEQ_SNAP_IGNORE_MUTED)) { continue; } if (seq->type == SEQ_TYPE_SOUND_RAM && (snap_flag & SEQ_SNAP_IGNORE_SOUND)) { |