UI: de-duplicate top-bar and panel paint scripts

- Fixes missing check for unified brush in sculpt mode.
- Re-orders material first in gpencil paint mode
  (matching color-first for other paint modes).
- Avoid minor differences (missing tablet pressure options from topbar).
- Don't repeat properties already displayed in the topbar
  when opening the brush popover.
This commit is contained in:
Campbell Barton
2019-01-02 14:36:56 +11:00
parent 939c751faa
commit 46a6085c47
4 changed files with 262 additions and 226 deletions

View File

@@ -254,29 +254,11 @@ class GreasePencilStrokeSculptPanel:
layout.template_icon_view(settings, "sculpt_tool", show_labels=True) layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
row = layout.row(align=True) if not self.is_popover:
row.prop(brush, "size", slider=True) from .properties_paint_common import (
sub = row.row(align=True) brush_basic_gpencil_sculpt_settings,
sub.enabled = tool not in {'GRAB', 'CLONE'} )
sub.prop(brush, "use_pressure_radius", text="") brush_basic_gpencil_sculpt_settings(layout, context, brush)
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
layout.prop(brush, "use_falloff")
layout.use_property_split = False
if tool in {'THICKNESS', 'STRENGTH'}:
layout.row().prop(brush, "direction", expand=True)
elif tool == 'PINCH':
row = layout.row(align=True)
row.prop_enum(brush, "direction", value='ADD', text="Pinch")
row.prop_enum(brush, "direction", value='SUBTRACT', text="Inflate")
elif tool == 'TWIST':
row = layout.row(align=True)
row.prop_enum(brush, "direction", value='ADD', text="CCW")
row.prop_enum(brush, "direction", value='SUBTRACT', text="CW")
class GreasePencilSculptOptionsPanel: class GreasePencilSculptOptionsPanel:

View File

