UI: Brush Settings overhaul

This makes a number of changes to the tool settings brush UI:

  - All brush-related controls are now grouped together, so you can see which items are brush settings are which are not. Previously it was all jumbled together.
  - The brush picker is in a separate panel, so that you can switch brushes without worrying about the settings, or vice versa.
  - Custom Icon settings moved from the Display settings(now known as Cursor) to the Brushes panel.
  - UnifiedPaintSettings panels are removed and the contained options are now next to their relevant setting with a globe icon toggle. This is not displayed in the header.
  - 2D Falloff and Absolute Jitter toggles were changed into enums, to make it clearer what happens when they are on or off.
  - Adjust Strength for Spacing option was in the Options panel in some modes, but in the Stroke panel in others. It is now always under Stroke.
  - Display (now Cursor) panel was reorganized, settings renamed.
  - 2-option enums are annoying as a drop-down menu, so they are now drawn with expand=True.
  - Smooth Stroke and Stabilizer options in grease pencil and other paint modes are now both called "Stabilize Stroke", for consistency and clarity.
  - De-duplicated some drawing code between various painting modes' brush options. I tried to keep de-duplication reasonable and easy to follow.
  - A few more tweaks - see D5928 for the extensive list.

Most of the patch is written by Demeter Dzadik, with some additions by myself

Differential Revision: https://developer.blender.org/D5928
Reviewers: Pablo Dobarro, Bastien Montagne, Matias Mendiola
This commit is contained in:
William Reynish 2019-12-14 18:48:18 +01:00
parent 16206b66a2
commit fb74dcc5d6
Notes: blender-bot 2023-02-14 10:09:24 +01:00
Referenced by commit 9cd9b35779, Fix T87816: Sculpt curve & line stroke hides dash settings
Referenced by commit aede740c8a, Fix T87816: Sculpt curve & line stroke hides dash settings
Referenced by commit f38c54d56e, Fix Vertex weight gradient tool show wrong weight/strength values in the
Referenced by commit eb98cbb8c5, Fix: Missing category in IMAGE_PT_paint_settings_advanced panel
Referenced by issue #72786, Sculpt Mode RMB menu appears at shifted hotspot under pointer
9 changed files with 1367 additions and 1603 deletions

View File

@ -131,122 +131,6 @@ class AnnotationDrawingToolsPanel:
gpencil_stroke_placement_settings(context, col)
class GreasePencilStrokeEditPanel:
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
bl_label = "Edit Strokes"
bl_category = "Tools"
bl_region_type = 'TOOLS'
@classmethod
def poll(cls, context):
if context.gpencil_data is None:
return False
gpd = context.gpencil_data
return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode)
def draw(self, context):
layout = self.layout
is_3d_view = context.space_data.type == 'VIEW_3D'
if not is_3d_view:
layout.label(text="Select:")
col = layout.column(align=True)
col.operator("gpencil.select_all", text="Select All")
col.operator("gpencil.select_box")
col.operator("gpencil.select_circle")
layout.separator()
col = layout.column(align=True)
col.operator("gpencil.select_linked")
col.operator("gpencil.select_more")
col.operator("gpencil.select_less")
col.operator("gpencil.select_alternate")
layout.label(text="Edit:")
row = layout.row(align=True)
row.operator("gpencil.copy", text="Copy")
row.operator("gpencil.paste", text="Paste").type = 'ACTIVE'
row.operator("gpencil.paste", text="Paste by Layer").type = 'LAYER'
col = layout.column(align=True)
col.operator("gpencil.delete")
col.operator("gpencil.duplicate_move", text="Duplicate")
if is_3d_view:
col.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
col.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps...", property="type")
layout.separator()
if not is_3d_view:
col = layout.column(align=True)
col.operator("transform.translate") # icon='MAN_TRANS'
col.operator("transform.rotate") # icon='MAN_ROT'
col.operator("transform.resize", text="Scale") # icon='MAN_SCALE'
layout.separator()
layout.separator()
col = layout.column(align=True)
col.operator_menu_enum("gpencil.stroke_arrange", text="Arrange Strokes...", property="direction")
col.operator("gpencil.stroke_change_color", text="Assign Material")
layout.separator()
col = layout.column(align=True)
col.operator("gpencil.stroke_subdivide", text="Subdivide")
row = col.row(align=True)
row.operator("gpencil.stroke_simplify_fixed", text="Simplify")
row.operator("gpencil.stroke_simplify", text="Adaptive")
row.operator("gpencil.stroke_trim", text="Trim")
col.separator()
row = col.row(align=True)
row.operator("gpencil.stroke_merge", text="Merge")
row.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
row.operator("gpencil.stroke_join", text="& Copy").type = 'JOINCOPY'
col.operator("gpencil.stroke_flip", text="Flip Direction")
if is_3d_view:
layout.separator()
col = layout.column(align=True)
col.operator_menu_enum("gpencil.stroke_separate", text="Separate...", property="mode")
col.operator("gpencil.stroke_split", text="Split")
col = layout.column(align=True)
col.label(text="Cleanup:")
col.operator_menu_enum("gpencil.reproject", text="Reproject Strokes...", property="type")
col.operator_menu_enum("gpencil.frame_clean_fill", text="Clean Boundary Strokes...", property="mode")
class GreasePencilStrokeSculptPanel:
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
bl_label = "Sculpt Strokes"
bl_category = "Tools"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.tool_settings.gpencil_sculpt
brush = settings.brush
layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
if not self.is_popover:
from bl_ui.properties_paint_common import (
brush_basic_gpencil_sculpt_settings,
)
brush_basic_gpencil_sculpt_settings(layout, context, brush)
class GreasePencilSculptOptionsPanel:
bl_label = "Sculpt Strokes"
@ -276,16 +160,35 @@ class GreasePencilSculptOptionsPanel:
layout.prop(settings, "use_edit_uv", text="Affect UV")
# GP Object Tool Settings
class GreasePencilAppearancePanel:
bl_label = "Brush Appearance"
class GreasePencilDisplayPanel:
bl_label = "Brush Tip"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
ob = context.active_object
return ob and ob.type == 'GPENCIL'
brush = context.tool_settings.gpencil_paint.brush
if ob and ob.type == 'GPENCIL' and brush:
if context.mode == 'PAINT_GPENCIL':
return brush.gpencil_tool != 'ERASE'
else:
# GP Sculpt and Weight Paint always have Brush Tip panel.
return True
def draw_header(self, context):
if self.is_popover: return
if context.mode == 'PAINT_GPENCIL':
brush = context.tool_settings.gpencil_paint.brush
gp_settings = brush.gpencil_settings
self.layout.prop(gp_settings, "use_cursor", text="")
elif context.mode in ('SCULPT_GPENCIL', 'WEIGHT_GPENCIL'):
settings = context.tool_settings.gpencil_sculpt
brush = settings.brush
self.layout.prop(brush, "use_cursor", text="")
def draw(self, context):
layout = self.layout
@ -299,42 +202,44 @@ class GreasePencilAppearancePanel:
brush = tool_settings.gpencil_paint.brush
gp_settings = brush.gpencil_settings
sub = layout.column(align=True)
sub.enabled = not brush.use_custom_icon
sub.prop(gp_settings, "gp_icon", text="Icon")
if self.is_popover:
row = layout.row(align=True)
row.prop(gp_settings, "use_cursor", text="")
row.label(text="Display Cursor")
layout.prop(brush, "use_custom_icon")
sub = layout.column()
sub.active = brush.use_custom_icon
sub.prop(brush, "icon_filepath", text="")
layout.prop(gp_settings, "use_cursor", text="Show Brush")
col = layout.column(align=True)
col.active = gp_settings.use_cursor
if brush.gpencil_tool == 'DRAW':
layout.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
col.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
if brush.gpencil_tool == 'FILL':
layout.prop(brush, "cursor_color_add", text="Color")
col.prop(brush, "cursor_color_add", text="Cursor Color")
elif ob.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
settings = tool_settings.gpencil_sculpt
brush = settings.brush
tool = settings.sculpt_tool
if self.is_popover:
row = layout.row(align=True)
row.prop(brush, "use_cursor", text="")
row.label(text="Display Cursor")
col = layout.column(align=True)
col.prop(brush, "use_cursor", text="Show Brush")
col.active = brush.use_cursor
if tool in {'THICKNESS', 'STRENGTH'}:
col.prop(brush, "cursor_color_add", text="Add")
col.prop(brush, "cursor_color_sub", text="Subtract")
col.prop(brush, "cursor_color_add", text="Add Cursor Color")
col.prop(brush, "cursor_color_sub", text="Subtract Cursor Color")
elif tool == 'PINCH':
col.prop(brush, "cursor_color_add", text="Pinch")
col.prop(brush, "cursor_color_sub", text="Inflate")
col.prop(brush, "cursor_color_add", text="Pinch Cursor Color")
col.prop(brush, "cursor_color_sub", text="Inflate Cursor Color")
elif tool == 'TWIST':
col.prop(brush, "cursor_color_add", text="CCW")
col.prop(brush, "cursor_color_sub", text="CW")
col.prop(brush, "cursor_color_add", text="CCW Cursor Color")
col.prop(brush, "cursor_color_sub", text="CW Cursor Color")
else:
col.prop(brush, "cursor_color_add", text="")
col.prop(brush, "cursor_color_add", text="Cursor Color")
class GPENCIL_MT_pie_tool_palette(Menu):

