From 576e7c82da44a2374d0c070c5c89e33f1b79ba10 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 20 May 2019 15:29:19 +0200 Subject: UI: keep grease pencil stroke placement / guides button always in main header --- release/scripts/startup/bl_ui/space_view3d.py | 67 ++++++++++++++------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index ac622da8a4c..ce62f47a77d 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -499,37 +499,6 @@ class VIEW3D_HT_header(Header): panel="VIEW3D_PT_proportional_edit", ) - # grease pencil - if object_mode == 'PAINT_GPENCIL': - layout.prop_with_popover( - tool_settings, - "gpencil_stroke_placement_view3d", - text="", - panel="VIEW3D_PT_gpencil_origin", - ) - - if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}: - layout.prop_with_popover( - tool_settings.gpencil_sculpt, - "lock_axis", - text="", - panel="VIEW3D_PT_gpencil_lock", - ) - - if object_mode == 'PAINT_GPENCIL': - # FIXME: this is bad practice! - # Tool options are to be displayed in the topbar. - if context.workspace.tools.from_space_view3d_mode(object_mode).idname == "builtin_brush.Draw": - settings = tool_settings.gpencil_sculpt.guide - row = layout.row(align=True) - row.prop(settings, "use_guide", text="", icon='GRID') - sub = row.row(align=True) - sub.active = settings.use_guide - sub.popover( - panel="VIEW3D_PT_gpencil_guide", - text="Guides", - ) - def draw(self, context): layout = self.layout @@ -621,7 +590,41 @@ class VIEW3D_HT_header(Header): layout.separator_spacer() - if not show_region_tool_header: + if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}: + # Grease pencil + if object_mode == 'PAINT_GPENCIL': + layout.prop_with_popover( + tool_settings, + "gpencil_stroke_placement_view3d", + text="", + panel="VIEW3D_PT_gpencil_origin", + ) + + if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}: + layout.prop_with_popover( + tool_settings.gpencil_sculpt, + "lock_axis", + text="", + panel="VIEW3D_PT_gpencil_lock", + ) + + if object_mode == 'PAINT_GPENCIL': + # FIXME: this is bad practice! + # Tool options are to be displayed in the topbar. + if context.workspace.tools.from_space_view3d_mode(object_mode).idname == "builtin_brush.Draw": + settings = tool_settings.gpencil_sculpt.guide + row = layout.row(align=True) + row.prop(settings, "use_guide", text="", icon='GRID') + sub = row.row(align=True) + sub.active = settings.use_guide + sub.popover( + panel="VIEW3D_PT_gpencil_guide", + text="Guides", + ) + + layout.separator_spacer() + elif not show_region_tool_header: + # Transform settings depending on tool header visibility VIEW3D_HT_header.draw_xform_template(layout, context) layout.separator_spacer() -- cgit v1.2.3