Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-04-04 13:52:48 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2022-04-11 01:31:57 +0300
commit68f5c80ee85177825cd37a13d5d40a41ebf96009 (patch)
tree4dff43bbbfe153ffe173b50bebdaf9b5eaf5dc53 /source/blender/editors/space_sequencer/sequencer_draw.c
parentf89b7332c8bee71d0c651d225d7baacb7ca9fdbd (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/space_sequencer/sequencer_draw.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0ed366209f6..31e885d16f2 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -56,6 +56,7 @@
#include "RNA_prototypes.h"
+#include "SEQ_channels.h"
#include "SEQ_effects.h"
#include "SEQ_iterator.h"
#include "SEQ_prefetch.h"
@@ -95,6 +96,9 @@ void color3ubv_from_seq(const Scene *curscene,
const bool show_strip_color_tag,
uchar r_col[3])
{
+ Editing *ed = SEQ_editing_get(curscene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
+
if (show_strip_color_tag && (uint)seq->color_tag < SEQUENCE_COLOR_TOT &&
seq->color_tag != SEQUENCE_COLOR_NONE) {
bTheme *btheme = UI_GetTheme();
@@ -214,7 +218,7 @@ void color3ubv_from_seq(const Scene *curscene,
case SEQ_TYPE_SOUND_RAM:
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, r_col);
blendcol[0] = blendcol[1] = blendcol[2] = 128;
- if (seq->flag & SEQ_MUTE) {
+ if (SEQ_render_is_muted(channels, seq)) {
UI_GetColorPtrBlendShade3ubv(r_col, blendcol, r_col, 0.5, 20);
}
break;
@@ -568,6 +572,8 @@ static void drawmeta_contents(Scene *scene,
float y2,
const bool show_strip_color_tag)
{
+ Editing *ed = SEQ_editing_get(scene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
Sequence *seq;
uchar col[4];
@@ -625,7 +631,7 @@ static void drawmeta_contents(Scene *scene,
color3ubv_from_seq(scene, seq, show_strip_color_tag, col);
}
- if ((seqm->flag & SEQ_MUTE) || (seq->flag & SEQ_MUTE)) {
+ if (SEQ_render_is_muted(channels, seqm) || SEQ_render_is_muted(channels, seq)) {
col[3] = 64;
}
else {
@@ -919,7 +925,8 @@ static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
}
/* Draw info text on a sequence strip. */
-static void draw_seq_text_overlay(View2D *v2d,
+static void draw_seq_text_overlay(Scene *scene,
+ View2D *v2d,
Sequence *seq,
SpaceSeq *sseq,
float x1,
@@ -928,6 +935,8 @@ static void draw_seq_text_overlay(View2D *v2d,
float y2,
bool seq_active)
{
+ Editing *ed = SEQ_editing_get(scene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
char overlay_string[FILE_MAX];
size_t overlay_string_len = draw_seq_text_get_overlay_string(
sseq, seq, overlay_string, sizeof(overlay_string));
@@ -942,7 +951,7 @@ static void draw_seq_text_overlay(View2D *v2d,
col[3] = 255;
/* Make the text duller when the strip is muted. */
- if (seq->flag & SEQ_MUTE) {
+ if (SEQ_render_is_muted(channels, seq)) {
if (seq_active) {
UI_GetColorPtrShade3ubv(col, col, -70);
}
@@ -963,6 +972,8 @@ static void draw_seq_text_overlay(View2D *v2d,
static void draw_sequence_extensions_overlay(
Scene *scene, Sequence *seq, uint pos, float pixely, const bool show_strip_color_tag)
{
+ Editing *ed = SEQ_editing_get(scene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
float x1, x2, y1, y2;
uchar col[4], blend_col[3];
@@ -978,7 +989,7 @@ static void draw_sequence_extensions_overlay(
if (seq->flag & SELECT) {
UI_GetColorPtrShade3ubv(col, col, 50);
}
- col[3] = seq->flag & SEQ_MUTE ? MUTE_ALPHA : 200;
+ col[3] = SEQ_render_is_muted(channels, seq) ? MUTE_ALPHA : 200;
UI_GetColorPtrShade3ubv(col, blend_col, 10);
if (seq->startofs) {
@@ -1001,7 +1012,8 @@ static void draw_sequence_extensions_overlay(
GPU_blend(GPU_BLEND_NONE);
}
-static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, float y1)
+static void draw_color_strip_band(
+ ListBase *channels, Sequence *seq, uint pos, float text_margin_y, float y1)
{
uchar col[4];
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
@@ -1010,7 +1022,7 @@ static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y,
rgb_float_to_uchar(col, colvars->col);
/* Draw muted strips semi-transparent. */
- if (seq->flag & SEQ_MUTE) {
+ if (SEQ_render_is_muted(channels, seq)) {
col[3] = MUTE_ALPHA;
}
/* Draw background semi-transparent when overlapping strips. */
@@ -1047,6 +1059,8 @@ static void draw_seq_background(Scene *scene,
bool is_single_image,
bool show_strip_color_tag)
{
+ Editing *ed = SEQ_editing_get(scene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
uchar col[4];
GPU_blend(GPU_BLEND_ALPHA);
@@ -1066,7 +1080,7 @@ static void draw_seq_background(Scene *scene,
}
/* Draw muted strips semi-transparent. */
- if (seq->flag & SEQ_MUTE) {
+ if (SEQ_render_is_muted(channels, seq)) {
col[3] = MUTE_ALPHA;
}
/* Draw background semi-transparent when overlapping strips. */
@@ -1303,6 +1317,9 @@ static void draw_seq_strip(const bContext *C,
float pixelx,
bool seq_active)
{
+ Editing *ed = SEQ_editing_get(CTX_data_scene(C));
+ ListBase *channels = SEQ_channels_displayed_get(ed);
+
View2D *v2d = &region->v2d;
float x1, x2, y1, y2;
const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
@@ -1349,7 +1366,7 @@ static void draw_seq_strip(const bContext *C,
/* Draw a color band inside color strip. */
if (seq->type == SEQ_TYPE_COLOR && y_threshold) {
- draw_color_strip_band(seq, pos, text_margin_y, y1);
+ draw_color_strip_band(channels, seq, pos, text_margin_y, y1);
}
/* Draw strip offsets when flag is enabled or during "solo preview". */
@@ -1398,7 +1415,7 @@ static void draw_seq_strip(const bContext *C,
BLI_rctf_size_x(&region->v2d.cur) / region->winx);
}
/* Draw locked state. */
- if (seq->flag & SEQ_LOCK) {
+ if (SEQ_transform_is_locked(channels, seq)) {
draw_seq_locked(x1, y1, x2, y2);
}
@@ -1410,7 +1427,7 @@ static void draw_seq_strip(const bContext *C,
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- if ((seq->flag & SEQ_LOCK) == 0) {
+ if (!SEQ_transform_is_locked(channels, seq)) {
draw_seq_handle(
v2d, seq, handsize_clamped, SEQ_LEFTHANDLE, pos, seq_active, pixelx, y_threshold);
draw_seq_handle(
@@ -1437,7 +1454,7 @@ static void draw_seq_strip(const bContext *C,
if (((x2 - x1) > 32 * pixelx * U.dpi_fac) && ((y2 - y1) > 8 * pixely * U.dpi_fac)) {
/* Depending on the vertical space, draw text on top or in the center of strip. */
draw_seq_text_overlay(
- v2d, seq, sseq, x1, x2, y_threshold ? text_margin_y : y1, y2, seq_active);
+ scene, v2d, seq, sseq, x1, x2, y_threshold ? text_margin_y : y1, y2, seq_active);
}
}
}
@@ -2218,7 +2235,10 @@ void sequencer_draw_preview(const bContext *C,
}
if (!draw_backdrop && scene->ed != NULL) {
- SeqCollection *collection = SEQ_query_rendered_strips(scene->ed->seqbasep, timeline_frame, 0);
+ Editing *ed = SEQ_editing_get(scene);
+ ListBase *channels = SEQ_channels_displayed_get(ed);
+ SeqCollection *collection = SEQ_query_rendered_strips(
+ channels, ed->seqbasep, timeline_frame, 0);
Sequence *seq;
Sequence *active_seq = SEQ_select_active_get(scene);
SEQ_ITERATOR_FOREACH (seq, collection) {
@@ -2269,14 +2289,6 @@ static void draw_seq_timeline_channels(View2D *v2d)
immUnbindProgram();
}
-static void draw_seq_timeline_channel_numbers(ARegion *region)
-{
- View2D *v2d = &region->v2d;
- rcti rect;
- BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
- UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT);
-}
-
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
@@ -2695,6 +2707,7 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
UI_view2d_view_ortho(v2d);
draw_seq_timeline_channels(v2d);
+
if ((sseq->flag & SEQ_SHOW_OVERLAY) && (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_GRID)) {
U.v2d_min_gridsize *= 3;
UI_view2d_draw_lines_x__discrete_frames_or_seconds(
@@ -2748,8 +2761,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
UI_view2d_view_restore(C);
ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
-
- draw_seq_timeline_channel_numbers(region);
}
void draw_timeline_seq_display(const bContext *C, ARegion *region)