File diff suppressed because it is too large Load Diff

View File

@ -27,12 +27,18 @@ from bpy.types import (
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_texpaint_common_color,
brush_texpaint_common_gradient,
brush_texpaint_common_clone,
brush_texpaint_common_options,
brush_mask_texture_settings,
brush_basic_texpaint_settings,
brush_settings,
brush_settings_advanced,
draw_color_settings,
ClonePanel,
BrushSelectPanel,
TextureMaskPanel,
ColorPalettePanel,
StrokePanel,
SmoothStrokePanel,
FalloffPanel,
DisplayPanel,
)
from bl_ui.properties_grease_pencil_common import (
AnnotationDataPanel,
@ -44,7 +50,7 @@ from bl_ui.space_toolsystem_common import (
from bpy.app.translations import pgettext_iface as iface_
class ImagePaintPanel(UnifiedPaintPanel):
class ImagePaintPanel:
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@ -59,7 +65,7 @@ class BrushButtonsPanel(UnifiedPaintPanel):
return tool_settings.brush
class IMAGE_PT_active_tool(ToolActivePanelHelper, Panel):
class IMAGE_PT_active_tool(Panel, ToolActivePanelHelper):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
bl_category = "Tool"
@ -181,25 +187,6 @@ class IMAGE_MT_select(Menu):
layout.operator("uv.select_overlap")
class IMAGE_MT_brush(Menu):
bl_label = "Brush"
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
settings = tool_settings.image_paint
brush = settings.brush
ups = context.tool_settings.unified_paint_settings
layout.prop(ups, "use_unified_size", text="Unified Size")
layout.prop(ups, "use_unified_strength", text="Unified Strength")
layout.prop(ups, "use_unified_color", text="Unified Color")
layout.separator()
# Brush tool.
layout.prop_menu_enum(brush, "image_tool")
class IMAGE_MT_image(Menu):
bl_label = "Image"
@ -569,15 +556,16 @@ class IMAGE_HT_tool_header(Header):
if tool_mode == 'PAINT':
if (tool is not None) and tool.has_datablock:
layout.popover_group(
space_type='IMAGE_EDITOR',
region_type='UI',
context=".paint_common_2d",
category="",
)
layout.popover("IMAGE_PT_paint_settings_advanced")
layout.popover("IMAGE_PT_paint_stroke")
layout.popover("IMAGE_PT_paint_curve")
layout.popover("IMAGE_PT_tools_brush_display")
layout.popover("IMAGE_PT_tools_brush_texture")
layout.popover("IMAGE_PT_tools_mask_texture")
elif tool_mode == 'UV':
if (tool is not None) and tool.has_datablock:
layout.popover_group(space_type='IMAGE_EDITOR', region_type='UI', context=".uv_sculpt", category="")
layout.popover("IMAGE_PT_uv_sculpt_curve")
layout.popover("IMAGE_PT_uv_sculpt_options")
def draw_mode_settings(self, context):
layout = self.layout
@ -601,15 +589,9 @@ class _draw_tool_settings_context_mode:
uv_sculpt = tool_settings.uv_sculpt
brush = uv_sculpt.brush
if brush:
from bl_ui.properties_paint_common import UnifiedPaintPanel
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
row.prop(brush, "use_pressure_size", text="")
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength", slider=True)
@staticmethod
def PAINT(context, layout, tool):
@ -623,13 +605,6 @@ class _draw_tool_settings_context_mode:
if brush is None:
return
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
capabilities = brush.image_paint_capabilities
if capabilities.has_color:
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_texpaint_settings(layout, context, brush, compact=True)
@ -771,8 +746,6 @@ class MASK_MT_editor_menus(Menu):
layout.menu("IMAGE_MT_select")
if show_maskedit:
layout.menu("MASK_MT_select")
if show_paint:
layout.menu("IMAGE_MT_brush")
if ima and ima.is_dirty:
layout.menu("IMAGE_MT_image", text="Image*")
@ -1101,11 +1074,16 @@ class IMAGE_PT_udim_tiles(Panel):
col.operator("image.tile_fill")
class IMAGE_PT_paint(Panel, ImagePaintPanel):
bl_label = "Brush"
class IMAGE_PT_paint_select(Panel, ImagePaintPanel, BrushSelectPanel):
bl_label = "Brushes"
bl_context = ".paint_common_2d"
bl_category = "Tool"
class IMAGE_PT_paint_settings(Panel, ImagePaintPanel):
bl_context = ".paint_common_2d"
bl_category = "Tool"
bl_label = "Brush Settings"
def draw(self, context):
layout = self.layout
@ -1115,17 +1093,31 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
settings = context.tool_settings.image_paint
brush = settings.brush
col = layout.column()
col.template_ID_preview(settings, "brush", new="brush.add", rows=2, cols=6)
if brush:
brush_texpaint_common(self, context, layout, brush, settings)
brush_settings(layout.column(), context, brush, popover=self.is_popover)
class IMAGE_PT_paint_settings_advanced(Panel, ImagePaintPanel):
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_label = "Advanced"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
settings = context.tool_settings.image_paint
brush = settings.brush
brush_settings_advanced(layout.column(), context, brush, self.is_popover)
class IMAGE_PT_paint_color(Panel, ImagePaintPanel):
bl_category = "Tool"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_label = "Color Picker"
@classmethod
@ -1141,210 +1133,36 @@ class IMAGE_PT_paint_color(Panel, ImagePaintPanel):
settings = context.tool_settings.image_paint
brush = settings.brush
layout.prop(brush, "color_type", expand=True)
if brush.color_type == 'COLOR':
brush_texpaint_common_color(self, context, layout, brush, settings)
elif brush.color_type == 'GRADIENT':
brush_texpaint_common_gradient(self, context, layout, brush, settings)
draw_color_settings(context, layout, brush, color_type=True)
class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel):
class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel, ColorPalettePanel):
bl_category = "Tool"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_label = "Color Palette"
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(self, context):
layout = self.layout
settings = context.tool_settings.image_paint
layout.template_ID(settings, "palette", new="palette.new")
if settings.palette:
layout.template_palette(settings, "palette", color=True)
class IMAGE_PT_paint_clone(Panel, ImagePaintPanel):
class IMAGE_PT_paint_clone(Panel, ImagePaintPanel, ClonePanel):
bl_category = "Tool"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_label = "Clone from Image/UV Map"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
settings = context.tool_settings.image_paint
brush = settings.brush
return brush.image_tool == 'CLONE'
def draw_header(self, context):
settings = context.tool_settings.image_paint
self.layout.prop(settings, "use_clone_layer", text="")
def draw(self, context):
layout = self.layout
settings = context.tool_settings.image_paint
brush = settings.brush
layout.active = settings.use_clone_layer
brush_texpaint_common_clone(self, context, layout, brush, settings)
class IMAGE_PT_paint_options(Panel, ImagePaintPanel):
bl_category = "Tool"
class IMAGE_PT_tools_brush_display(Panel, BrushButtonsPanel, DisplayPanel):
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint"
bl_label = "Options"
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(self, context):
layout = self.layout
settings = context.tool_settings.image_paint
brush = settings.brush
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
brush_texpaint_common_options(self, context, layout, brush, settings)
class IMAGE_PT_tools_brush_display(BrushButtonsPanel, Panel):
bl_label = "Display"
bl_context = ".paint_common_2d"
bl_options = {'DEFAULT_CLOSED'}
bl_category = "Tool"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
tool_settings = context.tool_settings.image_paint
brush = tool_settings.brush
tex_slot = brush.texture_slot
tex_slot_mask = brush.mask_texture_slot
col = layout.column()
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(brush, "cursor_overlay_alpha", text="Curve Alpha")
sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
row.prop(
brush, "use_cursor_overlay", text="", toggle=True,
icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON',
)
col.active = brush.brush_capabilities.has_overlay
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(brush, "texture_overlay_alpha", text="Texture Alpha")
sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
if tex_slot.map_mode != 'STENCIL':
row.prop(
brush, "use_primary_overlay", text="", toggle=True,
icon='HIDE_OFF' if brush.use_primary_overlay else 'HIDE_ON',
)
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(brush, "mask_overlay_alpha", text="Mask Texture Alpha")
sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
if tex_slot_mask.map_mode != 'STENCIL':
row.prop(
brush, "use_secondary_overlay", text="", toggle=True,
icon='HIDE_OFF' if brush.use_secondary_overlay else 'HIDE_ON',
)
class IMAGE_PT_tools_brush_display_show_brush(BrushButtonsPanel, Panel):
bl_context = ".paint_common_2d" # dot on purpose (access from topbar)
bl_label = "Show Brush"
bl_parent_id = "IMAGE_PT_tools_brush_display"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_label = "Brush Tip"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
settings = context.tool_settings.image_paint
self.layout.prop(settings, "show_brush", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.tool_settings.image_paint
brush = settings.brush
col = layout.column()
col.active = settings.show_brush
if context.sculpt_object and context.tool_settings.sculpt:
if brush.sculpt_capabilities.has_secondary_color:
col.prop(brush, "cursor_color_add", text="Add")
col.prop(brush, "cursor_color_subtract", text="Subtract")
else:
col.prop(brush, "cursor_color_add", text="Color")
else:
col.prop(brush, "cursor_color_add", text="Color")
class IMAGE_PT_tools_brush_display_custom_icon(BrushButtonsPanel, Panel):
bl_context = ".paint_common_2d" # dot on purpose (access from topbar)
bl_label = "Custom Icon"
bl_parent_id = "IMAGE_PT_tools_brush_display"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
settings = context.tool_settings.image_paint
brush = settings.brush
self.layout.prop(brush, "use_custom_icon", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.tool_settings.image_paint
brush = settings.brush
col = layout.column()
col.active = brush.use_custom_icon
col.prop(brush, "icon_filepath", text="")
class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
bl_label = "Texture"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
@ -1360,135 +1178,36 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
brush_texture_settings(col, brush, 0)
class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
bl_label = "Texture Mask"
class IMAGE_PT_tools_mask_texture(Panel, BrushButtonsPanel, TextureMaskPanel):
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
brush = context.tool_settings.image_paint.brush
col = layout.column()
col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
brush_mask_texture_settings(col, brush)
bl_label = "Texture Mask"
class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel, StrokePanel):
bl_label = "Stroke"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings.image_paint
brush = tool_settings.brush
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
col.prop(brush, "stroke_method")
if brush.use_anchor:
col.prop(brush, "use_edge_to_edge", text="Edge To Edge")
if brush.use_airbrush:
col.prop(brush, "rate", text="Rate", slider=True)
if brush.use_space:
row = col.row(align=True)
row.prop(brush, "spacing", text="Spacing")
row.prop(brush, "use_pressure_spacing", toggle=True, text="")
if brush.use_line or brush.use_curve:
row = col.row(align=True)
row.prop(brush, "spacing", text="Spacing")
if brush.use_curve:
col.template_ID(brush, "paint_curve", new="paintcurve.new")
col.operator("paintcurve.draw")
row = col.row(align=True)
if brush.use_relative_jitter:
row.prop(brush, "jitter", slider=True)
else:
row.prop(brush, "jitter_absolute")
row.prop(brush, "use_relative_jitter", icon_only=True)
row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(tool_settings, "input_samples")
class IMAGE_PT_paint_stroke_smooth_stroke(BrushButtonsPanel, Panel):
bl_context = ".paint_common_2d" # dot on purpose (access from topbar)
bl_label = "Smooth Stroke"
class IMAGE_PT_paint_stroke_smooth_stroke(Panel, BrushButtonsPanel, SmoothStrokePanel):
bl_context = ".paint_common_2d"
bl_label = "Stabilize Stroke"
bl_parent_id = "IMAGE_PT_paint_stroke"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
settings = context.tool_settings.image_paint
brush = settings.brush
if brush.brush_capabilities.has_smooth_stroke:
return True
def draw_header(self, context):
settings = context.tool_settings.image_paint
brush = settings.brush
self.layout.prop(brush, "use_smooth_stroke", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.tool_settings.image_paint
brush = settings.brush
col = layout.column()
col.active = brush.use_smooth_stroke
col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel, FalloffPanel):
bl_label = "Falloff"
bl_context = ".paint_common_2d"
bl_parent_id = "IMAGE_PT_paint_settings"
bl_category = "Tool"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings.image_paint
brush = tool_settings.brush
col = layout.column(align=True)
row = col.row(align=True)
row.prop(brush, "curve_preset", text="")
if brush.curve_preset == 'CUSTOM':
layout.template_curve_mapping(brush, "curve")
col = layout.column(align=True)
row = col.row(align=True)
row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel):
bl_context = ".imagepaint_2d"
@ -1507,91 +1226,61 @@ class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel):
row.prop(ipaint, "tile_x", text="X", toggle=True)
row.prop(ipaint, "tile_y", text="Y", toggle=True)
class IMAGE_PT_uv_sculpt_brush(Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
bl_category = "Tool"
bl_label = "Brush"
class UVSculptPanel(UnifiedPaintPanel):
@classmethod
def poll(cls, context):
sima = context.space_data
# TODO(campbell): nicer way to check if we're in uv sculpt mode.
if sima and sima.show_uvedit:
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
tool = ToolSelectPanelHelper.tool_active_from_context(context)
if tool.has_datablock:
return True
return False
return cls.get_brush_mode(context) == 'UV_SCULPT'
class IMAGE_PT_uv_sculpt_brush_select(Panel, BrushSelectPanel, ImagePaintPanel, UVSculptPanel):
bl_context = ".uv_sculpt"
bl_category = "Tool"
bl_label = "Brushes"
class IMAGE_PT_uv_sculpt_brush_settings(Panel, ImagePaintPanel, UVSculptPanel):
bl_context = ".uv_sculpt"
bl_category = "Tool"
bl_label = "Brush Settings"
def draw(self, context):
from bl_ui.properties_paint_common import UnifiedPaintPanel
layout = self.layout
tool_settings = context.tool_settings
uvsculpt = tool_settings.uv_sculpt
layout.template_ID(uvsculpt, "brush")
brush = uvsculpt.brush
if not self.is_popover:
if brush:
col = layout.column()
row = col.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
row = col.row(align=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True)
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
col = layout.column()
col.prop(tool_settings, "uv_sculpt_lock_borders")
col.prop(tool_settings, "uv_sculpt_all_islands")
brush_settings(layout.column(), context, brush)
if brush:
if brush.uv_sculpt_tool == 'RELAX':
col.prop(tool_settings, "uv_relax_method")
col.prop(uvsculpt, "show_brush")
# Although this settings is stored in the scene, it is only used by a single tool, so it doesn't make sense from a user perspective to move it to the Options panel.
layout.prop(tool_settings, "uv_relax_method")
class IMAGE_PT_uv_sculpt_curve(Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
class IMAGE_PT_uv_sculpt_curve(Panel, FalloffPanel, ImagePaintPanel, UVSculptPanel):
bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
bl_parent_id = "IMAGE_PT_uv_sculpt_brush_settings"
bl_category = "Tool"
bl_label = "Falloff"
bl_options = {'DEFAULT_CLOSED'}
poll = IMAGE_PT_uv_sculpt_brush.poll
class IMAGE_PT_uv_sculpt_options(Panel, ImagePaintPanel, UVSculptPanel):
bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
bl_category = "Tool"
bl_label = "Options"
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
uvsculpt = tool_settings.uv_sculpt
brush = uvsculpt.brush
if brush is not None:
col = layout.column(align=True)
row = col.row(align=True)
row.prop(brush, "curve_preset", text="")
if brush.curve_preset == 'CUSTOM':
layout.template_curve_mapping(brush, "curve")
row = layout.row(align=True)
row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
col = layout.column()
col.prop(tool_settings, "uv_sculpt_lock_borders")
col.prop(tool_settings, "uv_sculpt_all_islands")
col.prop(uvsculpt, "show_brush", text="Display Cursor")
class ImageScopesPanel:
@ -1765,7 +1454,6 @@ classes = (
IMAGE_MT_view,
IMAGE_MT_view_zoom,
IMAGE_MT_select,
IMAGE_MT_brush,
IMAGE_MT_image,
IMAGE_MT_image_invert,
IMAGE_MT_uvs,
@ -1797,21 +1485,22 @@ classes = (
IMAGE_PT_view_display,
IMAGE_PT_view_display_uv_edit_overlays,
IMAGE_PT_view_display_uv_edit_overlays_stretch,
IMAGE_PT_paint,
IMAGE_PT_paint_select,
IMAGE_PT_paint_settings,
IMAGE_PT_paint_color,
IMAGE_PT_paint_swatches,
IMAGE_PT_paint_settings_advanced,
IMAGE_PT_paint_clone,
IMAGE_PT_paint_options,
IMAGE_PT_tools_brush_texture,
IMAGE_PT_tools_mask_texture,
IMAGE_PT_paint_stroke,
IMAGE_PT_paint_stroke_smooth_stroke,
IMAGE_PT_paint_curve,
IMAGE_PT_tools_brush_display,
IMAGE_PT_tools_brush_display_show_brush,
IMAGE_PT_tools_brush_display_custom_icon,
IMAGE_PT_tools_imagepaint_symmetry,
IMAGE_PT_uv_sculpt_brush,
IMAGE_PT_uv_sculpt_brush_select,
IMAGE_PT_uv_sculpt_brush_settings,
IMAGE_PT_uv_sculpt_options,
IMAGE_PT_uv_sculpt_curve,
IMAGE_PT_view_histogram,
IMAGE_PT_view_waveform,

View File

@ -378,7 +378,7 @@ class ToolSelectPanelHelper:
@staticmethod
def _tool_active_from_context(context, space_type, mode=None, create=False):
if space_type == 'VIEW_3D':
if space_type in ('VIEW_3D', 'PROPERTIES'):
if mode is None:
mode = context.mode
tool = context.workspace.tools.from_space_view3d_mode(mode, create=create)

View File

@ -1135,11 +1135,10 @@ class _defs_weight_paint:
def draw_settings(context, layout, tool):
brush = context.tool_settings.weight_paint.brush
if brush is not None:
from bl_ui.properties_paint_common import UnifiedPaintPanel
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True)
layout.prop(brush, "weight", slider=True)
layout.prop(brush, "strength", slider=True)
props = tool.operator_properties("paint.weight_gradient")
layout.prop(props, "type")
layout.prop(props, "type", expand=True)
return dict(
idname="builtin.gradient",

View File

@ -20,6 +20,7 @@
import bpy
from bpy.types import Header, Menu, Panel
class TOPBAR_HT_upper_bar(Header):
bl_space_type = 'TOPBAR'
@ -67,7 +68,8 @@ class TOPBAR_HT_upper_bar(Header):
layout.template_running_jobs()
# Active workspace view-layer is retrieved through window, not through workspace.
layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete")
layout.template_ID(window, "scene", new="scene.new",
unlink="scene.delete")
row = layout.row(align=True)
row.template_search(
@ -91,9 +93,11 @@ class TOPBAR_PT_tool_settings_extra(Panel):
layout = self.layout
# Get the active tool
space_type, mode = ToolSelectPanelHelper._tool_key_from_context(context)
space_type, mode = ToolSelectPanelHelper._tool_key_from_context(
context)
cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)
item, tool, _ = cls._tool_get_active(context, space_type, mode, with_icon=True)
item, tool, _ = cls._tool_get_active(
context, space_type, mode, with_icon=True)
if item is None:
return
@ -115,7 +119,8 @@ class TOPBAR_PT_tool_fallback(Panel):
ToolSelectPanelHelper.draw_fallback_tool_items(layout, context)
if tool_settings.workspace_tool_type == 'FALLBACK':
tool = context.tool
ToolSelectPanelHelper.draw_active_tool_fallback(context, layout, tool)
ToolSelectPanelHelper.draw_active_tool_fallback(
context, layout, tool)
class TOPBAR_PT_gpencil_layers(Panel):
@ -174,20 +179,25 @@ class TOPBAR_PT_gpencil_layers(Panel):
gpl = context.active_gpencil_layer
if gpl:
sub.menu("GPENCIL_MT_layer_context_menu", icon='DOWNARROW_HLT', text="")
sub.menu("GPENCIL_MT_layer_context_menu",
icon='DOWNARROW_HLT', text="")
if len(gpd.layers) > 1:
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
sub.operator("gpencil.layer_move",
icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move",
icon='TRIA_DOWN', text="").type = 'DOWN'
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.layer_isolate", icon='HIDE_OFF', text="").affect_visibility = True
sub.operator("gpencil.layer_isolate", icon='LOCKED', text="").affect_visibility = False
sub.operator("gpencil.layer_isolate", icon='HIDE_OFF',
text="").affect_visibility = True
sub.operator("gpencil.layer_isolate", icon='LOCKED',
text="").affect_visibility = False
class TOPBAR_MT_editor_menus(Menu):
@ -229,7 +239,8 @@ class TOPBAR_MT_app(Menu):
layout.separator()
layout.operator("preferences.app_template_install", text="Install Application Template...")
layout.operator("preferences.app_template_install",
text="Install Application Template...")
class TOPBAR_MT_file(Menu):
@ -325,7 +336,8 @@ class TOPBAR_MT_file_new(Menu):
# Draw application templates.
if not use_more:
props = layout.operator("wm.read_homefile", text="General", icon=icon)
props = layout.operator(
"wm.read_homefile", text="General", icon=icon)
props.app_template = ""
for d in paths:
@ -370,7 +382,8 @@ class TOPBAR_MT_file_defaults(Menu):
app_template = None
if app_template:
layout.label(text=bpy.path.display_name(app_template, has_ext=False))
layout.label(text=bpy.path.display_name(
app_template, has_ext=False))
layout.operator("wm.save_homefile")
props = layout.operator("wm.read_factory_settings")
@ -384,12 +397,15 @@ class TOPBAR_MT_app_about(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("wm.url_open_preset", text="Release Notes", icon='URL').type = 'RELEASE_NOTES'
layout.operator("wm.url_open_preset", text="Release Notes",
icon='URL').type = 'RELEASE_NOTES'
layout.separator()
layout.operator("wm.url_open_preset", text="Blender Website", icon='URL').type = 'BLENDER'
layout.operator("wm.url_open_preset", text="Credits", icon='URL').type = 'CREDITS'
layout.operator("wm.url_open_preset",
text="Blender Website", icon='URL').type = 'BLENDER'
layout.operator("wm.url_open_preset", text="Credits",
icon='URL').type = 'CREDITS'
layout.separator()
@ -404,7 +420,8 @@ class TOPBAR_MT_app_support(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("wm.url_open_preset", text="Development Fund", icon='FUND').type = 'FUND'
layout.operator("wm.url_open_preset",
text="Development Fund", icon='FUND').type = 'FUND'
layout.separator()
@ -417,7 +434,8 @@ class TOPBAR_MT_templates_more(Menu):
bl_label = "Templates"
def draw(self, context):
bpy.types.TOPBAR_MT_file_new.draw_ex(self.layout, context, use_more=True)
bpy.types.TOPBAR_MT_file_new.draw_ex(
self.layout, context, use_more=True)
class TOPBAR_MT_file_import(Menu):
@ -426,7 +444,8 @@ class TOPBAR_MT_file_import(Menu):
def draw(self, _context):
if bpy.app.build_options.collada:
self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
self.layout.operator("wm.collada_import",
text="Collada (Default) (.dae)")
if bpy.app.build_options.alembic:
self.layout.operator("wm.alembic_import", text="Alembic (.abc)")
@ -437,11 +456,13 @@ class TOPBAR_MT_file_export(Menu):
def draw(self, context):
if bpy.app.build_options.collada:
self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)")
self.layout.operator("wm.collada_export",
text="Collada (Default) (.dae)")
if bpy.app.build_options.alembic:
self.layout.operator("wm.alembic_export", text="Alembic (.abc)")
if bpy.app.build_options.usd and context.preferences.experimental.use_usd_exporter:
self.layout.operator("wm.usd_export", text="Universal Scene Description (.usd, .usdc, .usda)")
self.layout.operator(
"wm.usd_export", text="Universal Scene Description (.usd, .usdc, .usda)")
class TOPBAR_MT_file_external_data(Menu):
@ -494,8 +515,10 @@ class TOPBAR_MT_render(Menu):
rd = context.scene.render
layout.operator("render.render", text="Render Image", icon='RENDER_STILL').use_viewport = True
props = layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION')
layout.operator("render.render", text="Render Image",
icon='RENDER_STILL').use_viewport = True
props = layout.operator(
"render.render", text="Render Animation", icon='RENDER_ANIMATION')
props.animation = True
props.use_viewport = True
@ -537,7 +560,8 @@ class TOPBAR_MT_edit(Menu):
layout.separator()
layout.operator("wm.search_menu", text="Operator Search...", icon='VIEWZOOM')
layout.operator("wm.search_menu",
text="Operator Search...", icon='VIEWZOOM')
layout.separator()
@ -556,7 +580,8 @@ class TOPBAR_MT_edit(Menu):
layout.separator()
layout.operator("screen.userpref_show", text="Preferences...", icon='PREFERENCES')
layout.operator("screen.userpref_show",
text="Preferences...", icon='PREFERENCES')
class TOPBAR_MT_window(Menu):
@ -576,8 +601,10 @@ class TOPBAR_MT_window(Menu):
layout.separator()
layout.operator("screen.workspace_cycle", text="Next Workspace").direction = 'NEXT'
layout.operator("screen.workspace_cycle", text="Previous Workspace").direction = 'PREV'
layout.operator("screen.workspace_cycle",
text="Next Workspace").direction = 'NEXT'
layout.operator("screen.workspace_cycle",
text="Previous Workspace").direction = 'PREV'
layout.separator()
@ -604,7 +631,8 @@ class TOPBAR_MT_help(Menu):
show_developer = context.preferences.view.show_developer_ui
layout.operator("wm.url_open_preset", text="Manual", icon='HELP').type = 'MANUAL'
layout.operator("wm.url_open_preset", text="Manual",
icon='HELP').type = 'MANUAL'
layout.operator(
"wm.url_open", text="Tutorials", icon='URL',
@ -637,7 +665,8 @@ class TOPBAR_MT_help(Menu):
layout.separator()
layout.operator("wm.url_open_preset", text="Report a Bug", icon='URL').type = 'BUG'
layout.operator("wm.url_open_preset",
text="Report a Bug", icon='URL').type = 'BUG'
layout.separator()
@ -666,7 +695,8 @@ class TOPBAR_MT_file_context_menu(Menu):
layout.separator()
layout.operator("screen.userpref_show", text="Preferences...", icon='PREFERENCES')
layout.operator("screen.userpref_show",
text="Preferences...", icon='PREFERENCES')
class TOPBAR_MT_workspace_menu(Menu):
@ -675,21 +705,26 @@ class TOPBAR_MT_workspace_menu(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("workspace.duplicate", text="Duplicate", icon='DUPLICATE')
layout.operator("workspace.duplicate",
text="Duplicate", icon='DUPLICATE')
if len(bpy.data.workspaces) > 1:
layout.operator("workspace.delete", text="Delete", icon='REMOVE')
layout.separator()
layout.operator("workspace.reorder_to_front", text="Reorder to Front", icon='TRIA_LEFT_BAR')
layout.operator("workspace.reorder_to_back", text="Reorder to Back", icon='TRIA_RIGHT_BAR')
layout.operator("workspace.reorder_to_front",
text="Reorder to Front", icon='TRIA_LEFT_BAR')
layout.operator("workspace.reorder_to_back",
text="Reorder to Back", icon='TRIA_RIGHT_BAR')
layout.separator()
# For key binding discoverability.
props = layout.operator("screen.workspace_cycle", text="Previous Workspace")
props = layout.operator("screen.workspace_cycle",
text="Previous Workspace")
props.direction = 'PREV'
props = layout.operator("screen.workspace_cycle", text="Next Workspace")
props = layout.operator(
"screen.workspace_cycle", text="Next Workspace")
props.direction = 'NEXT'
@ -704,29 +739,8 @@ class TOPBAR_PT_gpencil_primitive(Panel):
layout = self.layout
# Curve
layout.template_curve_mapping(settings, "thickness_primitive_curve", brush=True)
# Grease Pencil Fill
class TOPBAR_PT_gpencil_fill(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Advanced"
def draw(self, context):
paint = context.tool_settings.gpencil_paint
brush = paint.brush
gp_settings = brush.gpencil_settings
layout = self.layout
# Fill
row = layout.row(align=True)
row.prop(gp_settings, "fill_factor", text="Resolution")
if gp_settings.fill_draw_mode != 'STROKE':
row = layout.row(align=True)
row.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes")
row = layout.row(align=True)
row.prop(gp_settings, "fill_threshold", text="Threshold")
layout.template_curve_mapping(
settings, "thickness_primitive_curve", brush=True)
# Only a popover
@ -818,7 +832,6 @@ classes = (
TOPBAR_PT_tool_settings_extra,
TOPBAR_PT_gpencil_layers,
TOPBAR_PT_gpencil_primitive,
TOPBAR_PT_gpencil_fill,
TOPBAR_PT_name,
)

View File

@ -25,6 +25,7 @@ from bpy.types import (
)
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
from bl_ui.properties_grease_pencil_common import (
AnnotationDataPanel,
@ -67,7 +68,6 @@ class VIEW3D_HT_tool_header(Header):
context, layout,
tool_key=('VIEW_3D', tool_mode),
)
# Object Mode Options
# -------------------
@ -79,21 +79,29 @@ class VIEW3D_HT_tool_header(Header):
if draw_fn is not None:
draw_fn(context, layout, tool)
popover_kw = {"space_type": 'VIEW_3D', "region_type": 'UI', "category": "Tool"}
def draw_3d_brush_settings(layout, tool_mode):
layout.popover("VIEW3D_PT_tools_brush_settings_advanced", text="Brush")
if tool_mode != 'PAINT_WEIGHT':
layout.popover("VIEW3D_PT_tools_brush_texture")
if tool_mode == 'PAINT_TEXTURE':
layout.popover("VIEW3D_PT_tools_mask_texture")
layout.popover("VIEW3D_PT_tools_brush_stroke")
layout.popover("VIEW3D_PT_tools_brush_falloff")
layout.popover("VIEW3D_PT_tools_brush_display")
# Note: general mode options should be added to 'draw_mode_settings'.
if tool_mode == 'SCULPT':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".paint_common", **popover_kw)
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_VERTEX':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".paint_common", **popover_kw)
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_WEIGHT':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".paint_common", **popover_kw)
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_TEXTURE':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".paint_common", **popover_kw)
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'EDIT_ARMATURE':
pass
elif tool_mode == 'EDIT_CURVE':
@ -109,11 +117,24 @@ class VIEW3D_HT_tool_header(Header):
pass
elif tool_mode == 'PAINT_GPENCIL':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".greasepencil_paint", **popover_kw)
brush = context.tool_settings.gpencil_paint.brush
if brush.gpencil_tool != 'ERASE':
layout.popover("VIEW3D_PT_tools_grease_pencil_brush_advanced")
if brush.gpencil_tool != 'FILL':
layout.popover("VIEW3D_PT_tools_grease_pencil_brush_stabilizer")
layout.popover("VIEW3D_PT_tools_grease_pencil_brush_random")
layout.popover("VIEW3D_PT_tools_grease_pencil_brushcurves")
layout.popover("VIEW3D_PT_tools_grease_pencil_paint_appearance")
elif tool_mode == 'SCULPT_GPENCIL':
layout.popover_group(context=".greasepencil_sculpt", **popover_kw)
settings = context.tool_settings.gpencil_sculpt
tool = settings.sculpt_tool
if tool in ('SMOOTH', 'RANDOMIZE', 'SMOOTH'):
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options")
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
elif tool_mode == 'WEIGHT_GPENCIL':
layout.popover_group(context=".greasepencil_weight", **popover_kw)
layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance")
def draw_mode_settings(self, context):
layout = self.layout
@ -230,10 +251,26 @@ class _draw_tool_settings_context_mode:
if brush is None:
return
from bl_ui.properties_paint_common import (
brush_basic_sculpt_settings,
)
brush_basic_sculpt_settings(layout, context, brush, compact=True)
tool_settings = context.tool_settings
capabilities = brush.sculpt_capabilities
ups = tool_settings.unified_paint_settings
size = "size"
size_owner = ups if ups.use_unified_size else brush
if size_owner.use_locked_size == 'SCENE':
size = "unprojected_radius"
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
UnifiedPaintPanel.prop_unified(layout, context, brush, size, pressure_name="use_pressure_size", text="Radius", slider=True)
# strength, use_strength_pressure
pressure_name = "use_pressure_strength" if capabilities.has_strength_pressure else None
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name=pressure_name, text="Strength")
# direction
if not capabilities.has_direction:
layout.row().prop(brush, "direction", expand=True, text="")
@staticmethod
def PAINT_TEXTURE(context, layout, tool):
@ -247,13 +284,6 @@ class _draw_tool_settings_context_mode:
if brush is None:
return
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
capabilities = brush.image_paint_capabilities
if capabilities.has_color:
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_texpaint_settings(layout, context, brush, compact=True)
@staticmethod
@ -268,14 +298,7 @@ class _draw_tool_settings_context_mode:
if brush is None:
return
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_basic_vpaint_settings,
)
capabilities = brush.vertex_paint_capabilities
if capabilities.has_color:
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_vpaint_settings(layout, context, brush, compact=True)
brush_basic_texpaint_settings(layout, context, brush, compact=True)
@staticmethod
def PAINT_WEIGHT(context, layout, tool):
@ -288,8 +311,13 @@ class _draw_tool_settings_context_mode:
if brush is None:
return
from bl_ui.properties_paint_common import brush_basic_wpaint_settings
brush_basic_wpaint_settings(layout, context, brush, compact=True)
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
capabilities = brush.weight_paint_capabilities
if capabilities.has_weight:
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength")
@staticmethod
def PAINT_GPENCIL(context, layout, tool):
@ -358,7 +386,7 @@ class _draw_tool_settings_context_mode:
from bl_ui.properties_paint_common import (
brush_basic_gpencil_paint_settings,
)
brush_basic_gpencil_paint_settings(layout, context, brush, tool, compact=True, is_toolbar=True)
brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
@staticmethod
def SCULPT_GPENCIL(context, layout, tool):
@ -467,12 +495,11 @@ class VIEW3D_HT_header(Header):
show_snap = True
else:
from bl_ui.properties_paint_common import UnifiedPaintPanel
paint_settings = UnifiedPaintPanel.paint_settings(context)
if paint_settings:
brush = paint_settings.brush
if brush and brush.stroke_method == 'CURVE':
if brush and hasattr(brush, "stroke_method") and brush.stroke_method == 'CURVE':
show_snap = True
if show_snap:
@ -6653,6 +6680,7 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel):
def draw(self, context):
layout = self.layout
brush = context.tool_settings.vertex_paint.brush
capabilities = brush.vertex_paint_capabilities
@ -6662,9 +6690,8 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel):
UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True)
layout.prop(brush, "blend", text="")
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
class VIEW3D_PT_paint_texture_context_menu(Panel):
# Only for popover, these are dummy values.
@ -6674,6 +6701,7 @@ class VIEW3D_PT_paint_texture_context_menu(Panel):
def draw(self, context):
layout = self.layout
brush = context.tool_settings.image_paint.brush
capabilities = brush.image_paint_capabilities
@ -6684,8 +6712,8 @@ class VIEW3D_PT_paint_texture_context_menu(Panel):
layout.prop(brush, "blend", text="")
if capabilities.has_radius:
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
class VIEW3D_PT_paint_weight_context_menu(Panel):
@ -6698,9 +6726,9 @@ class VIEW3D_PT_paint_weight_context_menu(Panel):
layout = self.layout
brush = context.tool_settings.weight_paint.brush
UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True)
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
class VIEW3D_PT_sculpt_context_menu(Panel):
@ -6715,8 +6743,8 @@ class VIEW3D_PT_sculpt_context_menu(Panel):
brush = context.tool_settings.sculpt.brush
capabilities = brush.sculpt_capabilities
UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True)
UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength")
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
if capabilities.has_auto_smooth:
layout.prop(brush, "auto_smooth_factor", slider=True)

