Gizmo toggle for Movie Clip Editor

This patch adds a "Show Gizmo" toggle to the Movie Clip Editor header, for consistency with other editors.

{F13892765}

Differential Revision: https://developer.blender.org/D16437
This commit is contained in:
Ejner Fergo 2022-11-14 14:27:01 +01:00 committed by Sergey Sharybin
parent 857bb1b5ec
commit b557e4317d
4 changed files with 53 additions and 1 deletions

View File

@ -253,6 +253,12 @@ class CLIP_HT_header(Header):
else:
self._draw_masking(context)
# Gizmo toggle & popover.
row = layout.row(align=True)
row.prop(sc, "show_gizmo", icon='GIZMO', text="")
sub = row.row(align=True)
sub.active = sc.show_gizmo
sub.popover(panel="CLIP_PT_gizmo_display", text="")
class CLIP_MT_tracking_editor_menus(Menu):
bl_idname = "CLIP_MT_tracking_editor_menus"
@ -1897,6 +1903,25 @@ class CLIP_MT_view_pie(Menu):
pie.separator()
pie.operator("clip.graph_center_current_frame")
class CLIP_PT_gizmo_display(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'HEADER'
bl_label = "Gizmos"
bl_ui_units_x = 8
def draw(self, context):
layout = self.layout
view = context.space_data
col = layout.column()
col.label(text="Viewport Gizmos")
col.separator()
col.active = view.show_gizmo
colsub = col.column()
colsub.prop(view, "show_gizmo_navigate", text="Navigate")
classes = (
CLIP_UL_tracking_objects,
@ -1967,6 +1992,7 @@ classes = (
CLIP_MT_reconstruction_pie,
CLIP_MT_solving_pie,
CLIP_MT_view_pie,
CLIP_PT_gizmo_display,
)
if __name__ == "__main__": # only for live edit.

View File

@ -136,6 +136,13 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType * /*gz
}
break;
}
case SPACE_CLIP: {
const SpaceClip *sc = static_cast<const SpaceClip *>(area->spacedata.first);
if (sc->gizmo_flag & (SCLIP_GIZMO_HIDE | SCLIP_GIZMO_HIDE_NAVIGATE)) {
return false;
}
break;
}
}
return true;
}

View File

@ -1735,7 +1735,8 @@ typedef struct SpaceClip {
char _pad0[6];
/* End 'SpaceLink' header. */
char _pad1[4];
char gizmo_flag;
char _pad1[3];
/** User defined offset, image is centered. */
float xof, yof;
@ -1836,6 +1837,13 @@ typedef enum eSpaceClip_GPencil_Source {
SC_GPENCIL_SRC_TRACK = 1,
} eSpaceClip_GPencil_Source;
/** #SpaceClip.gizmo_flag */
enum {
/** All gizmos. */
SCLIP_GIZMO_HIDE = (1 << 0),
SCLIP_GIZMO_HIDE_NAVIGATE = (1 << 1),
};
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -7764,6 +7764,17 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_enum_items(prop, pivot_items);
RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
/* Gizmo Toggles. */
prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SCLIP_GIZMO_HIDE);
RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", SCLIP_GIZMO_HIDE_NAVIGATE);
RNA_def_property_ui_text(prop, "Navigate Gizmo", "Viewport navigation gizmo");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
}
static void rna_def_spreadsheet_column_id(BlenderRNA *brna)