GPencil: Hide Brush panels for some tools
Some tools don't use brush and the panel must be hidden. Reviewed By: mendio Differential Revision: https://developer.blender.org/D11518
This commit is contained in:
@@ -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
|
||||
|
||||
return (settings and settings.brush and settings.brush.curve and tool == 'TINT')
|
||||
gptool = brush.gpencil_tool
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user