diff options
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 11 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 35 | ||||
-rw-r--r-- | source/blender/editors/include/ED_image.h | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_gizmo_navigate.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_gizmo_2d.c | 16 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 21 |
9 files changed, 117 insertions, 13 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 7152069972d..16cfb1e4760 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -2826,7 +2826,6 @@ def km_sequencerpreview(params): value=params.select_mouse_value_fallback, legacy=params.legacy, ), - op_menu_pie("SEQUENCER_MT_pivot_pie", {"type": 'PERIOD', "value": 'PRESS'}), ("sequencer.view_all_preview", {"type": 'HOME', "value": 'PRESS'}, None), ("sequencer.view_all_preview", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None), @@ -2864,6 +2863,16 @@ def km_sequencerpreview(params): *_template_items_context_menu("SEQUENCER_MT_preview_context_menu", params.context_menu_event), ]) + if not params.legacy: + # New pie menus. + items.extend([ + ("wm.context_toggle", {"type": 'ACCENT_GRAVE', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_gizmo')]}), + op_menu_pie("SEQUENCER_MT_pivot_pie", {"type": 'PERIOD', "value": 'PRESS'}), + ("wm.context_toggle", {"type": 'Z', "value": 'PRESS', "alt": True, "shift": True}, + {"properties": [("data_path", "space_data.overlay.show_overlays")]}), + ]) + # 2D cursor. if params.cursor_tweak_event: items.extend([ diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 58afb6d9203..665e7c54fa7 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -205,6 +205,17 @@ class SEQUENCER_HT_header(Header): layout.prop(st, "display_mode", text="", icon_only=True) layout.prop(st, "preview_channels", text="", icon_only=True) + # Gizmo toggle & popover. + row = layout.row(align=True) + # FIXME: place-holder icon. + row.prop(st, "show_gizmo", text="", toggle=True, icon='GIZMO') + sub = row.row(align=True) + sub.active = st.show_gizmo + sub.popover( + panel="SEQUENCER_PT_gizmo_display", + text="", + ) + row = layout.row(align=True) row.prop(st, "show_strip_overlay", text="", icon='OVERLAY') sub = row.row(align=True) @@ -230,6 +241,29 @@ class SEQUENCER_MT_editor_menus(Menu): layout.menu("SEQUENCER_MT_strip") +class SEQUENCER_PT_gizmo_display(Panel): + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "Gizmo" + bl_ui_units_x = 8 + + def draw(self, context): + layout = self.layout + + scene = context.scene + st = context.space_data + + col = layout.column() + col.label(text="Viewport Gizmos") + col.separator() + + col.active = st.show_gizmo + colsub = col.column() + colsub.prop(st, "show_gizmo_navigate", text="Navigate") + colsub.prop(st, "show_gizmo_tool", text="Active Tools") + # colsub.prop(st, "show_gizmo_context", text="Active Object") # Currently unused. + + class SEQUENCER_PT_overlay(Panel): bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'HEADER' @@ -2503,6 +2537,7 @@ classes = ( SEQUENCER_PT_active_tool, SEQUENCER_PT_strip, + SEQUENCER_PT_gizmo_display, SEQUENCER_PT_overlay, SEQUENCER_PT_preview_overlay, SEQUENCER_PT_sequencer_overlay, diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 9532035a1cd..f0e8f7f0a39 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -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); diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c index 30b4a7c097a..3ff5b471731 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.c +++ b/source/blender/editors/interface/view2d_gizmo_navigate.c @@ -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; } diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 2174a4b9dc1..9081f0dfcf3 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -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)) { diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 4c4c908ea3c..978ac9a3404 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -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); diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index b25a182926e..a0ca7b84c48 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -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; } } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index f6ce71dad54..ac55fa0df01 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -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, diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 9d8e06b3c56..fcaf53da81b 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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); |