From 2ed0f08106a67f28768ffb7085df8fd6c0673a57 Mon Sep 17 00:00:00 2001 From: William Reynish Date: Mon, 11 Mar 2019 15:01:07 +0100 Subject: UI: Add brush controls to contextual menus for Texture Paint, Vertex Paint, Sculpt Mode Maniphest task: T62130 --- release/scripts/startup/bl_ui/space_view3d.py | 78 ++++++++++++++++++++------- 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 292884b0ae5..a2484a39281 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5694,19 +5694,22 @@ class VIEW3D_PT_paint_vertex_specials(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 - # TODO: populate with useful items. - layout.operator("paint.vertex_color_set") - layout.operator("paint.vertex_color_smooth") - layout.operator("paint.vertex_color_dirt") - layout.operator("paint.vertex_color_from_weight") - layout.separator() + # Size + if ups.use_unified_size: + layout.prop(ups, "size", slider=True) + else: + layout.prop(brush, "size", slider=True) - layout.operator("paint.vertex_color_invert", text="Invert") - layout.operator("paint.vertex_color_levels", text="Levels") - layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value") - layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast") + # Strength + if ups.use_unified_strength: + layout.prop(ups, "strength") + else: + layout.prop(brush, "strength") class VIEW3D_PT_paint_texture_specials(Panel): @@ -5716,9 +5719,22 @@ class VIEW3D_PT_paint_texture_specials(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 - # TODO: populate with useful items. - layout.operator("image.save_dirty") + + # 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") class VIEW3D_PT_paint_weight_specials(Panel): @@ -5732,12 +5748,23 @@ class VIEW3D_PT_paint_weight_specials(Panel): 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") - layout.prop(ups, "size", slider=True) - layout.prop(ups, "strength") + + # 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") class VIEW3D_PT_sculpt_specials(Panel): @@ -5747,10 +5774,25 @@ class VIEW3D_PT_sculpt_specials(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 - # TODO: populate with useful items. - layout.operator("object.shade_smooth") - layout.operator("object.shade_flat") + + # Direction + layout.prop(brush, "direction", expand=True) + + # 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") class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel): -- cgit v1.2.3