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>2021-09-20 17:21:40 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-09-20 17:30:15 +0300
commit7cb65e45814db6559ffa48c26b3d000e0f78c4bb (patch)
tree69794af2edf1d1f18c498b16176c5bed9482250a /source/blender/editors
parent9642447faf1054664cf68b302a563c0a1145b7d7 (diff)
Cleanup: Refactor VSE overlay settings
Move overlay flags into SequencerPreviewOverlay and SequencerTimelineOverlay structs. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D12569
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c2
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c47
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c9
4 files changed, 33 insertions, 27 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 65c5b8ee573..68e2aece6e2 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1418,7 +1418,7 @@ static void annotation_visible_on_space(tGPsdata *p)
}
case SPACE_SEQ: {
SpaceSeq *sseq = (SpaceSeq *)area->spacedata.first;
- sseq->flag |= SEQ_SHOW_GPENCIL;
+ sseq->flag |= SEQ_PREVIEW_SHOW_GPENCIL;
break;
}
case SPACE_IMAGE: {
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 834c023dde9..e4bbbfb0f57 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -303,7 +303,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
if (oglrender->is_sequencer) {
SpaceSeq *sseq = oglrender->sseq;
- struct bGPdata *gpd = (sseq && (sseq->flag & SEQ_SHOW_GPENCIL)) ? sseq->gpd : NULL;
+ struct bGPdata *gpd = (sseq && (sseq->flag & SEQ_PREVIEW_SHOW_GPENCIL)) ? sseq->gpd : NULL;
/* use pre-calculated ImBuf (avoids deadlock), see: */
ImBuf *ibuf = oglrender->seq_data.ibufs_arr[oglrender->view_id];
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index bf817005a08..5b39feacfe3 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -327,7 +327,8 @@ static void draw_seq_waveform_overlay(View2D *v2d,
float y2,
float frames_per_pixel)
{
- if (seq->sound && ((sseq->flag & SEQ_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
+ if (seq->sound &&
+ ((sseq->flag & SEQ_TIMELINE_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
/* Make sure that the start drawing position is aligned to the pixels on the screen to avoid
* flickering when moving around the strip.
* To do this we figure out the fractional offset in pixel space by checking where the
@@ -876,12 +877,12 @@ static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
const char *text_array[5];
int i = 0;
- if (sseq->flag & SEQ_SHOW_STRIP_NAME) {
+ if (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_NAME) {
text_array[i++] = draw_seq_text_get_name(seq);
}
char source[FILE_MAX];
- if (sseq->flag & SEQ_SHOW_STRIP_SOURCE) {
+ if (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE) {
draw_seq_text_get_source(seq, source, sizeof(source));
if (source[0] != '\0') {
if (i != 0) {
@@ -892,7 +893,7 @@ static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
}
char strip_duration_text[16];
- if (sseq->flag & SEQ_SHOW_STRIP_DURATION) {
+ if (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_DURATION) {
const int strip_duration = seq->enddisp - seq->startdisp;
SNPRINTF(strip_duration_text, "%d", strip_duration);
if (i != 0) {
@@ -1310,8 +1311,9 @@ static void draw_seq_strip(const bContext *C,
float text_margin_y;
bool y_threshold;
- if ((sseq->flag & SEQ_SHOW_STRIP_NAME) || (sseq->flag & SEQ_SHOW_STRIP_SOURCE) ||
- (sseq->flag & SEQ_SHOW_STRIP_DURATION)) {
+ if ((sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME) ||
+ (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE) ||
+ (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION)) {
/* Calculate height needed for drawing text on strip. */
text_margin_y = y2 - min_ff(0.40f, 20 * U.dpi_fac * pixely);
@@ -1335,9 +1337,10 @@ static void draw_seq_strip(const bContext *C,
}
/* Draw strip offsets when flag is enabled or during "solo preview". */
- if (sseq->flag & SEQ_SHOW_STRIP_OVERLAY) {
+ if (sseq->flag & SEQ_SHOW_OVERLAY) {
if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) {
- if ((sseq->draw_flag & SEQ_DRAW_OFFSET_EXT) || (seq == special_seq_update)) {
+ if ((sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS) ||
+ (seq == special_seq_update)) {
draw_sequence_extensions_overlay(scene, seq, pos, pixely);
}
}
@@ -1352,13 +1355,14 @@ static void draw_seq_strip(const bContext *C,
drawmeta_contents(scene, seq, x1, y1, x2, y2);
}
- if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & SEQ_SHOW_FCURVES)) {
+ if ((sseq->flag & SEQ_SHOW_OVERLAY) &&
+ (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_FCURVES)) {
draw_seq_fcurve_overlay(scene, v2d, seq, x1, y1, x2, y2, pixelx);
}
/* Draw sound strip waveform. */
- if ((seq->type == SEQ_TYPE_SOUND_RAM) && ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) &&
- (sseq->flag & SEQ_NO_WAVEFORMS) == 0) {
+ if ((seq->type == SEQ_TYPE_SOUND_RAM) && ((sseq->flag & SEQ_SHOW_OVERLAY)) &&
+ (sseq->timeline_overlay.flag & SEQ_TIMELINE_NO_WAVEFORMS) == 0) {
draw_seq_waveform_overlay(v2d,
C,
sseq,
@@ -1398,13 +1402,14 @@ static void draw_seq_strip(const bContext *C,
/* If a waveform is drawn, avoid drawing text when there is not enough vertical space. */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
- if (!y_threshold && (sseq->flag & SEQ_NO_WAVEFORMS) == 0 &&
- ((sseq->flag & SEQ_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
+ if (!y_threshold && (sseq->timeline_overlay.flag & SEQ_TIMELINE_NO_WAVEFORMS) == 0 &&
+ ((sseq->timeline_overlay.flag & SEQ_TIMELINE_ALL_WAVEFORMS) ||
+ (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
return;
}
}
- if (sseq->flag & SEQ_SHOW_STRIP_OVERLAY) {
+ if (sseq->flag & SEQ_SHOW_OVERLAY) {
/* Don't draw strip if there is not enough vertical or horizontal space. */
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. */
@@ -1647,7 +1652,7 @@ static void sequencer_draw_borders_overlay(const SpaceSeq *sseq,
imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
/* Draw safety border. */
- if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
+ if (sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_SAFE_MARGINS) {
immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f);
UI_draw_safe_areas(shdr_pos,
@@ -1660,7 +1665,7 @@ static void sequencer_draw_borders_overlay(const SpaceSeq *sseq,
scene->safe_areas.title,
scene->safe_areas.action);
- if (sseq->flag & SEQ_SHOW_SAFE_CENTER) {
+ if (sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_SAFE_CENTER) {
UI_draw_safe_areas(shdr_pos,
&(const rctf){
.xmin = x1,
@@ -2067,7 +2072,7 @@ void sequencer_draw_preview(const bContext *C,
struct ImBuf *scope = NULL;
float viewrect[2];
const bool show_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
- const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
+ const bool draw_gpencil = ((sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_GPENCIL) && sseq->gpd);
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
sequencer_stop_running_jobs(C, scene);
@@ -2118,16 +2123,16 @@ void sequencer_draw_preview(const bContext *C,
C, scene, region, sseq, ibuf, scope, draw_overlay, draw_backdrop);
/* Draw over image. */
- if (sseq->flag & SEQ_SHOW_METADATA && sseq->flag & SEQ_SHOW_STRIP_OVERLAY) {
+ if (sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_METADATA && sseq->flag & SEQ_SHOW_OVERLAY) {
ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
}
}
- if (show_imbuf && (sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) {
+ if (show_imbuf && (sseq->flag & SEQ_SHOW_OVERLAY)) {
sequencer_draw_borders_overlay(sseq, v2d, scene);
}
- if (draw_gpencil && show_imbuf && (sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) {
+ if (draw_gpencil && show_imbuf && (sseq->flag & SEQ_SHOW_OVERLAY)) {
sequencer_draw_gpencil_overlay(C);
}
#if 0
@@ -2615,7 +2620,7 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
/* Get timeline bound-box, needed for the scroll-bars. */
SEQ_timeline_boundbox(scene, SEQ_active_seqbase_get(ed), &v2d->tot);
draw_seq_backdrop(v2d);
- if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & SEQ_SHOW_GRID)) {
+ 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(
v2d, scene, (sseq->flag & SEQ_DRAWFRAMES) == 0, false);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 2a6e49edfb6..0d09f2564e8 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -98,9 +98,10 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
- sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES |
- SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
- SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID;
+ sseq->flag = SEQ_PREVIEW_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS |
+ SEQ_TIMELINE_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | SEQ_SHOW_OVERLAY |
+ SEQ_TIMELINE_SHOW_STRIP_NAME | SEQ_TIMELINE_SHOW_STRIP_SOURCE |
+ SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID;
/* Tool header. */
region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
@@ -699,7 +700,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
Scene *scene = CTX_data_scene(C);
wmWindowManager *wm = CTX_wm_manager(C);
const bool draw_overlay = (scene->ed && (scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) &&
- (sseq->flag & SEQ_SHOW_STRIP_OVERLAY));
+ (sseq->flag & SEQ_SHOW_OVERLAY));
/* XXX temp fix for wrong setting in sseq->mainb */
if (sseq->mainb == SEQ_DRAW_SEQUENCE) {