diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-09-20 17:21:40 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-09-20 17:30:15 +0300 |
commit | 7cb65e45814db6559ffa48c26b3d000e0f78c4bb (patch) | |
tree | 69794af2edf1d1f18c498b16176c5bed9482250a /source | |
parent | 9642447faf1054664cf68b302a563c0a1145b7d7 (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')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 53 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 47 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 58 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 208 |
12 files changed, 254 insertions, 143 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index d71cb559911..63d6b9121d2 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 22 +#define BLENDER_FILE_SUBVERSION 23 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index b71dd5a27bb..55252210a78 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -1800,7 +1800,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) } case SPACE_SEQ: { SpaceSeq *sseq = (SpaceSeq *)sl; - sseq->flag |= SEQ_SHOW_GPENCIL; + sseq->flag |= SEQ_PREVIEW_SHOW_GPENCIL; break; } case SPACE_IMAGE: { diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index bf0463432db..f667361d166 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -4966,7 +4966,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; - sseq->flag |= SEQ_SHOW_FCURVES; + sseq->flag |= SEQ_TIMELINE_SHOW_FCURVES; } } } diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index f023813555f..bafba486c88 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1529,8 +1529,8 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; - sseq->flag |= (SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME | SEQ_SHOW_STRIP_SOURCE | - SEQ_SHOW_STRIP_DURATION); + sseq->flag |= (SEQ_SHOW_OVERLAY | SEQ_TIMELINE_SHOW_STRIP_NAME | + SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_DURATION); } } } diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 538634f4c9e..30e7c9bde4c 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -1076,7 +1076,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; - sseq->flag |= SEQ_SHOW_GRID; + sseq->flag |= SEQ_TIMELINE_SHOW_GRID; } } } @@ -1250,18 +1250,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #blo_do_versions_userdef - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_ATLEAST(bmain, 300, 23)) { for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { @@ -1274,5 +1263,43 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SEQ) { + SpaceSeq *sseq = (SpaceSeq *)sl; + int seq_show_safe_margins = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_MARGINS); + int seq_show_gpencil = (sseq->flag & SEQ_PREVIEW_SHOW_GPENCIL); + int seq_show_fcurves = (sseq->flag & SEQ_TIMELINE_SHOW_FCURVES); + int seq_show_safe_center = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_CENTER); + int seq_show_metadata = (sseq->flag & SEQ_PREVIEW_SHOW_METADATA); + int seq_show_strip_name = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME); + int seq_show_strip_source = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE); + int seq_show_strip_duration = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION); + int seq_show_grid = (sseq->flag & SEQ_TIMELINE_SHOW_GRID); + int show_strip_offset = (sseq->draw_flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS); + sseq->preview_overlay.flag = (seq_show_safe_margins | seq_show_gpencil | + seq_show_safe_center | seq_show_metadata); + sseq->timeline_overlay.flag = (seq_show_fcurves | seq_show_strip_name | + seq_show_strip_source | seq_show_strip_duration | + seq_show_grid | show_strip_offset); + } + } + } + } + } + + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - "versioning_userdef.c", #blo_do_versions_userdef + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index ae0dbb7f808..074cae669af 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -156,12 +156,10 @@ static void blo_update_defaults_screen(bScreen *screen, } else if (area->spacetype == SPACE_SEQ) { SpaceSeq *seq = area->spacedata.first; - seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | - SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | SEQ_SHOW_STRIP_DURATION | - SEQ_SHOW_GRID; - + seq->flag |= SEQ_SHOW_MARKERS | SEQ_ZOOM_TO_FIT | SEQ_USE_PROXIES | SEQ_SHOW_OVERLAY; seq->render_size = SEQ_RENDER_SIZE_PROXY_100; - seq->flag |= SEQ_USE_PROXIES; + seq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_NAME | + SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID; } else if (area->spacetype == SPACE_TEXT) { /* Show syntax and line numbers in Script workspace text editor. */ 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) { diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 5475e1bacd8..6505816256c 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -576,6 +576,36 @@ typedef enum eSpaceNla_Flag { /** \name Sequence Editor * \{ */ +typedef struct SequencerPreviewOverlay { + int flag; + char _pad0[4]; +} SequencerPreviewOverlay; + +/* SequencerPreviewOverlay.flag */ +typedef enum eSpaceSeq_SequencerPreviewOverlay_Flag { + SEQ_PREVIEW_SHOW_SAFE_MARGINS = (1 << 3), + SEQ_PREVIEW_SHOW_GPENCIL = (1 << 4), + SEQ_PREVIEW_SHOW_SAFE_CENTER = (1 << 9), + SEQ_PREVIEW_SHOW_METADATA = (1 << 10), +} eSpaceSeq_SequencerPreviewOverlay_Flag; + +typedef struct SequencerTimelineOverlay { + int flag; + char _pad0[4]; +} SequencerTimelineOverlay; + +/* SequencerTimelineOverlay.flag */ +typedef enum eSpaceSeq_SequencerTimelineOverlay_Flag { + SEQ_TIMELINE_SHOW_STRIP_OFFSETS = (1 << 1), + SEQ_TIMELINE_SHOW_FCURVES = (1 << 5), + SEQ_TIMELINE_ALL_WAVEFORMS = (1 << 7), /* draw all waveforms */ + SEQ_TIMELINE_NO_WAVEFORMS = (1 << 8), /* draw no waveforms */ + SEQ_TIMELINE_SHOW_STRIP_NAME = (1 << 14), + SEQ_TIMELINE_SHOW_STRIP_SOURCE = (1 << 15), + SEQ_TIMELINE_SHOW_STRIP_DURATION = (1 << 16), + SEQ_TIMELINE_SHOW_GRID = (1 << 18), +} eSpaceSeq_SequencerTimelineOverlay_Flag; + /* Sequencer */ typedef struct SpaceSeq { SpaceLink *next, *prev; @@ -612,10 +642,13 @@ typedef struct SpaceSeq { /** Different scoped displayed in space. */ struct SequencerScopes scopes; + struct SequencerPreviewOverlay preview_overlay; + struct SequencerTimelineOverlay timeline_overlay; /** Multiview current eye - for internal use. */ char multiview_eye; char _pad2[7]; + } SpaceSeq; /* SpaceSeq.mainb */ @@ -630,7 +663,7 @@ typedef enum eSpaceSeq_RegionType { /* SpaceSeq.draw_flag */ typedef enum eSpaceSeq_DrawFlag { SEQ_DRAW_BACKDROP = (1 << 0), - SEQ_DRAW_OFFSET_EXT = (1 << 1), + SEQ_DRAW_UNUSED_1 = (1 << 1), SEQ_DRAW_TRANSFORM_PREVIEW = (1 << 2), } eSpaceSeq_DrawFlag; @@ -639,22 +672,19 @@ typedef enum eSpaceSeq_Flag { SEQ_DRAWFRAMES = (1 << 0), SEQ_MARKER_TRANS = (1 << 1), SEQ_DRAW_COLOR_SEPARATED = (1 << 2), - SEQ_SHOW_SAFE_MARGINS = (1 << 3), - SEQ_SHOW_GPENCIL = (1 << 4), - SEQ_SHOW_FCURVES = (1 << 5), - SEQ_USE_ALPHA = (1 << 6), /* use RGBA display mode for preview */ - SEQ_ALL_WAVEFORMS = (1 << 7), /* draw all waveforms */ - SEQ_NO_WAVEFORMS = (1 << 8), /* draw no waveforms */ - SEQ_SHOW_SAFE_CENTER = (1 << 9), - SEQ_SHOW_METADATA = (1 << 10), + SPACE_SEQ_FLAG_UNUSED_3 = (1 << 3), + SPACE_SEQ_FLAG_UNUSED_4 = (1 << 4), + SPACE_SEQ_FLAG_UNUSED_5 = (1 << 5), + SEQ_USE_ALPHA = (1 << 6), /* use RGBA display mode for preview */ + SPACE_SEQ_FLAG_UNUSED_9 = (1 << 9), + SPACE_SEQ_FLAG_UNUSED_10 = (1 << 10), SEQ_SHOW_MARKERS = (1 << 11), /* show markers region */ SEQ_ZOOM_TO_FIT = (1 << 12), - SEQ_SHOW_STRIP_OVERLAY = (1 << 13), - SEQ_SHOW_STRIP_NAME = (1 << 14), - SEQ_SHOW_STRIP_SOURCE = (1 << 15), - SEQ_SHOW_STRIP_DURATION = (1 << 16), + SEQ_SHOW_OVERLAY = (1 << 13), + SPACE_SEQ_FLAG_UNUSED_14 = (1 << 14), + SPACE_SEQ_FLAG_UNUSED_15 = (1 << 15), + SPACE_SEQ_FLAG_UNUSED_16 = (1 << 16), SEQ_USE_PROXIES = (1 << 17), - SEQ_SHOW_GRID = (1 << 18), } eSpaceSeq_Flag; /* SpaceSeq.view */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e3985b26eb0..8c331bd1911 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2326,6 +2326,16 @@ static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), ED_area_tag_refresh(area); } +static char *rna_SpaceSequencerPreviewOverlay_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("preview_overlay"); +} + +static char *rna_SpaceSequencerTimelineOverlay_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("timeline_overlay"); +} + /* Space Node Editor */ static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, @@ -5329,6 +5339,108 @@ static void rna_def_space_image(BlenderRNA *brna) rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mask_set"); } +static void rna_def_space_sequencer_preview_overlay(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SequencerPreviewOverlay", NULL); + RNA_def_struct_sdna(srna, "SequencerPreviewOverlay"); + RNA_def_struct_nested(brna, srna, "SpaceSequenceEditor"); + RNA_def_struct_path_func(srna, "rna_SpaceSequencerPreviewOverlay_path"); + RNA_def_struct_ui_text(srna, "Preview Overlay Settings", ""); + + prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_PREVIEW_SHOW_SAFE_MARGINS); + RNA_def_property_ui_text( + prop, "Safe Areas", "Show TV title safe and action safe areas in preview"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_PREVIEW_SHOW_SAFE_CENTER); + RNA_def_property_ui_text( + prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_PREVIEW_SHOW_METADATA); + RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_PREVIEW_SHOW_GPENCIL); + RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); +} + +static void rna_def_space_sequencer_timeline_overlay(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SequencerTimelineOverlay", NULL); + RNA_def_struct_sdna(srna, "SequencerTimelineOverlay"); + RNA_def_struct_nested(brna, srna, "SpaceSequenceEditor"); + RNA_def_struct_path_func(srna, "rna_SpaceSequencerTimelineOverlay_path"); + RNA_def_struct_ui_text(srna, "Timeline Overlay Settings", ""); + + static const EnumPropertyItem waveform_type_display_items[] = { + {SEQ_TIMELINE_NO_WAVEFORMS, + "NO_WAVEFORMS", + 0, + "Waveforms Off", + "Don't display waveforms for any sound strips"}, + {SEQ_TIMELINE_ALL_WAVEFORMS, + "ALL_WAVEFORMS", + 0, + "Waveforms On", + "Display waveforms for all sound strips"}, + {0, + "DEFAULT_WAVEFORMS", + 0, + "Use Strip Option", + "Display waveforms depending on strip setting"}, + {0, NULL, 0, NULL, NULL}, + }; + + prop = RNA_def_property(srna, "waveform_display_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, waveform_type_display_items); + RNA_def_property_ui_text(prop, "Waveform Display", "How Waveforms are displayed"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_fcurves", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_FCURVES); + RNA_def_property_ui_text(prop, "Show F-Curves", "Display strip opacity/volume curve"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_strip_name", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_NAME); + RNA_def_property_ui_text(prop, "Show Name", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_strip_source", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_SOURCE); + RNA_def_property_ui_text( + prop, "Show Source", "Display path to source file, or name of source datablock"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_strip_duration", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_DURATION); + RNA_def_property_ui_text(prop, "Show Duration", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_GRID); + RNA_def_property_ui_text(prop, "Show Grid", "Show vertical grid lines"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_strip_offset", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_OFFSETS); + RNA_def_property_ui_text(prop, "Show Offsets", "Display strip in/out offsets"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); +} + static void rna_def_space_sequencer(BlenderRNA *brna) { StructRNA *srna; @@ -5369,25 +5481,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static const EnumPropertyItem waveform_type_display_items[] = { - {SEQ_NO_WAVEFORMS, - "NO_WAVEFORMS", - 0, - "Waveforms Off", - "Don't display waveforms for any sound strips"}, - {SEQ_ALL_WAVEFORMS, - "ALL_WAVEFORMS", - 0, - "Waveforms On", - "Display waveforms for all sound strips"}, - {0, - "DEFAULT_WAVEFORMS", - 0, - "Use Strip Option", - "Display waveforms depending on strip setting"}, - {0, NULL, 0, NULL, NULL}, - }; - srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space"); RNA_def_struct_sdna(srna, "SpaceSeq"); RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data"); @@ -5428,23 +5521,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_MARGINS); - RNA_def_property_ui_text( - prop, "Safe Areas", "Show TV title safe and action safe areas in preview"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_CENTER); - RNA_def_property_ui_text( - prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA); - RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES); RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames"); @@ -5458,11 +5534,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna) "If any exists, show markers in a separate row at the bottom of the editor"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL); - RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "chanshown"); RNA_def_property_ui_text( @@ -5478,12 +5549,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Display Channels", "Channels of the preview to display"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); - prop = RNA_def_property(srna, "waveform_display_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, waveform_type_display_items); - RNA_def_property_ui_text(prop, "Waveform Display", "How Waveforms are displayed"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "use_zoom_to_fit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_ZOOM_TO_FIT); RNA_def_property_ui_text( @@ -5533,46 +5598,31 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Backdrop", "Display result under strips"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "show_strip_offset", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_OFFSET_EXT); - RNA_def_property_ui_text(prop, "Show Offsets", "Display strip in/out offsets"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "show_fcurves", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_FCURVES); - RNA_def_property_ui_text(prop, "Show F-Curves", "Display strip opacity/volume curve"); + prop = RNA_def_property(srna, "show_transform_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_TRANSFORM_PREVIEW); + RNA_def_property_ui_text(prop, "Transform Preview", "Show preview of the transformed frames"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + /* Overlay settings. */ prop = RNA_def_property(srna, "show_strip_overlay", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_STRIP_OVERLAY); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_OVERLAY); RNA_def_property_ui_text(prop, "Show Overlay", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - prop = RNA_def_property(srna, "show_strip_name", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_STRIP_NAME); - RNA_def_property_ui_text(prop, "Show Name", ""); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "show_strip_source", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_STRIP_SOURCE); - RNA_def_property_ui_text( - prop, "Show Source", "Display path to source file, or name of source datablock"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "show_strip_duration", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_STRIP_DURATION); - RNA_def_property_ui_text(prop, "Show Duration", ""); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + prop = RNA_def_property(srna, "preview_overlay", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "SequencerPreviewOverlay"); + RNA_def_property_pointer_sdna(prop, NULL, "preview_overlay"); + RNA_def_property_ui_text(prop, "Preview Overlay Settings", "Settings for display of overlays"); - prop = RNA_def_property(srna, "show_transform_preview", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_TRANSFORM_PREVIEW); - RNA_def_property_ui_text(prop, "Transform Preview", "Show preview of the transformed frames"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + prop = RNA_def_property(srna, "timeline_overlay", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "SequencerTimelineOverlay"); + RNA_def_property_pointer_sdna(prop, NULL, "timeline_overlay"); + RNA_def_property_ui_text(prop, "Timeline Overlay Settings", "Settings for display of overlays"); - prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GRID); - RNA_def_property_ui_text(prop, "Show Grid", "Show vertical grid lines"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + rna_def_space_sequencer_preview_overlay(brna); + rna_def_space_sequencer_timeline_overlay(brna); } static void rna_def_space_text(BlenderRNA *brna) |