Sequencer: add option to toggle gizmos

Use shortcut matching the 3D view & popover in the header
This commit is contained in:
2021-10-08 17:07:56 +11:00
parent de07bf2b13
commit ebe216f532
9 changed files with 117 additions and 13 deletions

View File

@@ -112,9 +112,9 @@ void ED_image_point_pos__reverse(struct SpaceImage *sima,
float r_co[2]);
bool ED_image_slot_cycle(struct Image *image, int direction);
bool ED_space_image_show_render(struct SpaceImage *sima);
bool ED_space_image_show_paint(struct SpaceImage *sima);
bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
bool ED_space_image_show_render(const struct SpaceImage *sima);
bool ED_space_image_show_paint(const struct SpaceImage *sima);
bool ED_space_image_show_uvedit(const struct SpaceImage *sima, struct Object *obedit);
bool ED_space_image_paint_curve(const struct bContext *C);

View File

@@ -127,11 +127,24 @@ struct NavigateWidgetGroup {
int region_size[2];
};
static bool WIDGETGROUP_navigate_poll(const bContext *UNUSED(C), wmGizmoGroupType *UNUSED(gzgt))
static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
if ((U.uiflag & USER_SHOW_GIZMO_NAVIGATE) == 0) {
return false;
}
ScrArea *area = CTX_wm_area(C);
if (area == NULL) {
return false;
}
switch (area->spacetype) {
case SPACE_SEQ: {
const SpaceSeq *sseq = area->spacedata.first;
if (sseq->gizmo_flag & (SEQ_GIZMO_HIDE | SEQ_GIZMO_HIDE_NAVIGATE)) {
return false;
}
break;
}
}
return true;
}

View File

@@ -445,12 +445,12 @@ void ED_space_image_scopes_update(const struct bContext *C,
&scene->display_settings);
}
bool ED_space_image_show_render(SpaceImage *sima)
bool ED_space_image_show_render(const SpaceImage *sima)
{
return (sima->image && ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE));
}
bool ED_space_image_show_paint(SpaceImage *sima)
bool ED_space_image_show_paint(const SpaceImage *sima)
{
if (ED_space_image_show_render(sima)) {
return false;
@@ -459,7 +459,7 @@ bool ED_space_image_show_paint(SpaceImage *sima)
return (sima->mode == SI_MODE_PAINT);
}
bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
{
if (sima) {
if (ED_space_image_show_render(sima)) {

View File

@@ -816,7 +816,9 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
DRW_draw_cursor_2d_ex(region, cursor_pixel);
}
WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
if ((sseq->gizmo_flag & SEQ_GIZMO_HIDE) == 0) {
WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
}
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
const rcti *rect = ED_region_visible_rect(region);

View File

@@ -76,13 +76,27 @@ static bool gizmo2d_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
}
ScrArea *area = CTX_wm_area(C);
if (area == NULL) {
return false;
}
/* NOTE: below this is assumed to be a tool gizmo.
* If there are cases that need to check other flags - this function could be split. */
switch (area->spacetype) {
case SPACE_IMAGE: {
SpaceImage *sima = area->spacedata.first;
const SpaceImage *sima = area->spacedata.first;
Object *obedit = CTX_data_edit_object(C);
if (!ED_space_image_show_uvedit(sima, obedit)) {
return false;
}
break;
}
case SPACE_SEQ: {
const SpaceSeq *sseq = area->spacedata.first;
if (sseq->gizmo_flag & (SEQ_GIZMO_HIDE | SEQ_GIZMO_HIDE_TOOL)) {
return false;
}
break;
}
}

View File

@@ -641,10 +641,11 @@ typedef struct SpaceSeq {
/** Deprecated, handled by View2D now. */
float zoom DNA_DEPRECATED;
/** See SEQ_VIEW_* below. */
int view;
int overlay_type;
char view;
char overlay_type;
/** Overlay an image of the editing on below the strips. */
int draw_flag;
char draw_flag;
char gizmo_flag;
char _pad[4];
/** 2D cursor for transform. */
@@ -729,6 +730,15 @@ typedef struct MaskSpaceInfo {
char _pad3[5];
} MaskSpaceInfo;
/** #SpaceSeq.gizmo_flag */
enum {
/** All gizmos. */
SEQ_GIZMO_HIDE = (1 << 0),
SEQ_GIZMO_HIDE_NAVIGATE = (1 << 1),
SEQ_GIZMO_HIDE_CONTEXT = (1 << 2),
SEQ_GIZMO_HIDE_TOOL = (1 << 3),
};
/* SpaceSeq.mainb */
typedef enum eSpaceSeq_OverlayType {
SEQ_DRAW_OVERLAY_RECT = 0,

View File

@@ -5670,6 +5670,27 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
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);
/* Gizmo toggles. */
prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SEQ_GIZMO_HIDE);
RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SEQ_GIZMO_HIDE_NAVIGATE);
RNA_def_property_ui_text(prop, "Navigate Gizmo", "Viewport navigation gizmo");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_gizmo_context", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SEQ_GIZMO_HIDE_CONTEXT);
RNA_def_property_ui_text(prop, "Context Gizmo", "Context sensitive gizmos for the active item");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_gizmo_tool", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SEQ_GIZMO_HIDE_TOOL);
RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
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_OVERLAY);