[Bf-blender-cvs] [d8daeeb9300] master: UI: Avoid redundant text argument to UnifiedPaintPanel methods

Campbell Barton noreply at git.blender.org
Tue Mar 12 06:32:08 CET 2019


Commit: d8daeeb9300953ee175e06c8fc1aa3a44a72da20
Author: Campbell Barton
Date:   Tue Mar 12 16:19:37 2019 +1100
Branches: master
https://developer.blender.org/rBd8daeeb9300953ee175e06c8fc1aa3a44a72da20

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.

===================================================================

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_view3d.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 9a7f5d6437e..1a1f0fa3fb7 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -66,25 +66,25 @@ class UnifiedPaintPanel:
             col.prop(ups, "use_unified_color", text="Color")
 
     @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
         ptr = ups if ups.use_unified_size else brush
         parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
 
     @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
         ptr = ups if ups.use_unified_strength else brush
         parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
 
     @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
         ptr = ups if ups.use_unified_weight else brush
         parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
 
     @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
         ptr = ups if ups.use_unified_color else brush
         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:
         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)
-    UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
-    UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
+    UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
+    UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
 
     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")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
 
     layout.separator()
     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
 
     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")
+    UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
+    UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
 
     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")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
 
 
     if capabilities.has_color:
@@ -342,16 +342,16 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
 
     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")
+        UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
+        UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
 
     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")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
+    UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
 
     if capabilities.has_color:
         layout.separator()
@@ -363,7 +363,7 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
     capabilities = brush.sculpt_capabilities
 
     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
     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")
     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
     layout.separator()
@@ -383,10 +383,10 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
     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, "strength")
 
     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
     layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index ac0e28f90cc..14de0d9826a 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1148,12 +1148,12 @@ class IMAGE_PT_uv_sculpt(Panel):
                 col = layout.column()
 
                 row = col.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")
+                UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
+                UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
 
                 row = col.row(align=True)
-                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
-                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
+                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True)
+                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
 
         col = layout.column()
         col.prop(tool_settings, "uv_sculpt_lock_borders")
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index cc17f6cfbe8..242c90635df 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -981,10 +981,8 @@ class _defs_weight_paint:
             brush = context.tool_settings.weight_paint.brush
             if brush is not None:
                 from .properties_paint_common import UnifiedPaintPanel
-                UnifiedPaintPanel.prop_unified_weight(
-                    layout, context, brush, "weight", slider=True, text="Weight")
-                UnifiedPaintPanel.prop_unified_strength(
-                    layout, context, brush, "strength", slider=True, text="Strength")
+                UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True)
+                UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True)
             props = tool.operator_properties("paint.weight_gradient")
             layout.prop(props, "type")
 
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 135982130b0..6e780df126d 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -441,12 +441,12 @@ class _draw_left_context_mode:
                         from .properties_paint_common import UnifiedPaintPanel
 
                         row = layout.row(align=True)
-                        UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
-                        UnifiedPaintPanel.prop_unified_size(row, con

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list