UI: show uv sculpt options in topbar & toolsettings

This commit is contained in:
Campbell Barton 2018-10-05 14:53:18 +10:00
parent 19d8aa5652
commit 402bde39d1
3 changed files with 59 additions and 31 deletions

@ -1158,22 +1158,16 @@ class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel):
class IMAGE_PT_uv_sculpt_curve(Panel): class IMAGE_PT_uv_sculpt_curve(Panel):
bl_space_type = 'IMAGE_EDITOR' bl_space_type = 'PROPERTIES'
bl_region_type = 'TOOLS' bl_region_type = 'WINDOW'
bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
bl_category = "Options"
bl_label = "UV Sculpt Curve" bl_label = "UV Sculpt Curve"
bl_category = "Tools"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
sima = context.space_data return IMAGE_PT_uv_sculpt.poll(context)
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)
)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -1193,39 +1187,45 @@ class IMAGE_PT_uv_sculpt_curve(Panel):
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
class IMAGE_PT_uv_sculpt(Panel, ImagePaintPanel): class IMAGE_PT_uv_sculpt(Panel):
bl_space_type = 'IMAGE_EDITOR' bl_space_type = 'PROPERTIES'
bl_region_type = 'TOOLS' bl_region_type = 'WINDOW'
bl_category = "Tools" bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
bl_category = "Options"
bl_label = "UV Sculpt" bl_label = "UV Sculpt"
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
sima = context.space_data tool_settings = context.tool_settings
toolsettings = context.tool_settings.image_paint if tool_settings.use_uv_sculpt:
return ( if context.mode == 'EDIT_MESH':
sima.show_uvedit and workspace = context.workspace
context.tool_settings.use_uv_sculpt and space_type = workspace.tools_space_type
not (sima.show_paint and toolsettings.brush) if space_type == 'IMAGE_EDITOR':
) mode = workspace.tools_mode
if mode == 'VIEW':
return True
return False
def draw(self, context): def draw(self, context):
from .properties_paint_common import UnifiedPaintPanel
layout = self.layout layout = self.layout
toolsettings = context.tool_settings toolsettings = context.tool_settings
uvsculpt = toolsettings.uv_sculpt uvsculpt = toolsettings.uv_sculpt
brush = uvsculpt.brush brush = uvsculpt.brush
if brush: if not self.is_popover:
col = layout.column() if brush:
col = layout.column()
row = col.row(align=True) row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius") UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size") UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True) row = col.row(align=True)
self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength") UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
col = layout.column() col = layout.column()
col.prop(toolsettings, "uv_sculpt_lock_borders") col.prop(toolsettings, "uv_sculpt_lock_borders")

@ -162,6 +162,13 @@ class TOPBAR_HT_lower_bar(Header):
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="") layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="")
elif tool_mode == 'GPENCIL_WEIGHT': elif tool_mode == 'GPENCIL_WEIGHT':
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_weight", category="") 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): def draw_center(self, context):
pass pass
@ -301,6 +308,24 @@ class _draw_left_context_mode:
layout.row().prop(brush, "puff_mode", expand=True) layout.row().prop(brush, "puff_mode", expand=True)
layout.prop(brush, "use_puff_volume") 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): class TOPBAR_PT_gpencil_layers(Panel):
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'

@ -260,7 +260,10 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
} }
} }
else if (workspace->tools_space_type == SPACE_IMAGE) { else if (workspace->tools_space_type == SPACE_IMAGE) {
/* TODO */ switch (mode) {
case CTX_MODE_EDIT_MESH:
ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
}
} }
/* for grease pencil we don't use tool system yet, so we need check outside /* for grease pencil we don't use tool system yet, so we need check outside