File diff suppressed because it is too large Load Diff

View File

@ -1596,6 +1596,22 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_jitter_unit_items[] = {
{BRUSH_ABSOLUTE_JITTER, "VIEW", 0, "View", "Jitterring happens in screen space, in pixels"},
{0, "BRUSH", 0, "Brush", "Jitterring happens relative to the brush size"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem falloff_shape_unit_items[] = {
{0, "SPHERE", 0, "Sphere", "Apply brush influence in a Sphere, outwards from the center"},
{PAINT_FALLOFF_SHAPE_TUBE,
"PROJECTED",
0,
"Projected",
"Apply brush influence in a 2D circle, projected from the view"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_curve_preset_items[] = {
{BRUSH_CURVE_CUSTOM, "CUSTOM", ICON_RNDCURVE, "Custom", ""},
{BRUSH_CURVE_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
@ -1704,6 +1720,19 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "jitter_unit", PROP_ENUM, PROP_NONE); /* as an enum */
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, brush_jitter_unit_items);
RNA_def_property_ui_text(
prop, "Jitter Unit", "Jitter in screen space or relative to brush size");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "falloff_shape", PROP_ENUM, PROP_NONE); /* as an enum */
RNA_def_property_enum_bitflag_sdna(prop, NULL, "falloff_shape");
RNA_def_property_enum_items(prop, falloff_shape_unit_items);
RNA_def_property_ui_text(prop, "Falloff Shape", "Use projected or spherical falloff");
RNA_def_property_update(prop, 0, "rna_Brush_update");
/* number values */
prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
@ -1993,13 +2022,6 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Brush_update");
/* flag */
/* This is an enum but its unlikely we add other shapes, so expose as a boolean. */
prop = RNA_def_property(srna, "use_projected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "falloff_shape", PAINT_FALLOFF_SHAPE_TUBE);
RNA_def_property_ui_text(
prop, "2D Falloff", "Apply brush influence in 2D circle instead of a sphere");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
RNA_def_property_ui_text(
@ -2045,7 +2067,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_paint_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sampling_flag", BRUSH_PAINT_ANTIALIASING);
RNA_def_property_ui_text(prop, "Antialasing", "Smooths the edges of the strokes");
RNA_def_property_ui_text(prop, "Anti-Aliasing", "Smooths the edges of the strokes");
prop = RNA_def_property(srna, "use_multiplane_scrape_dynamic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_MULTIPLANE_SCRAPE_DYNAMIC);
@ -2117,13 +2139,6 @@ static void rna_def_brush(BlenderRNA *brna)
prop, "Inverse Smooth Pressure", "Lighter pressure causes more smoothing to be applied");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_relative_jitter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_ABSOLUTE_JITTER);
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
RNA_def_property_ui_text(
prop, "Absolute Jitter", "Jittering happens in screen space, not relative to brush size");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PLANE_TRIM);
RNA_def_property_ui_text(prop, "Use Plane Trim", "Enable Plane Trim");