UI: Avoid redundant text argument to UnifiedPaintPanel methods
Now when the text argument is omitted, use the default name matching how regular properties work. Avoids passing in the same name which RNA has, matches UILayout.prop behavior. Also use keyword only for optional arguments.
This commit is contained in:
@@ -66,25 +66,25 @@ class UnifiedPaintPanel:
|
|||||||
col.prop(ups, "use_unified_color", text="Color")
|
col.prop(ups, "use_unified_color", text="Color")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prop_unified_size(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
|
def prop_unified_size(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
||||||
ups = context.tool_settings.unified_paint_settings
|
ups = context.tool_settings.unified_paint_settings
|
||||||
ptr = ups if ups.use_unified_size else brush
|
ptr = ups if ups.use_unified_size else brush
|
||||||
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prop_unified_strength(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
|
def prop_unified_strength(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
||||||
ups = context.tool_settings.unified_paint_settings
|
ups = context.tool_settings.unified_paint_settings
|
||||||
ptr = ups if ups.use_unified_strength else brush
|
ptr = ups if ups.use_unified_strength else brush
|
||||||
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prop_unified_weight(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
|
def prop_unified_weight(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
||||||
ups = context.tool_settings.unified_paint_settings
|
ups = context.tool_settings.unified_paint_settings
|
||||||
ptr = ups if ups.use_unified_weight else brush
|
ptr = ups if ups.use_unified_weight else brush
|
||||||
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prop_unified_color(parent, context, brush, prop_name, text=""):
|
def prop_unified_color(parent, context, brush, prop_name, *, text=None):
|
||||||
ups = context.tool_settings.unified_paint_settings
|
ups = context.tool_settings.unified_paint_settings
|
||||||
ptr = ups if ups.use_unified_color else brush
|
ptr = ups if ups.use_unified_color else brush
|
||||||
parent.prop(ptr, prop_name, text=text)
|
parent.prop(ptr, prop_name, text=text)
|
||||||
@@ -306,15 +306,15 @@ def brush_basic_wpaint_settings(layout, context, brush, *, compact=False):
|
|||||||
|
|
||||||
if capabilities.has_weight:
|
if capabilities.has_weight:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
|
UnifiedPaintPanel.prop_unified_weight(row, context, brush, "weight", slider=True)
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.prop(brush, "blend", text="" if compact else "Blend")
|
layout.prop(brush, "blend", text="" if compact else "Blend")
|
||||||
@@ -324,12 +324,12 @@ def brush_basic_vpaint_settings(layout, context, brush, *, compact=False):
|
|||||||
capabilities = brush.vertex_paint_capabilities
|
capabilities = brush.vertex_paint_capabilities
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
|
|
||||||
if capabilities.has_color:
|
if capabilities.has_color:
|
||||||
@@ -342,16 +342,16 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
|
|||||||
|
|
||||||
if capabilities.has_radius:
|
if capabilities.has_radius:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
|
|
||||||
if capabilities.has_space_attenuation:
|
if capabilities.has_space_attenuation:
|
||||||
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
|
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, "strength")
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
if capabilities.has_color:
|
if capabilities.has_color:
|
||||||
layout.separator()
|
layout.separator()
|
||||||
@@ -363,7 +363,7 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
|
|||||||
capabilities = brush.sculpt_capabilities
|
capabilities = brush.sculpt_capabilities
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_locked_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_locked_size", text="")
|
||||||
|
|
||||||
ups = tool_settings.unified_paint_settings
|
ups = tool_settings.unified_paint_settings
|
||||||
if (
|
if (
|
||||||
@@ -372,9 +372,9 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
|
|||||||
):
|
):
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
|
||||||
else:
|
else:
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
|
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
# strength, use_strength_pressure, and use_strength_attenuation
|
# strength, use_strength_pressure, and use_strength_attenuation
|
||||||
layout.separator()
|
layout.separator()
|
||||||
@@ -383,10 +383,10 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
|
|||||||
if capabilities.has_space_attenuation:
|
if capabilities.has_space_attenuation:
|
||||||
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
|
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, "strength")
|
||||||
|
|
||||||
if capabilities.has_strength_pressure:
|
if capabilities.has_strength_pressure:
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
# direction
|
# direction
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|||||||
@@ -1148,12 +1148,12 @@ class IMAGE_PT_uv_sculpt(Panel):
|
|||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.prop(tool_settings, "uv_sculpt_lock_borders")
|
col.prop(tool_settings, "uv_sculpt_lock_borders")
|
||||||
|
|||||||
@@ -981,10 +981,8 @@ class _defs_weight_paint:
|
|||||||
brush = context.tool_settings.weight_paint.brush
|
brush = context.tool_settings.weight_paint.brush
|
||||||
if brush is not None:
|
if brush is not None:
|
||||||
from .properties_paint_common import UnifiedPaintPanel
|
from .properties_paint_common import UnifiedPaintPanel
|
||||||
UnifiedPaintPanel.prop_unified_weight(
|
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True)
|
||||||
layout, context, brush, "weight", slider=True, text="Weight")
|
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(
|
|
||||||
layout, context, brush, "strength", slider=True, text="Strength")
|
|
||||||
props = tool.operator_properties("paint.weight_gradient")
|
props = tool.operator_properties("paint.weight_gradient")
|
||||||
layout.prop(props, "type")
|
layout.prop(props, "type")
|
||||||
|
|
||||||
|
|||||||
@@ -441,12 +441,12 @@ class _draw_left_context_mode:
|
|||||||
from .properties_paint_common import UnifiedPaintPanel
|
from .properties_paint_common import UnifiedPaintPanel
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def PAINT(context, layout, tool):
|
def PAINT(context, layout, tool):
|
||||||
|
|||||||
@@ -5747,8 +5747,8 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
brush = context.tool_settings.vertex_paint.brush
|
brush = context.tool_settings.vertex_paint.brush
|
||||||
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True)
|
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_paint_texture_context_menu(Panel):
|
class VIEW3D_PT_paint_texture_context_menu(Panel):
|
||||||
@@ -5761,8 +5761,8 @@ class VIEW3D_PT_paint_texture_context_menu(Panel):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
brush = context.tool_settings.image_paint.brush
|
brush = context.tool_settings.image_paint.brush
|
||||||
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True)
|
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_paint_weight_context_menu(Panel):
|
class VIEW3D_PT_paint_weight_context_menu(Panel):
|
||||||
@@ -5775,9 +5775,9 @@ class VIEW3D_PT_paint_weight_context_menu(Panel):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
brush = context.tool_settings.weight_paint.brush
|
brush = context.tool_settings.weight_paint.brush
|
||||||
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", text="Weight", slider=True)
|
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True)
|
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_sculpt_context_menu(Panel):
|
class VIEW3D_PT_sculpt_context_menu(Panel):
|
||||||
@@ -5791,8 +5791,8 @@ class VIEW3D_PT_sculpt_context_menu(Panel):
|
|||||||
|
|
||||||
brush = context.tool_settings.sculpt.brush
|
brush = context.tool_settings.sculpt.brush
|
||||||
|
|
||||||
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True)
|
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
|
||||||
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength")
|
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
|
||||||
|
|
||||||
|
|
||||||
class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel):
|
class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel):
|
||||||
|
|||||||
Reference in New Issue
Block a user