diff options
author | William Reynish <billrey@me.com> | 2019-08-04 13:37:22 +0300 |
---|---|---|
committer | William Reynish <billrey@me.com> | 2019-08-04 13:37:22 +0300 |
commit | c0aada58c9820b36176ec54d281513eeac65ca0c (patch) | |
tree | 7f5b30af44af4a1889846fdf7188bb4515fd685b /release/scripts/startup/bl_ui | |
parent | dd3cdf6f1e9d7b19cc0b4bb85136a12e558e291d (diff) |
Tweak Brush Gradient UI
Gradient and Color are mutually exclusive, so we now communicate this in the UI much more clearly
Differential Revision: https://developer.blender.org/D5395
Reviewers: brechrt
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 40 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 43 |
2 files changed, 14 insertions, 69 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index a483ff3f291..eea34beaad1 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1077,9 +1077,12 @@ class IMAGE_PT_paint_color(Panel, ImagePaintPanel): settings = context.tool_settings.image_paint brush = settings.brush - layout.active = not brush.use_gradient + layout.prop(brush, "color_type", expand=True) - brush_texpaint_common_color(self, context, layout, brush, settings, True) + if brush.color_type == 'COLOR': + brush_texpaint_common_color(self, context, layout, brush, settings, True) + elif brush.color_type == 'GRADIENT': + brush_texpaint_common_gradient(self, context, layout, brush, settings, True) class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): @@ -1106,38 +1109,6 @@ class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): layout.template_palette(settings, "palette", color=True) -class IMAGE_PT_paint_gradient(Panel, ImagePaintPanel): - bl_category = "Tool" - bl_context = ".paint_common_2d" - bl_parent_id = "IMAGE_PT_paint" - bl_label = "Gradient" - bl_options = {'DEFAULT_CLOSED'} - - @classmethod - def poll(cls, context): - settings = context.tool_settings.image_paint - brush = settings.brush - capabilities = brush.image_paint_capabilities - - return capabilities.has_color - - def draw_header(self, context): - settings = context.tool_settings.image_paint - brush = settings.brush - self.layout.prop(brush, "use_gradient", text="") - - def draw(self, context): - layout = self.layout - layout.use_property_split = False - layout.use_property_decorate = False # No animation. - settings = context.tool_settings.image_paint - brush = settings.brush - - layout.active = brush.use_gradient - - brush_texpaint_common_gradient(self, context, layout, brush, settings, True) - - class IMAGE_PT_paint_clone(Panel, ImagePaintPanel): bl_category = "Tool" bl_context = ".paint_common_2d" @@ -1740,7 +1711,6 @@ classes = ( IMAGE_PT_paint, IMAGE_PT_paint_color, IMAGE_PT_paint_swatches, - IMAGE_PT_paint_gradient, IMAGE_PT_paint_clone, IMAGE_PT_paint_options, IMAGE_PT_tools_brush_texture, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index df605229922..262fafa596d 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -429,9 +429,16 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel): settings = self.paint_settings(context) brush = settings.brush - layout.active = not brush.use_gradient + if context.vertex_paint_object: + brush_texpaint_common_color(self, context, layout, brush, settings, True) + + else: + layout.prop(brush, "color_type", expand=True) - brush_texpaint_common_color(self, context, layout, brush, settings, True) + if brush.color_type == 'COLOR': + brush_texpaint_common_color(self, context, layout, brush, settings, True) + elif brush.color_type == 'GRADIENT': + brush_texpaint_common_gradient(self, context, layout, brush, settings, True) class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel): @@ -461,37 +468,6 @@ class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel): layout.template_palette(settings, "palette", color=True) -class VIEW3D_PT_tools_brush_gradient(Panel, View3DPaintPanel): - bl_context = ".paint_common" # dot on purpose (access from topbar) - bl_parent_id = "VIEW3D_PT_tools_brush" - bl_label = "Gradient" - bl_options = {'DEFAULT_CLOSED'} - - @classmethod - def poll(cls, context): - settings = cls.paint_settings(context) - brush = settings.brush - capabilities = brush.image_paint_capabilities - - return capabilities.has_color and context.image_paint_object - - def draw_header(self, context): - settings = self.paint_settings(context) - brush = settings.brush - self.layout.prop(brush, "use_gradient", text="") - - def draw(self, context): - layout = self.layout - layout.use_property_split = False - layout.use_property_decorate = False # No animation. - settings = self.paint_settings(context) - brush = settings.brush - - layout.active = brush.use_gradient - - brush_texpaint_common_gradient(self, context, layout, brush, settings, True) - - class VIEW3D_PT_tools_brush_clone(Panel, View3DPaintPanel): bl_context = ".paint_common" # dot on purpose (access from topbar) bl_parent_id = "VIEW3D_PT_tools_brush" @@ -2106,7 +2082,6 @@ classes = ( VIEW3D_PT_tools_brush, VIEW3D_PT_tools_brush_color, VIEW3D_PT_tools_brush_swatches, - VIEW3D_PT_tools_brush_gradient, VIEW3D_PT_tools_brush_clone, VIEW3D_PT_tools_brush_options, TEXTURE_UL_texpaintslots, |