diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-05 07:53:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-05 07:54:53 +0300 |
commit | 402bde39d135d2bbc314743f37f65693597c57b1 (patch) | |
tree | 183301f6dbb8c0828d8059b7ed005bd800671a8d /release/scripts | |
parent | 19d8aa5652bde6e7c61af3601c75c12399370fb8 (diff) |
UI: show uv sculpt options in topbar & toolsettings
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 60 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 25 |
2 files changed, 55 insertions, 30 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index cf6db15e3a2..22f85ad37ae 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1158,22 +1158,16 @@ class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel): class IMAGE_PT_uv_sculpt_curve(Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'TOOLS' + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = ".uv_sculpt" # dot on purpose (access from topbar) + bl_category = "Options" bl_label = "UV Sculpt Curve" - bl_category = "Tools" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): - sima = context.space_data - toolsettings = context.tool_settings.image_paint - - return ( - sima.show_uvedit and - context.tool_settings.use_uv_sculpt and - not (sima.show_paint and toolsettings.brush) - ) + return IMAGE_PT_uv_sculpt.poll(context) def draw(self, context): layout = self.layout @@ -1193,39 +1187,45 @@ class IMAGE_PT_uv_sculpt_curve(Panel): row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' -class IMAGE_PT_uv_sculpt(Panel, ImagePaintPanel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'TOOLS' - bl_category = "Tools" +class IMAGE_PT_uv_sculpt(Panel): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = ".uv_sculpt" # dot on purpose (access from topbar) + bl_category = "Options" bl_label = "UV Sculpt" @classmethod def poll(cls, context): - sima = context.space_data - toolsettings = context.tool_settings.image_paint - return ( - sima.show_uvedit and - context.tool_settings.use_uv_sculpt and - not (sima.show_paint and toolsettings.brush) - ) + tool_settings = context.tool_settings + if tool_settings.use_uv_sculpt: + if context.mode == 'EDIT_MESH': + workspace = context.workspace + space_type = workspace.tools_space_type + if space_type == 'IMAGE_EDITOR': + mode = workspace.tools_mode + if mode == 'VIEW': + return True + return False def draw(self, context): + from .properties_paint_common import UnifiedPaintPanel layout = self.layout toolsettings = context.tool_settings uvsculpt = toolsettings.uv_sculpt brush = uvsculpt.brush - if brush: - col = layout.column() + if not self.is_popover: + if brush: + col = layout.column() - row = col.row(align=True) - self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius") - self.prop_unified_size(row, context, brush, "use_pressure_size") + 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") - row = col.row(align=True) - self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") - self.prop_unified_strength(row, context, brush, "use_pressure_strength") + 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") col = layout.column() col.prop(toolsettings, "uv_sculpt_lock_borders") diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 4406df5cd7b..2712d09c272 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -162,6 +162,13 @@ class TOPBAR_HT_lower_bar(Header): layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="") elif tool_mode == 'GPENCIL_WEIGHT': layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_weight", category="") + elif tool_space_type == 'IMAGE_EDITOR': + if tool_mode == 'VIEW': + mode = context.mode + if mode == 'EDIT_MESH': + tool_settings = context.tool_settings + if tool_settings.use_uv_sculpt: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".uv_sculpt", category="") def draw_center(self, context): pass @@ -301,6 +308,24 @@ class _draw_left_context_mode: layout.row().prop(brush, "puff_mode", expand=True) layout.prop(brush, "use_puff_volume") + class IMAGE_EDITOR: + def VIEW(context, layout, tool): + tool_settings = context.tool_settings + if tool_settings.use_uv_sculpt: + if context.mode == 'EDIT_MESH': + uv_sculpt = tool_settings.uv_sculpt + brush = uv_sculpt.brush + if brush: + 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, context, brush, "use_pressure_size") + + row = layout.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") + class TOPBAR_PT_gpencil_layers(Panel): bl_space_type = 'VIEW_3D' |