Cleanup: internal sequencer naming for overlays

- Rename RNA SpaceSeq.show_strip_overlay to show_overlays
  matching the 3D View, the term "strip" was misleading as this is used
  for the preview as well.

- Rename various RNA overlay settings to overlay_frame
  since "Frame Offset" is a specific feature, avoid having both
  Editor.show_overlay and SpaceSeq.show_overlays.

- Rename Editing `over_*` -> `overlay_frame_*` in DNA,
  as well as flags.
This commit is contained in:
Campbell Barton 2021-10-18 15:47:28 +11:00
parent c5a13ffcb4
commit e538b2c3a3
11 changed files with 78 additions and 68 deletions

View File

@ -2684,7 +2684,7 @@ def km_sequencercommon(params):
sidebar_key={"type": 'N', "value": 'PRESS'},
),
("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}),
{"properties": [("data_path", 'scene.sequence_editor.show_overlay_frame')]}),
("wm.context_toggle_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'space_data.view_type'), ("value_1", 'SEQUENCER'), ("value_2", 'PREVIEW')]}),
("sequencer.refresh_all", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),

View File

@ -215,10 +215,10 @@ class SEQUENCER_HT_header(Header):
)
row = layout.row(align=True)
row.prop(st, "show_strip_overlay", text="", icon='OVERLAY')
row.prop(st, "show_overlays", text="", icon='OVERLAY')
sub = row.row(align=True)
sub.popover(panel="SEQUENCER_PT_overlay", text="")
sub.active = st.show_strip_overlay
sub.active = st.show_overlays
class SEQUENCER_MT_editor_menus(Menu):
@ -289,9 +289,9 @@ class SEQUENCER_PT_preview_overlay(Panel):
overlay_settings = st.preview_overlay
layout = self.layout
layout.active = st.show_strip_overlay
layout.active = st.show_overlays
layout.prop(overlay_settings, "show_image_outline")
layout.prop(ed, "show_overlay", text="Frame Overlay")
layout.prop(ed, "show_overlay_frame", text="Frame Overlay")
layout.prop(overlay_settings, "show_safe_areas", text="Safe Areas")
layout.prop(overlay_settings, "show_metadata", text="Metadata")
layout.prop(overlay_settings, "show_annotation", text="Annotations")
@ -313,7 +313,7 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
overlay_settings = st.timeline_overlay
layout = self.layout
layout.active = st.show_strip_overlay
layout.active = st.show_overlays
layout.prop(overlay_settings, "show_strip_name", text="Name")
layout.prop(overlay_settings, "show_strip_source", text="Source")
@ -2265,7 +2265,7 @@ class SEQUENCER_PT_frame_overlay(SequencerButtonsPanel_Output, Panel):
scene = context.scene
ed = scene.sequence_editor
self.layout.prop(ed, "show_overlay", text="")
self.layout.prop(ed, "show_overlay_frame", text="")
def draw(self, context):
layout = self.layout
@ -2281,12 +2281,12 @@ class SEQUENCER_PT_frame_overlay(SequencerButtonsPanel_Output, Panel):
scene = context.scene
ed = scene.sequence_editor
layout.active = ed.show_overlay
layout.active = ed.show_overlay_frame
col = layout.column()
col.prop(ed, "overlay_frame", text="Frame Offset")
col.prop(st, "overlay_type")
col.prop(ed, "use_overlay_lock")
col.prop(st, "overlay_frame_type")
col.prop(ed, "use_overlay_frame_lock")
class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):

View File

