diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 15 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 31 |
2 files changed, 29 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 2e89ddcb1d4..0da0716e850 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -179,21 +179,6 @@ class GreasePencilBrushFalloff: bl_label = "Falloff" bl_options = {'DEFAULT_CLOSED'} - @classmethod - def poll(cls, context): - ts = context.tool_settings - settings = None - if context.mode == 'PAINT_GPENCIL': - settings = ts.gpencil_paint - if context.mode == 'SCULPT_GPENCIL': - settings = ts.gpencil_sculpt_paint - elif context.mode == 'WEIGHT_GPENCIL': - settings = ts.gpencil_weight_paint - elif context.mode == 'VERTEX_GPENCIL': - settings = ts.gpencil_vertex_paint - - return (settings and settings.brush and settings.brush.curve) - def draw(self, context): layout = self.layout ts = context.tool_settings diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 604509b99f9..89bb2005f53 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1322,6 +1322,14 @@ class VIEW3D_PT_tools_particlemode_options_display(View3DPanel, Panel): # Grease Pencil drawing brushes +def tool_use_brush(context): + from bl_ui.space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + if tool and tool.has_datablock is False: + return False + + return True + class GreasePencilPaintPanel: bl_context = ".greasepencil_paint" @@ -1333,6 +1341,10 @@ class GreasePencilPaintPanel: if context.gpencil_data is None: return False + # Hide for tools not using bruhses + if tool_use_brush(context) is False: + return False + gpd = context.gpencil_data return bool(gpd.is_stroke_paint_mode) else: @@ -1718,9 +1730,14 @@ class VIEW3D_PT_tools_grease_pencil_brush_paint_falloff(GreasePencilBrushFalloff if brush is None: return False - tool = brush.gpencil_tool + from bl_ui.space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + if tool and tool.idname != 'builtin_brush.Tint': + return False + + gptool = brush.gpencil_tool - return (settings and settings.brush and settings.brush.curve and tool == 'TINT') + return (settings and settings.brush and settings.brush.curve and gptool == 'TINT') # Grease Pencil stroke sculpting tools @@ -2039,6 +2056,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel): if context.region.type == 'TOOL_HEADER': return False + from bl_ui.space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + if tool and tool.idname in('builtin.cutter', 'builtin.eyedropper', 'builtin.interpolate'): + return False + if brush.gpencil_tool == 'TINT': return True @@ -2095,6 +2117,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel): if ob is None or brush is None: return False + from bl_ui.space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + if tool and tool.idname in('builtin.cutter', 'builtin.eyedropper', 'builtin.interpolate'): + return False + if brush.gpencil_tool == 'TINT': return True |