diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 07:29:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 07:32:20 +0300 |
commit | 819c00483dad75c25256e940ca43a6e3992f55de (patch) | |
tree | 8de290278c61288eab21b2c7188fb83d7a2bcc8d /release | |
parent | ee01b660eb5b17aefdb9773fc1269934136f1d15 (diff) |
Cleanup: use UnifiedPaintPanel for context menu
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 73 |
1 files changed, 13 insertions, 60 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index d9ddfb7833d..61fd6d0318b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5744,22 +5744,11 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel): bl_label = "Vertex Paint Context Menu" def draw(self, context): - brush = context.tool_settings.vertex_paint.brush - ups = context.tool_settings.unified_paint_settings - layout = self.layout - # Size - if ups.use_unified_size: - layout.prop(ups, "size", slider=True) - else: - layout.prop(brush, "size", slider=True) - - # Strength - if ups.use_unified_strength: - layout.prop(ups, "strength") - else: - layout.prop(brush, "strength") + brush = context.tool_settings.vertex_paint.brush + UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True) + UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength") class VIEW3D_PT_paint_texture_context_menu(Panel): @@ -5769,22 +5758,11 @@ class VIEW3D_PT_paint_texture_context_menu(Panel): bl_label = "Texture Paint Context Menu" def draw(self, context): - brush = context.tool_settings.image_paint.brush - ups = context.tool_settings.unified_paint_settings - layout = self.layout - # Size - if ups.use_unified_size: - layout.prop(ups, "size", slider=True) - else: - layout.prop(brush, "size", slider=True) - - # Strength - if ups.use_unified_strength: - layout.prop(ups, "strength") - else: - layout.prop(brush, "strength") + brush = context.tool_settings.image_paint.brush + UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True) + UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength") class VIEW3D_PT_paint_weight_context_menu(Panel): @@ -5794,27 +5772,12 @@ class VIEW3D_PT_paint_weight_context_menu(Panel): bl_label = "Weights Context Menu" def draw(self, context): - brush = context.tool_settings.weight_paint.brush - capabilities = brush.weight_paint_capabilities - ups = context.tool_settings.unified_paint_settings - layout = self.layout - # Weight - if capabilities.has_weight or brush.use_gradient: - layout.prop(ups, "weight") - - # Size - if ups.use_unified_size: - layout.prop(ups, "size", slider=True) - else: - layout.prop(brush, "size", slider=True) - - # Strength - if ups.use_unified_strength: - layout.prop(ups, "strength") - else: - layout.prop(brush, "strength") + brush = context.tool_settings.weight_paint.brush + UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", text="Weight", slider=True) + UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True) + UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength") class VIEW3D_PT_sculpt_context_menu(Panel): @@ -5824,22 +5787,12 @@ class VIEW3D_PT_sculpt_context_menu(Panel): bl_label = "Sculpt Context Menu" def draw(self, context): - brush = context.tool_settings.sculpt.brush - ups = context.tool_settings.unified_paint_settings - layout = self.layout - # Size - if ups.use_unified_size: - layout.prop(ups, "size", slider=True) - else: - layout.prop(brush, "size", slider=True) + brush = context.tool_settings.sculpt.brush - # Strength - if ups.use_unified_strength: - layout.prop(ups, "strength") - else: - layout.prop(brush, "strength") + UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", text="Size", slider=True) + UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", text="Strength") class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel): |