@@ -199,22 +199,8 @@ def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=Fal
col.separator() col.separator()
if capabilities.has_radius: if not panel.is_popover:
row = col.row(align=True) brush_basic_texpaint_settings(col, context, brush)
panel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
panel.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
if capabilities.has_space_attenuation:
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
panel.prop_unified_strength(row, context, brush, "strength", text="Strength")
panel.prop_unified_strength(row, context, brush, "use_pressure_strength")
if brush.image_tool in {'DRAW', 'FILL'}:
col.separator()
col.prop(brush, "blend", text="Blend")
col = layout.column() col = layout.column()
@@ -311,6 +297,187 @@ def brush_mask_texture_settings(layout, brush):
col.prop(mask_tex_slot, "offset") col.prop(mask_tex_slot, "offset")
col.prop(mask_tex_slot, "scale") col.prop(mask_tex_slot, "scale")
# Basic Brush Options
#
# Share between topbar and brush panel.
def brush_basic_wpaint_settings(layout, context, brush, *, compact=False):
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
layout.separator()
layout.prop(brush, "blend", text="" if compact else "Blend")
def brush_basic_vpaint_settings(layout, context, brush, *, compact=False):
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
layout.separator()
layout.prop(brush, "blend", text="" if compact else "Blend")
def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
capabilities = brush.image_paint_capabilities
if capabilities.has_radius:
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
row = layout.row(align=True)
if capabilities.has_space_attenuation:
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
if brush.image_tool in {'DRAW', 'FILL'}:
layout.separator()
layout.prop(brush, "blend", text="" if compact else "Blend")
def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
tool_settings = context.tool_settings
capabilities = brush.sculpt_capabilities
row = layout.row(align=True)
ups = tool_settings.unified_paint_settings
if (
(ups.use_unified_size and ups.use_locked_size) or
((not ups.use_unified_size) and brush.use_locked_size)
):
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
UnifiedPaintPanel.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
else:
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
# strength, use_strength_pressure, and use_strength_attenuation
layout.separator()
row = layout.row(align=True)
if capabilities.has_space_attenuation:
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
if capabilities.has_strength_pressure:
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
# direction
layout.separator()
layout.row().prop(brush, "direction", expand=True, **({"text": ""} if compact else {}))
def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False):
gp_settings = brush.gpencil_settings
# Brush details
if brush.gpencil_tool == 'ERASE':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(gp_settings, "use_occlude_eraser", text="", icon='XRAY')
if gp_settings.eraser_mode == 'SOFT':
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.prop(gp_settings, "eraser_strength_factor")
row = layout.row(align=True)
row.prop(gp_settings, "eraser_thickness_factor")
elif brush.gpencil_tool == 'FILL':
col = layout.column(align=True)
col.prop(gp_settings, "fill_leak", text="Leak Size")
col.separator()
col.prop(brush, "size", text="Thickness")
col.prop(gp_settings, "fill_simplify_level", text="Simplify")
row = layout.row(align=True)
row.prop(gp_settings, "fill_draw_mode", text="Boundary Draw Mode")
row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
col = layout.column(align=True)
col.enabled = gp_settings.fill_draw_mode != 'STROKE'
col.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes")
sub = col.row(align=True)
sub.enabled = not gp_settings.show_fill
sub.prop(gp_settings, "fill_threshold", text="Threshold")
else: # brush.gpencil_tool == 'DRAW':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, compact=False):
tool_settings = context.tool_settings
settings = tool_settings.gpencil_sculpt
tool = settings.sculpt_tool
row = layout.row(align=True)
row.prop(brush, "size", slider=True)
sub = row.row(align=True)
sub.enabled = tool not in {'GRAB', 'CLONE'}
sub.prop(brush, "use_pressure_radius", text="")
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
layout.prop(brush, "use_falloff")
if compact:
if tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
row.separator()
row.prop(brush, "direction", expand=True, text="")
else:
use_property_split_prev = layout.use_property_split
layout.use_property_split = False
if tool in {'THICKNESS', 'STRENGTH'}:
layout.row().prop(brush, "direction", expand=True)
elif tool == 'PINCH':
row = layout.row(align=True)
row.prop_enum(brush, "direction", value='ADD', text="Pinch")
row.prop_enum(brush, "direction", value='SUBTRACT', text="Inflate")
elif tool == 'TWIST':
row = layout.row(align=True)
row.prop_enum(brush, "direction", value='ADD', text="CCW")
row.prop_enum(brush, "direction", value='SUBTRACT', text="CW")
layout.use_property_split = use_property_split_prev
def brush_basic_gpencil_weight_settings(layout, context, brush, *, compact=False):
layout.prop(brush, "size", slider=True)
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
layout.prop(brush, "use_falloff")
layout.prop(brush, "target_weight", slider=True)
classes = ( classes = (
VIEW3D_MT_tools_projectpaint_clone, VIEW3D_MT_tools_projectpaint_clone,

View File

@@ -236,11 +236,10 @@ class _draw_left_context_mode:
if brush is None: if brush is None:
return return
from .properties_paint_common import UnifiedPaintPanel from .properties_paint_common import (
brush_basic_sculpt_settings,
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") )
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") brush_basic_sculpt_settings(layout, context, brush, compact=True)
layout.prop(brush, "direction", text="", expand=True)
@staticmethod @staticmethod
def PAINT_TEXTURE(context, layout, tool): def PAINT_TEXTURE(context, layout, tool):
@@ -254,12 +253,12 @@ class _draw_left_context_mode:
if brush is None: if brush is None:
return return
from .properties_paint_common import UnifiedPaintPanel from .properties_paint_common import (
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") brush_basic_texpaint_settings(layout, context, brush, compact=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")
layout.prop(brush, "blend", text="")
@staticmethod @staticmethod
def PAINT_VERTEX(context, layout, tool): def PAINT_VERTEX(context, layout, tool):
@@ -273,12 +272,12 @@ class _draw_left_context_mode:
if brush is None: if brush is None:
return return
from .properties_paint_common import UnifiedPaintPanel from .properties_paint_common import (
UnifiedPaintPanel,
brush_basic_vpaint_settings,
)
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") brush_basic_vpaint_settings(layout, context, brush, compact=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")
layout.prop(brush, "blend", text="")
@staticmethod @staticmethod
def PAINT_WEIGHT(context, layout, tool): def PAINT_WEIGHT(context, layout, tool):
@@ -291,12 +290,8 @@ class _draw_left_context_mode:
if brush is None: if brush is None:
return return
from .properties_paint_common import UnifiedPaintPanel from .properties_paint_common import brush_basic_wpaint_settings
brush_basic_wpaint_settings(layout, context, brush, compact=True)
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True, text="Weight")
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")
layout.prop(brush, "blend", text="")
@staticmethod @staticmethod
def PAINT_GPENCIL(context, layout, tool): def PAINT_GPENCIL(context, layout, tool):
@@ -346,49 +341,24 @@ class _draw_left_context_mode:
settings = tool_settings.gpencil_paint settings = tool_settings.gpencil_paint
row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True) row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True)
if brush.gpencil_tool == 'ERASE': if brush.gpencil_tool in {'FILL', 'DRAW'}:
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(gp_settings, "use_occlude_eraser", text="", icon='XRAY')
if gp_settings.eraser_mode == 'SOFT':
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
elif brush.gpencil_tool == 'FILL':
row = layout.row()
row.prop(gp_settings, "fill_leak", text="Leak Size")
row.prop(brush, "size", text="Thickness")
row.prop(gp_settings, "fill_simplify_level", text="Simplify")
draw_color_selector() draw_color_selector()
row = layout.row(align=True) from .properties_paint_common import (
row.prop(gp_settings, "fill_draw_mode", text="") brush_basic_gpencil_paint_settings,
row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID') )
brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
else: # brush.gpencil_tool == 'DRAW': if tool.name in {"Arc", "Curve", "Line", "Box", "Circle"}:
settings = context.tool_settings.gpencil_sculpt
row = layout.row(align=True) row = layout.row(align=True)
row.prop(brush, "size", text="Radius") row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA')
if is_paint: sub = row.row(align=True)
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') sub.active = settings.use_thickness_curve
row = layout.row(align=True) sub.popover(
row.prop(gp_settings, "pen_strength", slider=True) panel="TOPBAR_PT_gpencil_primitive",
if is_paint: text="Thickness Profile"
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE') )
draw_color_selector()
if tool.name in {"Arc", "Curve", "Line", "Box", "Circle"}:
settings = context.tool_settings.gpencil_sculpt
row = layout.row(align=True)
row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA')
sub = row.row(align=True)
sub.active = settings.use_thickness_curve
sub.popover(
panel="TOPBAR_PT_gpencil_primitive",
text="Thickness Profile"
)
@staticmethod @staticmethod
def SCULPT_GPENCIL(context, layout, tool): def SCULPT_GPENCIL(context, layout, tool):
@@ -396,22 +366,12 @@ class _draw_left_context_mode:
return return
tool_settings = context.tool_settings tool_settings = context.tool_settings
settings = tool_settings.gpencil_sculpt settings = tool_settings.gpencil_sculpt
tool = settings.sculpt_tool
brush = settings.brush brush = settings.brush
row = layout.row(align=True) from .properties_paint_common import (
row.prop(brush, "size", slider=True) brush_basic_gpencil_sculpt_settings,
sub = row.row(align=True) )
sub.enabled = tool not in {'GRAB', 'CLONE'} brush_basic_gpencil_sculpt_settings(layout, context, brush, compact=True)
sub.prop(brush, "use_pressure_radius", text="")
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
if tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
row.separator()
row.prop(brush, "direction", expand=True, text="")
@staticmethod @staticmethod
def WEIGHT_GPENCIL(context, layout, tool): def WEIGHT_GPENCIL(context, layout, tool):
@@ -421,13 +381,10 @@ class _draw_left_context_mode:
settings = tool_settings.gpencil_sculpt settings = tool_settings.gpencil_sculpt
brush = settings.brush brush = settings.brush
layout.prop(brush, "size", slider=True) from .properties_paint_common import (
brush_basic_gpencil_weight_settings,
row = layout.row(align=True) )
row.prop(brush, "strength", slider=True) brush_basic_gpencil_weight_settings(layout, context, brush, compact=True)
row.prop(brush, "use_pressure_strength", text="")
layout.prop(brush, "target_weight", slider=True)
@staticmethod @staticmethod
def PARTICLE(context, layout, tool): def PARTICLE(context, layout, tool):
@@ -492,12 +449,12 @@ class _draw_left_context_mode:
if brush is None: if brush is None:
return return
from .properties_paint_common import UnifiedPaintPanel from .properties_paint_common import (
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") brush_basic_texpaint_settings(layout, context, brush, compact=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")
layout.prop(brush, "blend", text="")
class TOPBAR_PT_gpencil_layers(Panel): class TOPBAR_PT_gpencil_layers(Panel):

View File

@@ -27,9 +27,9 @@ from .properties_grease_pencil_common import (
) )
from .properties_paint_common import ( from .properties_paint_common import (
UnifiedPaintPanel, UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings, brush_mask_texture_settings,
brush_texpaint_common,
brush_texture_settings,
) )
from bl_operators.presets import PresetMenu from bl_operators.presets import PresetMenu
@@ -257,36 +257,18 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# Sculpt Mode # # Sculpt Mode #
elif context.sculpt_object and brush: elif context.sculpt_object and brush:
from .properties_paint_common import (
brush_basic_sculpt_settings,
)
capabilities = brush.sculpt_capabilities capabilities = brush.sculpt_capabilities
col = layout.column() col = layout.column()
col.separator() col.separator()
row = col.row(align=True) if not self.is_popover:
brush_basic_sculpt_settings(col, context, brush)
ups = tool_settings.unified_paint_settings
if ((ups.use_unified_size and ups.use_locked_size) or
((not ups.use_unified_size) and brush.use_locked_size)):
self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
self.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
else:
self.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
# strength, use_strength_pressure, and use_strength_attenuation
col.separator()
row = col.row(align=True)
if capabilities.has_space_attenuation:
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
self.prop_unified_strength(row, context, brush, "strength", text="Strength")
if capabilities.has_strength_pressure:
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
# auto_smooth_factor and use_inverse_smooth_pressure # auto_smooth_factor and use_inverse_smooth_pressure
if capabilities.has_auto_smooth: if capabilities.has_auto_smooth:
@@ -350,10 +332,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
col.prop(brush, "use_frontface", text="Front Faces Only") col.prop(brush, "use_frontface", text="Front Faces Only")
col.prop(brush, "use_projected") col.prop(brush, "use_projected")
# direction
col.separator()
col.row().prop(brush, "direction", expand=True)
# use_accumulate # use_accumulate
if capabilities.has_accumulate: if capabilities.has_accumulate:
col.separator() col.separator()
@@ -384,22 +362,14 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# Weight Paint Mode # # Weight Paint Mode #
elif context.weight_paint_object and brush: elif context.weight_paint_object and brush:
from .properties_paint_common import (
brush_basic_wpaint_settings,
)
col = layout.column() col = layout.column()
row = col.row(align=True) if not self.is_popover:
self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight") brush_basic_wpaint_settings(col, context, brush)
row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
col.separator()
col.prop(brush, "blend", text="Blend")
if brush.weight_tool != 'SMEAR': if brush.weight_tool != 'SMEAR':
col.prop(brush, "use_accumulate") col.prop(brush, "use_accumulate")
@@ -420,6 +390,10 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# Vertex Paint Mode # # Vertex Paint Mode #
elif context.vertex_paint_object and brush: elif context.vertex_paint_object and brush:
from .properties_paint_common import (
brush_basic_vpaint_settings,
)
col = layout.column() col = layout.column()
self.prop_unified_color_picker(col, context, brush, "color", value_slider=True) self.prop_unified_color_picker(col, context, brush, "color", value_slider=True)
if settings.palette: if settings.palette:
@@ -431,16 +405,10 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="") row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
col.separator() col.separator()
row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True) if not self.is_popover:
self.prop_unified_strength(row, context, brush, "strength", text="Strength") brush_basic_vpaint_settings(col, context, brush)
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
col.separator()
col.prop(brush, "blend", text="Blend")
col.prop(brush, "use_alpha") col.prop(brush, "use_alpha")
if brush.vertex_tool != 'SMEAR': if brush.vertex_tool != 'SMEAR':
@@ -1501,52 +1469,14 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
# XXX: Items in "sub" currently show up beside the brush selector in a separate column # XXX: Items in "sub" currently show up beside the brush selector in a separate column
if brush.gpencil_tool == 'ERASE': if brush.gpencil_tool == 'ERASE':
sub.prop(gp_settings, "use_default_eraser", text="") sub.prop(gp_settings, "use_default_eraser", text="")
elif brush.gpencil_tool in {'DRAW', 'FILL'}:
layout.row(align=True).template_ID(gp_settings, "material")
# Brush details if not self.is_popover:
if brush.gpencil_tool == 'ERASE': from .properties_paint_common import (
row = layout.row(align=True) brush_basic_gpencil_paint_settings,
row.prop(brush, "size", text="Radius") )
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
row.prop(gp_settings, "use_occlude_eraser", text="", icon='XRAY')
if gp_settings.eraser_mode == 'SOFT':
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.prop(gp_settings, "eraser_strength_factor")
row = layout.row(align=True)
row.prop(gp_settings, "eraser_thickness_factor")
elif brush.gpencil_tool == 'FILL':
col = layout.column(align=True)
col.prop(gp_settings, "fill_leak", text="Leak Size")
col.separator()
col.prop(brush, "size", text="Thickness")
col.prop(gp_settings, "fill_simplify_level", text="Simplify")
col = layout.row(align=True)
col.template_ID(gp_settings, "material")
row = layout.row(align=True)
row.prop(gp_settings, "fill_draw_mode", text="Boundary Draw Mode")
row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
col = layout.column(align=True)
col.enabled = gp_settings.fill_draw_mode != 'STROKE'
col.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes")
sub = col.row(align=True)
sub.enabled = not gp_settings.show_fill
sub.prop(gp_settings, "fill_threshold", text="Threshold")
else: # bgpsettings.tool == 'DRAW':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.template_ID(gp_settings, "material")
# Grease Pencil drawing brushes options # Grease Pencil drawing brushes options
@@ -1830,12 +1760,12 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint(View3DPanel, Panel):
layout.template_icon_view(settings, "weight_tool", show_labels=True) layout.template_icon_view(settings, "weight_tool", show_labels=True)
col = layout.column() col = layout.column()
col.prop(brush, "size", slider=True)
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
col.prop(brush, "use_falloff") if not self.is_popover:
from .properties_paint_common import (
brush_basic_gpencil_weight_settings,
)
brush_basic_gpencil_weight_settings(col, context, brush)
# Grease Pencil Brush Appeareance (one for each mode) # Grease Pencil Brush Appeareance (one for each mode)