forked from bartvdbraak/blender
UI: move 2d paint panels to topbar & toolsettings
Removed 'Tool' and 'Options' panels, both these settings are quite obscure and already available in the 'Brush' menu.
This commit is contained in:
parent
03e0fd289d
commit
bf34f95a9e
@ -39,30 +39,18 @@ from bpy.app.translations import pgettext_iface as iface_
|
||||
|
||||
|
||||
class ImagePaintPanel(UnifiedPaintPanel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
|
||||
|
||||
class BrushButtonsPanel(UnifiedPaintPanel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sima = context.space_data
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
return sima.show_paint and toolsettings.brush
|
||||
|
||||
|
||||
class UVToolsPanel:
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_category = "Tools"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sima = context.space_data
|
||||
return sima.show_uvedit and not context.tool_settings.use_uv_sculpt
|
||||
return toolsettings.brush
|
||||
|
||||
|
||||
class IMAGE_MT_view(Menu):
|
||||
@ -846,7 +834,8 @@ class IMAGE_PT_render_slots(Panel):
|
||||
|
||||
|
||||
class IMAGE_PT_paint(Panel, ImagePaintPanel):
|
||||
bl_label = "Paint"
|
||||
bl_label = "Brush"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_category = "Tools"
|
||||
|
||||
def draw(self, context):
|
||||
@ -861,14 +850,10 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
|
||||
if brush:
|
||||
brush_texpaint_common(self, context, layout, brush, settings)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sima = context.space_data
|
||||
return sima.show_paint
|
||||
|
||||
|
||||
class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
|
||||
bl_label = "Overlay"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Options"
|
||||
|
||||
@ -932,6 +917,7 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
|
||||
|
||||
class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
|
||||
bl_label = "Texture"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Tools"
|
||||
|
||||
@ -949,6 +935,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
|
||||
|
||||
class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
|
||||
bl_label = "Texture Mask"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Tools"
|
||||
|
||||
@ -964,27 +951,9 @@ class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
|
||||
brush_mask_texture_settings(col, brush)
|
||||
|
||||
|
||||
class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel):
|
||||
bl_label = "Tool"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Options"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
brush = toolsettings.brush
|
||||
|
||||
layout.prop(brush, "image_tool", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
|
||||
row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
|
||||
row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
|
||||
row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT')
|
||||
|
||||
|
||||
class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
|
||||
bl_label = "Paint Stroke"
|
||||
bl_label = "Stroke"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Tools"
|
||||
|
||||
@ -1052,7 +1021,8 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
|
||||
|
||||
|
||||
class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
|
||||
bl_label = "Paint Curve"
|
||||
bl_label = "Curve"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Tools"
|
||||
|
||||
@ -1076,7 +1046,7 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
|
||||
|
||||
class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel):
|
||||
bl_category = "Tools"
|
||||
bl_context = "imagepaint"
|
||||
bl_context = ".imagepaint_2d"
|
||||
bl_label = "Tiling"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@ -1094,8 +1064,10 @@ class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel):
|
||||
|
||||
class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel):
|
||||
bl_label = "Appearance"
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Options"
|
||||
bl_parent_id = "IMAGE_PT_tools_brush_overlay"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -1122,26 +1094,6 @@ class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel):
|
||||
sub.prop(brush, "icon_filepath", text="")
|
||||
|
||||
|
||||
class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel):
|
||||
bl_label = "Image Paint"
|
||||
bl_category = "Options"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
toolsettings = context.tool_settings
|
||||
# brush = toolsettings.image_paint.brush
|
||||
ups = toolsettings.unified_paint_settings
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Unified Settings:")
|
||||
|
||||
row = col.row()
|
||||
row.prop(ups, "use_unified_size", text="Size")
|
||||
row.prop(ups, "use_unified_strength", text="Strength")
|
||||
col.prop(ups, "use_unified_color", text="Color")
|
||||
|
||||
|
||||
class IMAGE_PT_uv_sculpt_curve(Panel):
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@ -1382,12 +1334,10 @@ classes = (
|
||||
IMAGE_PT_tools_brush_overlay,
|
||||
IMAGE_PT_tools_brush_texture,
|
||||
IMAGE_PT_tools_mask_texture,
|
||||
IMAGE_PT_tools_brush_tool,
|
||||
IMAGE_PT_paint_stroke,
|
||||
IMAGE_PT_paint_curve,
|
||||
IMAGE_PT_tools_imagepaint_symmetry,
|
||||
IMAGE_PT_tools_brush_appearance,
|
||||
IMAGE_PT_tools_paint_options,
|
||||
IMAGE_PT_uv_sculpt,
|
||||
IMAGE_PT_uv_sculpt_curve,
|
||||
IMAGE_PT_view_scopes,
|
||||
|
@ -532,6 +532,14 @@ class ToolSelectPanelHelper:
|
||||
def draw(self, context):
|
||||
self.draw_cls(self.layout, context)
|
||||
|
||||
@staticmethod
|
||||
def tool_active_from_context(context):
|
||||
# BAD DESIGN WARNING: last used tool
|
||||
workspace = context.workspace
|
||||
space_type = workspace.tools_space_type
|
||||
mode = workspace.tools_mode
|
||||
return ToolSelectPanelHelper._tool_active_from_context(context, space_type, mode)
|
||||
|
||||
@staticmethod
|
||||
def draw_active_tool_header(
|
||||
context, layout,
|
||||
|
@ -146,7 +146,10 @@ class TOPBAR_HT_lower_bar(Header):
|
||||
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 context.uv_sculpt_object is not None:
|
||||
if tool_mode == 'PAINT':
|
||||
if (tool is not None) and tool.has_datablock:
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common_2d", category="")
|
||||
elif context.uv_sculpt_object is not None:
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".uv_sculpt", category="")
|
||||
|
||||
def draw_center(self, context):
|
||||
@ -155,59 +158,66 @@ class TOPBAR_HT_lower_bar(Header):
|
||||
def draw_right(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# General options, note, these _could_ display at the RHS of the draw_left callback.
|
||||
# we just want them not to be confused with tool options.
|
||||
mode = context.mode
|
||||
# Active Tool
|
||||
# -----------
|
||||
from .space_toolsystem_common import ToolSelectPanelHelper
|
||||
tool = ToolSelectPanelHelper.tool_active_from_context(context)
|
||||
tool_space_type = 'VIEW_3D' if tool is None else tool.space_type
|
||||
tool_mode = context.mode if tool is None else tool.mode
|
||||
|
||||
if mode == 'SCULPT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".sculpt_mode", category="")
|
||||
elif mode == 'PAINT_VERTEX':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".vertexpaint", category="")
|
||||
elif mode == 'PAINT_WEIGHT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".weightpaint", category="")
|
||||
elif mode == 'PAINT_TEXTURE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint", category="")
|
||||
elif mode == 'EDIT_TEXT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".text_edit", category="")
|
||||
elif mode == 'EDIT_ARMATURE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".armature_edit", category="")
|
||||
elif mode == 'EDIT_METABALL':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mball_edit", category="")
|
||||
elif mode == 'EDIT_LATTICE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".lattice_edit", category="")
|
||||
elif mode == 'EDIT_CURVE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".curve_edit", category="")
|
||||
elif mode == 'EDIT_MESH':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mesh_edit", category="")
|
||||
elif mode == 'POSE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".posemode", category="")
|
||||
elif mode == 'PARTICLE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
|
||||
elif mode == 'OBJECT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="")
|
||||
elif mode in {'GPENCIL_PAINT', 'GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
|
||||
# Grease pencil layer.
|
||||
gpl = context.active_gpencil_layer
|
||||
if gpl and gpl.info is not None:
|
||||
text = gpl.info
|
||||
maxw = 25
|
||||
if len(text) > maxw:
|
||||
text = text[:maxw - 5] + '..' + text[-3:]
|
||||
else:
|
||||
text = ""
|
||||
if tool_space_type == 'VIEW_3D':
|
||||
if tool_mode == 'SCULPT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".sculpt_mode", category="")
|
||||
elif tool_mode == 'PAINT_VERTEX':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".vertexpaint", category="")
|
||||
elif tool_mode == 'PAINT_WEIGHT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".weightpaint", category="")
|
||||
elif tool_mode == 'PAINT_TEXTURE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint", category="")
|
||||
elif tool_mode == 'EDIT_TEXT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".text_edit", category="")
|
||||
elif tool_mode == 'EDIT_ARMATURE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".armature_edit", category="")
|
||||
elif tool_mode == 'EDIT_METABALL':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mball_edit", category="")
|
||||
elif tool_mode == 'EDIT_LATTICE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".lattice_edit", category="")
|
||||
elif tool_mode == 'EDIT_CURVE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".curve_edit", category="")
|
||||
elif tool_mode == 'EDIT_MESH':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mesh_edit", category="")
|
||||
elif tool_mode == 'POSE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".posemode", category="")
|
||||
elif tool_mode == 'PARTICLE':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
|
||||
elif tool_mode == 'OBJECT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="")
|
||||
elif tool_mode in {'GPENCIL_PAINT', 'GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
|
||||
# Grease pencil layer.
|
||||
gpl = context.active_gpencil_layer
|
||||
if gpl and gpl.info is not None:
|
||||
text = gpl.info
|
||||
maxw = 25
|
||||
if len(text) > maxw:
|
||||
text = text[:maxw - 5] + '..' + text[-3:]
|
||||
else:
|
||||
text = ""
|
||||
|
||||
layout.label(text="Layer:")
|
||||
sub = layout.row()
|
||||
sub.ui_units_x = 8
|
||||
sub.popover(
|
||||
panel="TOPBAR_PT_gpencil_layers",
|
||||
text=text,
|
||||
)
|
||||
if mode == 'GPENCIL_PAINT':
|
||||
tool_settings = context.tool_settings
|
||||
layout.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='XRAY')
|
||||
layout.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
|
||||
layout.prop(tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
|
||||
layout.label(text="Layer:")
|
||||
sub = layout.row()
|
||||
sub.ui_units_x = 8
|
||||
sub.popover(
|
||||
panel="TOPBAR_PT_gpencil_layers",
|
||||
text=text,
|
||||
)
|
||||
if tool_mode == 'GPENCIL_PAINT':
|
||||
tool_settings = context.tool_settings
|
||||
layout.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='XRAY')
|
||||
layout.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
|
||||
layout.prop(tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
|
||||
elif tool_space_type == 'IMAGE_EDITOR':
|
||||
if tool_mode == 'PAINT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint_2d", category="")
|
||||
|
||||
|
||||
class _draw_left_context_mode:
|
||||
@ -314,6 +324,19 @@ class _draw_left_context_mode:
|
||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
|
||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
||||
|
||||
def PAINT(context, layout, tool):
|
||||
if (tool is None) or (not tool.has_datablock):
|
||||
return
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
if brush is None:
|
||||
return
|
||||
|
||||
from .properties_paint_common import UnifiedPaintPanel
|
||||
|
||||
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
|
||||
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius")
|
||||
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")
|
||||
|
||||
|
||||
class TOPBAR_PT_gpencil_layers(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
|
@ -260,9 +260,19 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
|
||||
}
|
||||
}
|
||||
else if (workspace->tools_space_type == SPACE_IMAGE) {
|
||||
switch (mode) {
|
||||
case CTX_MODE_EDIT_MESH:
|
||||
ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
|
||||
switch (workspace->tools_mode) {
|
||||
case SI_MODE_VIEW:
|
||||
break;
|
||||
case SI_MODE_PAINT:
|
||||
ARRAY_SET_ITEMS(contexts, ".paint_common_2d", ".imagepaint_2d");
|
||||
break;
|
||||
case SI_MODE_MASK:
|
||||
break;
|
||||
case SI_MODE_UV:
|
||||
if (mode == CTX_MODE_EDIT_MESH) {
|
||||
ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user