diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2012-01-18 04:41:39 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2012-01-18 04:41:39 +0400 |
commit | 6a218612be7be727a9cad6b85b2f368d78c5c422 (patch) | |
tree | 797bf1fb05fcadb4a58d8acfd1b3accc6e416d01 /release | |
parent | b4df2658de8b4cb76664356cf704ced9a37c6c9e (diff) |
fix size slider not working for image space brushes (uv sculpt and image paint). This is due to not checking if unified settings are active as per recent commit. Reused the space_view3D PaintPanel utility class slightly modified for the image space to do the checks. I am not very happy with the duplication but I decided to keep it as is since I change bl_space_type and bl_region_type from the original class. Reviewed by Nicholas Bishop.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 625c3b1ab2f..5d091fb4b88 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -20,6 +20,47 @@ import bpy from bpy.types import Header, Menu, Panel +class PaintPanel(): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + + @staticmethod + def paint_settings(context): + toolsettings = context.tool_settings + + if context.sculpt_object: + return toolsettings.sculpt + elif context.vertex_paint_object: + return toolsettings.vertex_paint + elif context.weight_paint_object: + return toolsettings.weight_paint + elif context.image_paint_object: + return toolsettings.image_paint + elif context.particle_edit_object: + return toolsettings.particle_edit + + return None + + @staticmethod + def unified_paint_settings(parent, context): + ups = context.tool_settings.unified_paint_settings + parent.label(text="Unified Settings:") + parent.prop(ups, "use_unified_size", text="Size") + parent.prop(ups, "use_unified_strength", text="Strength") + + @staticmethod + def prop_unified_size(parent, context, brush, prop_name, icon='NONE', text="", 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): + 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) + + class BrushButtonsPanel(): bl_space_type = 'IMAGE_EDITOR' @@ -641,7 +682,7 @@ class IMAGE_PT_view_properties(Panel): sub.row().prop(uvedit, "draw_stretch_type", expand=True) -class IMAGE_PT_paint(Panel): +class IMAGE_PT_paint(Panel, PaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = "Paint" @@ -666,13 +707,13 @@ class IMAGE_PT_paint(Panel): col.prop(brush, "color", text="") row = col.row(align=True) - row.prop(brush, "size", slider=True) - row.prop(brush, "use_pressure_size", toggle=True, text="") + self.prop_unified_size(row, context, brush, "size", slider=True) + self.prop_unified_size(row, context, brush, "use_pressure_size") row = col.row(align=True) - row.prop(brush, "strength", slider=True) - row.prop(brush, "use_pressure_strength", toggle=True, text="") - + self.prop_unified_strength(row, context, brush, "strength", slider=True) + self.prop_unified_strength(row, context, brush, "use_pressure_strength") + row = col.row(align=True) row.prop(brush, "jitter", slider=True) row.prop(brush, "use_pressure_jitter", toggle=True, text="") @@ -793,7 +834,7 @@ class IMAGE_UV_sculpt_curve(bpy.types.Panel): row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' -class IMAGE_UV_sculpt(bpy.types.Panel): +class IMAGE_UV_sculpt(bpy.types.Panel, PaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = "UV Sculpt" @@ -815,13 +856,13 @@ class IMAGE_UV_sculpt(bpy.types.Panel): col = layout.column() row = col.row(align=True) - row.prop(brush, "size", slider=True) - row.prop(brush, "use_pressure_size", toggle=True, text="") + self.prop_unified_size(row, context, brush, "size", slider=True) + self.prop_unified_size(row, context, brush, "use_pressure_size") row = col.row(align=True) - row.prop(brush, "strength", slider=True) - row.prop(brush, "use_pressure_strength", toggle=True, text="") - + self.prop_unified_strength(row, context, brush, "strength", slider=True) + self.prop_unified_strength(row, context, brush, "use_pressure_strength") + split = layout.split() col = split.column() |