@ -78,9 +78,10 @@ static void metadata_panel_context_draw(const bContext *C, Panel *panel)
SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
/* NOTE: We can only reliably show metadata for the original (current)
* frame when split view is used. */
const bool show_split = (scene->ed && (scene->ed->over_flag & SEQ_EDIT_USE_FRAME_OVERLAY) &&
const bool show_split = (scene->ed &&
(scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_SHOW) &&
(space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF));
if (show_split && space_sequencer->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
if (show_split && (space_sequencer->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE)) {
return;
}
/* NOTE: We disable multiview for drawing, since we don't know what is the

View File

@ -1862,15 +1862,15 @@ static void sequencer_preview_get_rect(rctf *preview,
sequencer_display_size(scene, viewrect);
BLI_rctf_init(preview, -1.0f, 1.0f, -1.0f, 1.0f);
if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
if (draw_overlay && (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_RECT)) {
preview->xmax = v2d->tot.xmin +
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->overlay_frame_rect.xmax);
preview->xmin = v2d->tot.xmin +
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->overlay_frame_rect.xmin);
preview->ymax = v2d->tot.ymin +
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->overlay_frame_rect.ymax);
preview->ymin = v2d->tot.ymin +
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->overlay_frame_rect.ymin);
}
else if (draw_backdrop) {
float aspect = BLI_rcti_size_x(&region->winrct) / (float)BLI_rcti_size_y(&region->winrct);
@ -1958,8 +1958,8 @@ static void sequencer_draw_display_buffer(const bContext *C,
rctf canvas;
sequencer_preview_get_rect(&preview, scene, region, sseq, draw_overlay, draw_backdrop);
if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
canvas = scene->ed->over_border;
if (draw_overlay && (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_RECT)) {
canvas = scene->ed->overlay_frame_rect;
}
else {
BLI_rctf_init(&canvas, 0.0f, 1.0f, 0.0f, 1.0f);
@ -2207,7 +2207,8 @@ void sequencer_draw_preview(const bContext *C,
UI_view2d_view_ortho(v2d);
/* Draw background. */
if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) {
if (!draw_backdrop &&
(!draw_overlay || (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE))) {
sequencer_preview_clear();
if (sseq->flag & SEQ_USE_ALPHA) {
@ -2685,9 +2686,9 @@ static void draw_cache_view(const bContext *C)
/* Draw sequencer timeline. */
static void draw_overlap_frame_indicator(const struct Scene *scene, const View2D *v2d)
{
int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ?
scene->ed->over_cfra :
scene->r.cfra + scene->ed->over_ofs;
int overlap_frame = (scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) ?
scene->ed->overlay_frame_abs :
scene->r.cfra + scene->ed->overlay_frame_ofs;
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@ -2807,7 +2808,7 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region)
if (scene->ed != NULL) {
UI_view2d_view_ortho(v2d);
draw_cache_view(C);
if (scene->ed->over_flag & SEQ_EDIT_USE_FRAME_OVERLAY) {
if (scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_SHOW) {
draw_overlap_frame_indicator(scene, v2d);
}
UI_view2d_view_restore(C);

View File

@ -380,7 +380,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
CLAMP(rect.xmax, 0.0f, 1.0f);
CLAMP(rect.ymax, 0.0f, 1.0f);
scene->ed->over_border = rect;
scene->ed->overlay_frame_rect = rect;
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);

View File

@ -783,25 +783,26 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
wmWindowManager *wm = CTX_wm_manager(C);
const bool draw_overlay = sseq->flag & SEQ_SHOW_OVERLAY;
const bool draw_frame_overlay = (scene->ed &&
(scene->ed->over_flag & SEQ_EDIT_USE_FRAME_OVERLAY) &&
(scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_SHOW) &&
draw_overlay);
const bool is_playing = ED_screen_animation_playing(wm);
if (!draw_frame_overlay || sseq->overlay_type != SEQ_DRAW_OVERLAY_REFERENCE) {
if (!(draw_frame_overlay && (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE))) {
sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, false);
}
if (draw_frame_overlay && sseq->overlay_type != SEQ_DRAW_OVERLAY_CURRENT) {
if (draw_frame_overlay && sseq->overlay_frame_type != SEQ_OVERLAY_FRAME_TYPE_CURRENT) {
int over_cfra;
if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) {
over_cfra = scene->ed->over_cfra;
if (scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) {
over_cfra = scene->ed->overlay_frame_abs;
}
else {
over_cfra = scene->r.cfra + scene->ed->over_ofs;
over_cfra = scene->r.cfra + scene->ed->overlay_frame_ofs;
}
if (over_cfra != scene->r.cfra || sseq->overlay_type != SEQ_DRAW_OVERLAY_RECT) {
if ((over_cfra != scene->r.cfra) ||
(sseq->overlay_frame_type != SEQ_OVERLAY_FRAME_TYPE_RECT)) {
sequencer_draw_preview(
C, scene, region, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
}

View File

@ -289,9 +289,11 @@ typedef struct Editing {
/** 1024 = FILE_MAX. */
char proxy_dir[1024];
int over_ofs, over_cfra;
int over_flag, proxy_storage;
rctf over_border;
int proxy_storage;
int overlay_frame_ofs, overlay_frame_abs;
int overlay_frame_flag;
rctf overlay_frame_rect;
struct SeqCache *cache;
@ -502,9 +504,9 @@ typedef struct SequencerScopes {
#define SELECT 1
/* Editor->over_flag */
#define SEQ_EDIT_USE_FRAME_OVERLAY 1
#define SEQ_EDIT_OVERLAY_ABS 2
/** #Editor.overlay_frame_flag */
#define SEQ_EDIT_OVERLAY_FRAME_SHOW 1
#define SEQ_EDIT_OVERLAY_FRAME_ABS 2
#define SEQ_STRIP_OFSBOTTOM 0.05f
#define SEQ_STRIP_OFSTOP 0.95f

View File

@ -642,7 +642,7 @@ typedef struct SpaceSeq {
float zoom DNA_DEPRECATED;
/** See SEQ_VIEW_* below. */
char view;
char overlay_type;
char overlay_frame_type;
/** Overlay an image of the editing on below the strips. */
char draw_flag;
char gizmo_flag;
@ -740,11 +740,11 @@ enum {
};
/* SpaceSeq.mainb */
typedef enum eSpaceSeq_OverlayType {
SEQ_DRAW_OVERLAY_RECT = 0,
SEQ_DRAW_OVERLAY_REFERENCE = 1,
SEQ_DRAW_OVERLAY_CURRENT = 2,
} eSpaceSeq_OverlayType;
typedef enum eSpaceSeq_OverlayFrameType {
SEQ_OVERLAY_FRAME_TYPE_RECT = 0,
SEQ_OVERLAY_FRAME_TYPE_REFERENCE = 1,
SEQ_OVERLAY_FRAME_TYPE_CURRENT = 2,
} eSpaceSeq_OverlayFrameType;
/** \} */

View File

@ -73,6 +73,10 @@ DNA_STRUCT_RENAME_ELEM(Curve, len_wchar, len_char32)
DNA_STRUCT_RENAME_ELEM(Camera, clipend, clip_end)
DNA_STRUCT_RENAME_ELEM(Camera, clipsta, clip_start)
DNA_STRUCT_RENAME_ELEM(Collection, dupli_ofs, instance_offset)
DNA_STRUCT_RENAME_ELEM(Editing, over_border, overlay_frame_rect)
DNA_STRUCT_RENAME_ELEM(Editing, over_cfra, overlay_frame_abs)
DNA_STRUCT_RENAME_ELEM(Editing, over_flag, overlay_frame_flag)
DNA_STRUCT_RENAME_ELEM(Editing, over_ofs, overlay_frame_ofs)
DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, cache_frame_pause_guiding, cache_frame_pause_guide)
DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_alpha, guide_alpha)
DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_beta, guide_beta)
@ -92,6 +96,7 @@ DNA_STRUCT_RENAME_ELEM(Object, restrictflag, visibility_flag)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights)
DNA_STRUCT_RENAME_ELEM(SpaceSeq, overlay_type, overlay_frame_type)
DNA_STRUCT_RENAME_ELEM(Text, name, filepath)
DNA_STRUCT_RENAME_ELEM(ThemeSpace, scrubbing_background, time_scrub_background)
DNA_STRUCT_RENAME_ELEM(ThemeSpace, show_back_grad, background_type)

View File

@ -1121,13 +1121,13 @@ static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, bool value)
}
/* convert from abs to relative and back */
if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) {
ed->over_cfra = scene->r.cfra + ed->over_ofs;
ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
if ((ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) == 0 && value) {
ed->overlay_frame_abs = scene->r.cfra + ed->overlay_frame_ofs;
ed->overlay_frame_flag |= SEQ_EDIT_OVERLAY_FRAME_ABS;
}
else if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
ed->over_ofs = ed->over_cfra - scene->r.cfra;
ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
else if ((ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) && !value) {
ed->overlay_frame_ofs = ed->overlay_frame_abs - scene->r.cfra;
ed->overlay_frame_flag &= ~SEQ_EDIT_OVERLAY_FRAME_ABS;
}
}
@ -1140,11 +1140,11 @@ static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
return scene->r.cfra;
}
if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) {
return ed->over_cfra - scene->r.cfra;
if (ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) {
return ed->overlay_frame_abs - scene->r.cfra;
}
else {
return ed->over_ofs;
return ed->overlay_frame_ofs;
}
}
@ -1157,11 +1157,11 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
return;
}
if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) {
ed->over_cfra = (scene->r.cfra + value);
if (ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_ABS) {
ed->overlay_frame_abs = (scene->r.cfra + value);
}
else {
ed->over_ofs = value;
ed->overlay_frame_ofs = value;
}
}
@ -2113,14 +2113,14 @@ static void rna_def_editor(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_USE_FRAME_OVERLAY);
prop = RNA_def_property(srna, "show_overlay_frame", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay_frame_flag", SEQ_EDIT_OVERLAY_FRAME_SHOW);
RNA_def_property_ui_text(
prop, "Show Overlay", "Partial overlay on top of the sequencer with a frame offset");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "use_overlay_lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
prop = RNA_def_property(srna, "use_overlay_frame_lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay_frame_flag", SEQ_EDIT_OVERLAY_FRAME_ABS);
RNA_def_property_ui_text(prop, "Overlay Lock", "");
RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);

View File

@ -5531,10 +5531,10 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem overlay_type_items[] = {
{SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
{SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
{SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
static const EnumPropertyItem overlay_frame_type_items[] = {
{SEQ_OVERLAY_FRAME_TYPE_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
{SEQ_OVERLAY_FRAME_TYPE_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
{SEQ_OVERLAY_FRAME_TYPE_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
{0, NULL, 0, NULL, NULL},
};
@ -5654,9 +5654,9 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil data for this Preview region");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "overlay_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "overlay_type");
RNA_def_property_enum_items(prop, overlay_type_items);
prop = RNA_def_property(srna, "overlay_frame_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "overlay_frame_type");
RNA_def_property_enum_items(prop, overlay_frame_type_items);
RNA_def_property_ui_text(prop, "Overlay Type", "Overlay display method");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
@ -5692,7 +5692,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
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);
prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
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);