From 6018a3b4e8f9323f07abacb94587c49fbfef1735 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Wed, 12 Sep 2018 15:18:05 +0200 Subject: [PATCH] GP: Hide panels for eraser brushes --- .../startup/bl_ui/space_view3d_toolbar.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 41dc143e680..e13387021d1 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1462,6 +1462,13 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): bl_label = "Options" bl_options = {'DEFAULT_CLOSED'} + @classmethod + def poll(cls, context): + brush = context.active_gpencil_brush + gp_settings = brush.gpencil_settings + + return brush is not None and gp_settings.gpencil_brush_type != 'ERASE' + def draw_header_preset(self, context): VIEW3D_PT_gpencil_brush_presets.draw_panel_header(self.layout) @@ -1528,8 +1535,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel): @classmethod def poll(cls, context): brush = context.active_gpencil_brush + gp_settings = brush.gpencil_settings - return brush is not None + return brush is not None and gp_settings.gpencil_brush_type != 'ERASE' def draw_header(self, context): brush = context.active_gpencil_brush @@ -1568,8 +1576,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel): @classmethod def poll(cls, context): brush = context.active_gpencil_brush + gp_settings = brush.gpencil_settings - return brush is not None + return brush is not None and gp_settings.gpencil_brush_type != 'ERASE' def draw_header(self, context): brush = context.active_gpencil_brush @@ -1601,6 +1610,13 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel): bl_label = "Curves" bl_options = {'DEFAULT_CLOSED'} + @classmethod + def poll(cls, context): + brush = context.active_gpencil_brush + gp_settings = brush.gpencil_settings + + return brush is not None and gp_settings.gpencil_brush_type != 'ERASE' + @staticmethod def draw(self, context): layout = self.layout