Refactor: Paint: Rename brush _tool properties to _brush_type

This commit renames the python Brush properties that end with `_tool` to
`_brush_type` (e.g. `sculpt_tool` -> `sculpt_brush_type`) to better
distinguish the property from the concept of tools in a workspace
context.

Resolves #124201

Pull Request: https://projects.blender.org/blender/blender/pulls/139909
This commit is contained in:
Sean Kim
2025-06-06 23:40:13 +02:00
committed by Sean Kim
parent 69d2a43b7a
commit ab3c129dd9
7 changed files with 135 additions and 146 deletions

View File

@@ -53,7 +53,7 @@ class GreasePencilSculptAdvancedPanel:
tool_settings = context.scene.tool_settings
brush = tool_settings.gpencil_sculpt_paint.brush
tool = brush.gpencil_sculpt_tool
tool = brush.gpencil_sculpt_brush_type
gp_settings = brush.gpencil_settings
if tool in {'SMOOTH', 'RANDOMIZE'}:
@@ -130,7 +130,7 @@ class GreasePencilDisplayPanel:
row = layout.row(align=True)
row.prop(settings, "show_brush", text="Display Cursor")
if brush.gpencil_tool == 'DRAW':
if brush.gpencil_brush_type == 'DRAW':
row = layout.row(align=True)
row.active = settings.show_brush
row.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
@@ -140,7 +140,7 @@ class GreasePencilDisplayPanel:
col.active = settings.show_brush
col.prop(brush, "cursor_color_add", text="Cursor Color")
if brush.gpencil_sculpt_tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
if brush.gpencil_sculpt_brush_type in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
col.prop(brush, "cursor_color_subtract", text="Inverse Color")
elif ob.mode == 'WEIGHT_GREASE_PENCIL':

View File

@@ -16,7 +16,6 @@ class BrushAssetShelf:
bl_activate_operator = "BRUSH_OT_asset_activate"
bl_default_preview_size = 48
brush_type_prop = None
tool_prop = None
mode_prop = None
@classmethod
@@ -60,7 +59,7 @@ class BrushAssetShelf:
if not tool:
return True
if not cls.brush_type_prop or not cls.tool_prop:
if not cls.brush_type_prop:
return True
asset_brush_type = asset.metadata.get(cls.brush_type_prop)
@@ -74,7 +73,7 @@ class BrushAssetShelf:
if tool.brush_type == 'ANY':
return not cls.has_tool_with_brush_type(context, asset_brush_type)
brush_type_items = bpy.types.Brush.bl_rna.properties[cls.tool_prop].enum_items
brush_type_items = bpy.types.Brush.bl_rna.properties[cls.brush_type_prop].enum_items
return brush_type_items[tool.brush_type].value == asset_brush_type
@classmethod
@@ -399,7 +398,7 @@ class ClonePanel(BrushPanel):
mode = cls.get_brush_mode(context)
if mode == 'PAINT_TEXTURE':
brush = settings.brush
return brush.image_tool == 'CLONE'
return brush.image_brush_type == 'CLONE'
return False
def draw_header(self, context):
@@ -609,7 +608,7 @@ class FalloffPanel(BrushPanel):
return False
if cls.get_brush_mode(context) == 'SCULPT_CURVES':
brush = settings.brush
if brush.curves_sculpt_tool in {'ADD', 'DELETE'}:
if brush.curves_sculpt_brush_type in {'ADD', 'DELETE'}:
return False
return True
@@ -642,7 +641,7 @@ class FalloffPanel(BrushPanel):
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
show_fallof_shape = False
if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT'} and brush.sculpt_tool != 'POSE':
if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT'} and brush.sculpt_brush_type != 'POSE':
show_fallof_shape = True
if not show_fallof_shape and mode == 'SCULPT_CURVES' and context.space_data.type == 'PROPERTIES':
show_fallof_shape = True
@@ -748,7 +747,7 @@ def brush_settings(layout, context, brush, popover=False):
# Sculpt Mode #
if mode == 'SCULPT':
capabilities = brush.sculpt_capabilities
sculpt_tool = brush.sculpt_tool
sculpt_brush_type = brush.sculpt_brush_type
# normal_radius_factor
layout.prop(brush, "normal_radius_factor", slider=True)
@@ -786,7 +785,7 @@ def brush_settings(layout, context, brush, popover=False):
# crease_pinch_factor
if capabilities.has_pinch_factor:
text = iface_("Pinch")
if sculpt_tool in {'BLOB', 'SNAKE_HOOK'}:
if sculpt_brush_type in {'BLOB', 'SNAKE_HOOK'}:
text = iface_("Magnify")
layout.prop(brush, "crease_pinch_factor", slider=True, text=text, translate=False)
@@ -806,7 +805,7 @@ def brush_settings(layout, context, brush, popover=False):
slider=True,
)
if sculpt_tool != 'PLANE':
if sculpt_brush_type != 'PLANE':
row = layout.row(heading="Plane Trim")
row.prop(brush, "use_plane_trim", text="")
sub = row.row()
@@ -844,25 +843,25 @@ def brush_settings(layout, context, brush, popover=False):
# Per sculpt tool options.
if sculpt_tool == 'CLAY_STRIPS':
if sculpt_brush_type == 'CLAY_STRIPS':
row = layout.row()
row.prop(brush, "tip_roundness")
row = layout.row()
row.prop(brush, "tip_scale_x")
elif sculpt_tool == 'ELASTIC_DEFORM':
elif sculpt_brush_type == 'ELASTIC_DEFORM':
layout.separator()
layout.prop(brush, "elastic_deform_type")
layout.prop(brush, "elastic_deform_volume_preservation", slider=True)
layout.separator()
elif sculpt_tool == 'SNAKE_HOOK':
elif sculpt_brush_type == 'SNAKE_HOOK':
layout.separator()
layout.prop(brush, "snake_hook_deform_type")
layout.separator()
elif sculpt_tool == 'POSE':
elif sculpt_brush_type == 'POSE':
layout.separator()
layout.prop(brush, "deform_target")
layout.separator()
@@ -880,7 +879,7 @@ def brush_settings(layout, context, brush, popover=False):
layout.separator()
elif sculpt_tool == 'CLOTH':
elif sculpt_brush_type == 'CLOTH':
layout.separator()
layout.prop(brush, "cloth_simulation_area_type")
if brush.cloth_simulation_area_type != 'GLOBAL':
@@ -901,21 +900,21 @@ def brush_settings(layout, context, brush, popover=False):
layout.prop(brush, "use_cloth_collision")
layout.separator()
elif sculpt_tool == 'SCRAPE':
elif sculpt_brush_type == 'SCRAPE':
row = layout.row(align=True)
row.prop(brush, "area_radius_factor")
row.prop(brush, "use_pressure_area_radius", text="")
row = layout.row()
row.prop(brush, "invert_to_scrape_fill", text="Invert to Fill")
elif sculpt_tool == 'FILL':
elif sculpt_brush_type == 'FILL':
row = layout.row(align=True)
row.prop(brush, "area_radius_factor")
row.prop(brush, "use_pressure_area_radius", text="")
row = layout.row()
row.prop(brush, "invert_to_scrape_fill", text="Invert to Scrape")
elif sculpt_tool == 'PLANE':
elif sculpt_brush_type == 'PLANE':
row = layout.row(align=True)
row.prop(brush, "area_radius_factor")
row.prop(brush, "use_pressure_area_radius", text="")
@@ -925,11 +924,11 @@ def brush_settings(layout, context, brush, popover=False):
layout.prop(brush, "stabilize_normal")
layout.prop(brush, "stabilize_plane")
elif sculpt_tool == 'GRAB':
elif sculpt_brush_type == 'GRAB':
layout.prop(brush, "use_grab_active_vertex")
layout.prop(brush, "use_grab_silhouette")
elif sculpt_tool == 'PAINT':
elif sculpt_brush_type == 'PAINT':
row = layout.row(align=True)
row.prop(brush, "flow")
row.prop(brush, "invert_flow_pressure", text="")
@@ -959,11 +958,11 @@ def brush_settings(layout, context, brush, popover=False):
row = layout.row()
row.prop(brush, "tip_scale_x")
elif sculpt_tool == 'SMEAR':
elif sculpt_brush_type == 'SMEAR':
col = layout.column()
col.prop(brush, "smear_deform_type")
elif sculpt_tool == 'BOUNDARY':
elif sculpt_brush_type == 'BOUNDARY':
layout.prop(brush, "deform_target")
layout.separator()
col = layout.column()
@@ -971,17 +970,17 @@ def brush_settings(layout, context, brush, popover=False):
col.prop(brush, "boundary_falloff_type")
col.prop(brush, "boundary_offset")
elif sculpt_tool == 'TOPOLOGY':
elif sculpt_brush_type == 'TOPOLOGY':
col = layout.column()
col.prop(brush, "slide_deform_type")
elif sculpt_tool == 'MULTIPLANE_SCRAPE':
elif sculpt_brush_type == 'MULTIPLANE_SCRAPE':
col = layout.column()
col.prop(brush, "multiplane_scrape_angle")
col.prop(brush, "use_multiplane_scrape_dynamic")
col.prop(brush, "show_multiplane_scrape_planes_preview")
elif sculpt_tool == 'SMOOTH':
elif sculpt_brush_type == 'SMOOTH':
col = layout.column()
col.prop(brush, "smooth_deform_type")
if brush.smooth_deform_type == 'SURFACE':
@@ -989,20 +988,20 @@ def brush_settings(layout, context, brush, popover=False):
col.prop(brush, "surface_smooth_current_vertex")
col.prop(brush, "surface_smooth_iterations")
elif sculpt_tool == 'DISPLACEMENT_SMEAR':
elif sculpt_brush_type == 'DISPLACEMENT_SMEAR':
col = layout.column()
col.prop(brush, "smear_deform_type")
elif sculpt_tool == 'MASK':
elif sculpt_brush_type == 'MASK':
layout.row().prop(brush, "mask_tool", expand=True)
# End sculpt_tool interface.
# End sculpt_brush_type interface.
# 3D and 2D Texture Paint Mode.
elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
capabilities = brush.image_paint_capabilities
if brush.image_tool == 'FILL':
if brush.image_brush_type == 'FILL':
# For some reason fill threshold only appears to be implemented in 2D paint.
if brush.color_type == 'COLOR':
if mode == 'PAINT_2D':
@@ -1011,7 +1010,7 @@ def brush_settings(layout, context, brush, popover=False):
layout.row().prop(brush, "gradient_fill_mode", expand=True)
elif mode == 'SCULPT_CURVES':
if brush.curves_sculpt_tool == 'ADD':
if brush.curves_sculpt_brush_type == 'ADD':
layout.prop(brush.curves_sculpt_settings, "add_amount")
col = layout.column(heading="Interpolate", align=True)
col.prop(brush.curves_sculpt_settings, "use_length_interpolate", text="Length")
@@ -1031,7 +1030,7 @@ def brush_settings(layout, context, brush, popover=False):
col.active = not brush.curves_sculpt_settings.use_point_count_interpolate
col.prop(brush.curves_sculpt_settings, "points_per_curve", text="Points")
if brush.curves_sculpt_tool == 'DENSITY':
if brush.curves_sculpt_brush_type == 'DENSITY':
col = layout.column()
col.prop(brush.curves_sculpt_settings, "density_add_attempts", text="Count Max")
col = layout.column(heading="Interpolate", align=True)
@@ -1052,7 +1051,7 @@ def brush_settings(layout, context, brush, popover=False):
col.active = not brush.curves_sculpt_settings.use_point_count_interpolate
col.prop(brush.curves_sculpt_settings, "points_per_curve", text="Points")
elif brush.curves_sculpt_tool == 'GROW_SHRINK':
elif brush.curves_sculpt_brush_type == 'GROW_SHRINK':
layout.prop(brush.curves_sculpt_settings, "use_uniform_scale")
layout.prop(brush.curves_sculpt_settings, "minimum_length")
@@ -1102,12 +1101,12 @@ def brush_shared_settings(layout, context, brush, popover=False):
weight = brush.weight_paint_capabilities.has_weight
strength = strength_pressure = True
# Only draw blend mode for the Draw tool, because for other tools it is pointless. D5928#137944
if brush.weight_tool == 'DRAW':
if brush.weight_brush_type == 'DRAW':
blend_mode = True
# Sculpt Curves #
if mode == 'SCULPT_CURVES':
tool = brush.curves_sculpt_tool
tool = brush.curves_sculpt_brush_type
size = True
strength = tool not in {'ADD', 'DELETE'}
direction = tool in {'GROW_SHRINK', 'SELECTION_PAINT'}
@@ -1231,7 +1230,7 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
use_frontface = False
if mode == 'SCULPT':
layout.prop(brush, "sculpt_tool")
layout.prop(brush, "sculpt_brush_type")
layout.separator()
capabilities = brush.sculpt_capabilities
@@ -1319,7 +1318,7 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
# sculpt plane settings
if capabilities.has_sculpt_plane:
layout.prop(brush, "sculpt_plane")
if brush.sculpt_tool != 'PLANE':
if brush.sculpt_brush_type != 'PLANE':
col = layout.column(heading="Original", align=True)
col.prop(brush, "use_original_normal", text="Normal")
col.prop(brush, "use_original_plane", text="Plane")
@@ -1336,7 +1335,7 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
# 3D and 2D Texture Paint.
elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
layout.prop(brush, "image_tool")
layout.prop(brush, "image_brush_type")
layout.separator()
capabilities = brush.image_paint_capabilities
@@ -1348,7 +1347,7 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
layout.prop(brush, "use_alpha")
# Tool specific settings
if brush.image_tool == 'SOFTEN':
if brush.image_brush_type == 'SOFTEN':
layout.separator()
layout.row().prop(brush, "direction", expand=True)
layout.prop(brush, "sharp_threshold")
@@ -1356,36 +1355,36 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
layout.prop(brush, "blur_kernel_radius")
layout.prop(brush, "blur_mode")
elif brush.image_tool == 'MASK':
elif brush.image_brush_type == 'MASK':
layout.prop(brush, "weight", text="Mask Value", slider=True)
elif brush.image_tool == 'CLONE':
elif brush.image_brush_type == 'CLONE':
if mode == 'PAINT_2D':
layout.prop(settings, "clone_image", text="Image")
layout.prop(settings, "clone_alpha", text="Alpha")
# Vertex Paint #
elif mode == 'PAINT_VERTEX':
layout.prop(brush, "vertex_tool")
layout.prop(brush, "vertex_brush_type")
layout.separator()
layout.prop(brush, "use_alpha")
if brush.vertex_tool != 'SMEAR':
if brush.vertex_brush_type != 'SMEAR':
use_accumulate = True
use_frontface = True
# Weight Paint
elif mode == 'PAINT_WEIGHT':
layout.prop(brush, "weight_tool")
layout.prop(brush, "weight_brush_type")
layout.separator()
if brush.weight_tool != 'SMEAR':
if brush.weight_brush_type != 'SMEAR':
use_accumulate = True
use_frontface = True
# Sculpt Curves
elif mode == 'SCULPT_CURVES':
layout.prop(brush, "curves_sculpt_tool")
layout.prop(brush, "curves_sculpt_brush_type")
# Draw shared settings.
if use_accumulate:
@@ -1443,7 +1442,7 @@ def draw_color_settings(context, layout, brush, color_type=False):
col = layout.column()
if brush.image_tool == 'DRAW':
if brush.image_brush_type == 'DRAW':
UnifiedPaintPanel.prop_unified(
col,
context,
@@ -1502,7 +1501,7 @@ def brush_texture_settings(layout, brush, sculpt):
# texture_sample_bias
layout.prop(brush, "texture_sample_bias", slider=True, text="Sample Bias")
if brush.sculpt_tool == 'DRAW':
if brush.sculpt_brush_type == 'DRAW':
col = layout.column()
col.active = tex_slot.map_mode == 'AREA_PLANE'
col.prop(brush, "use_color_as_displacement", text="Vector Displacement")
@@ -1606,7 +1605,7 @@ def brush_basic__draw_color_selector(context, layout, brush, gp_settings):
row.prop(gp_settings, "use_material_pin", text="")
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
row.separator(factor=1.0)
sub_row = row.row(align=True)
pin_draw_mode = gp_settings.pin_draw_mode
@@ -1638,7 +1637,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
return
# Brush details
if brush.gpencil_tool == 'ERASE':
if brush.gpencil_brush_type == 'ERASE':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
@@ -1656,7 +1655,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
row.prop(gp_settings, "eraser_thickness_factor")
# FIXME: tools must use their own UI drawing!
elif brush.gpencil_tool == 'FILL':
elif brush.gpencil_brush_type == 'FILL':
use_property_split_prev = layout.use_property_split
if compact:
row = layout.row(align=True)
@@ -1674,7 +1673,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
row.prop(brush, "size", text="Thickness")
layout.use_property_split = use_property_split_prev
else: # brush.gpencil_tool == 'DRAW/TINT':
else: # brush.gpencil_brush_type == 'DRAW/TINT':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
@@ -1691,7 +1690,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
col = layout.column()
col.template_curve_mapping(gp_settings, "curve_strength", brush=True, use_negative_slope=True)
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
else:
@@ -1735,9 +1734,9 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
if gp_settings is None:
return
grease_pencil_tool = brush.gpencil_tool
grease_pencil_brush_type = brush.gpencil_brush_type
if grease_pencil_tool in {'DRAW', 'ERASE', 'TINT'} or tool.idname in {
if grease_pencil_brush_type in {'DRAW', 'ERASE', 'TINT'} or tool.idname in {
"builtin.arc",
"builtin.curve",
"builtin.line",
@@ -1746,7 +1745,7 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
"builtin.polyline",
}:
size = "size"
if brush.use_locked_size == 'SCENE' and (grease_pencil_tool == 'DRAW' or tool.idname in {
if brush.use_locked_size == 'SCENE' and (grease_pencil_brush_type == 'DRAW' or tool.idname in {
"builtin.arc",
"builtin.curve",
"builtin.line",
@@ -1806,13 +1805,13 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
if settings.use_thickness_curve:
# Pressure curve.
layout.template_curve_mapping(settings, "thickness_primitive_curve", brush=True)
elif grease_pencil_tool == 'DRAW':
elif grease_pencil_brush_type == 'DRAW':
row = layout.row(align=True)
if compact:
row.prop(gp_settings, "caps_type", text="", expand=True)
else:
row.prop(gp_settings, "caps_type", text="Caps Type")
elif brush.gpencil_tool == 'FILL':
elif brush.gpencil_brush_type == 'FILL':
use_property_split_prev = layout.use_property_split
if compact:
row = layout.row(align=True)
@@ -1829,12 +1828,12 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
row = layout.row(align=True)
row.prop(brush, "size", text="Thickness")
layout.use_property_split = use_property_split_prev
elif grease_pencil_tool == 'ERASE':
elif grease_pencil_brush_type == 'ERASE':
layout.prop(gp_settings, "eraser_mode", expand=True)
layout.prop(gp_settings, "use_active_layer_only")
if gp_settings.eraser_mode in {'HARD', 'SOFT'}:
layout.prop(gp_settings, "use_keep_caps_eraser")
elif grease_pencil_tool == 'TINT':
elif grease_pencil_brush_type == 'TINT':
layout.prop(gp_settings, "vertex_mode", text="Mode")
layout.popover("VIEW3D_PT_tools_brush_falloff")
layout.prop(gp_settings, "use_active_layer_only")
@@ -1846,7 +1845,7 @@ def brush_basic_gpencil_sculpt_settings(layout, _context, brush, *, compact=Fals
gp_settings = brush.gpencil_settings
if gp_settings is None:
return
tool = brush.gpencil_sculpt_tool
tool = brush.gpencil_sculpt_brush_type
row = layout.row(align=True)
row.prop(brush, "size", slider=True)
@@ -1877,7 +1876,7 @@ def brush_basic_gpencil_weight_settings(layout, _context, brush, *, compact=Fals
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
if brush.gpencil_weight_tool in {'WEIGHT'}:
if brush.gpencil_weight_brush_type in {'WEIGHT'}:
layout.prop(brush, "weight", slider=True)
layout.prop(brush, "direction", expand=True, text="" if compact else "Direction")
@@ -1891,12 +1890,12 @@ def brush_basic_gpencil_vertex_settings(layout, _context, brush, *, compact=Fals
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'BLUR', 'SMEAR'}:
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_vertex_tool in {'DRAW', 'REPLACE'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'REPLACE'}:
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
@@ -1927,7 +1926,7 @@ def brush_basic_grease_pencil_weight_settings(layout, context, brush, *, compact
header=compact,
)
if brush.gpencil_weight_tool in {'WEIGHT'}:
if brush.gpencil_weight_brush_type in {'WEIGHT'}:
UnifiedPaintPanel.prop_unified(
layout,
context,
@@ -1954,7 +1953,7 @@ def brush_basic_grease_pencil_vertex_settings(layout, context, brush, *, compact
header=compact,
)
if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'BLUR', 'SMEAR'}:
UnifiedPaintPanel.prop_unified(
layout,
context,
@@ -1967,7 +1966,7 @@ def brush_basic_grease_pencil_vertex_settings(layout, context, brush, *, compact
)
gp_settings = brush.gpencil_settings
if brush.gpencil_vertex_tool in {'DRAW', 'REPLACE'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'REPLACE'}:
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")

View File

@@ -1787,7 +1787,6 @@ class ImageAssetShelf(BrushAssetShelf):
class IMAGE_AST_brush_paint(ImageAssetShelf, AssetShelf):
mode_prop = "use_paint_image"
brush_type_prop = "image_brush_type"
tool_prop = "image_tool"
@classmethod
def poll(cls, context):

View File

@@ -107,17 +107,17 @@ class VIEW3D_HT_tool_header(Header):
if is_valid_context:
brush = context.tool_settings.gpencil_paint.brush
if brush:
if brush.gpencil_tool not in {'FILL', 'TINT', 'ERASE'}:
if brush.gpencil_brush_type not in {'FILL', 'TINT', 'ERASE'}:
layout.popover("VIEW3D_PT_tools_grease_pencil_v3_brush_advanced")
layout.popover("VIEW3D_PT_tools_grease_pencil_v3_brush_stroke")
if brush.gpencil_tool == 'FILL':
if brush.gpencil_brush_type == 'FILL':
layout.popover("VIEW3D_PT_tools_grease_pencil_v3_brush_fill_advanced")
layout.popover("VIEW3D_PT_tools_grease_pencil_paint_appearance")
elif tool_mode == 'SCULPT_GREASE_PENCIL':
if is_valid_context:
brush = context.tool_settings.gpencil_sculpt_paint.brush
if brush:
tool = brush.gpencil_sculpt_tool
tool = brush.gpencil_sculpt_brush_type
if tool in {'SMOOTH', 'RANDOMIZE'}:
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover")
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
@@ -429,7 +429,7 @@ class _draw_tool_settings_context_mode:
)
# direction
if brush.gpencil_sculpt_tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
if brush.gpencil_sculpt_brush_type in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
layout.row().prop(brush, "direction", expand=True, text="")
# Brush falloff
@@ -485,7 +485,7 @@ class _draw_tool_settings_context_mode:
BrushAssetShelf.draw_popup_selector(layout, context, brush)
if brush.gpencil_vertex_tool not in {'BLUR', 'AVERAGE', 'SMEAR'}:
if brush.gpencil_vertex_brush_type not in {'BLUR', 'AVERAGE', 'SMEAR'}:
layout.separator(factor=0.4)
ups = context.tool_settings.unified_paint_settings
prop_owner = ups if ups.use_unified_color else brush
@@ -559,8 +559,8 @@ class _draw_tool_settings_context_mode:
header=True,
)
if brush.curves_sculpt_tool not in {'ADD', 'DELETE'}:
use_strength_pressure = brush.curves_sculpt_tool not in {'SLIDE'}
if brush.curves_sculpt_brush_type not in {'ADD', 'DELETE'}:
use_strength_pressure = brush.curves_sculpt_brush_type not in {'SLIDE'}
UnifiedPaintPanel.prop_unified(
layout,
context,
@@ -571,7 +571,7 @@ class _draw_tool_settings_context_mode:
header=True,
)
curves_tool = brush.curves_sculpt_tool
curves_tool = brush.curves_sculpt_brush_type
if curves_tool == 'COMB':
layout.prop(brush, "falloff_shape", expand=True)
@@ -651,7 +651,7 @@ class _draw_tool_settings_context_mode:
BrushAssetShelf.draw_popup_selector(row, context, brush)
grease_pencil_tool = brush.gpencil_tool
grease_pencil_tool = brush.gpencil_brush_type
if grease_pencil_tool in {'DRAW', 'FILL'}:
from bl_ui.properties_paint_common import (
@@ -969,7 +969,7 @@ class VIEW3D_HT_header(Header):
paint = tool_settings.sculpt
brush = paint.brush
if brush:
is_paint_tool = brush.sculpt_tool in {'PAINT', 'SMEAR'}
is_paint_tool = brush.sculpt_brush_type in {'PAINT', 'SMEAR'}
else:
is_paint_tool = tool and tool.use_paint_canvas
@@ -8447,9 +8447,9 @@ class VIEW3D_PT_greasepencil_draw_context_menu(Panel):
gp_settings = brush.gpencil_settings
is_pin_vertex = gp_settings.brush_draw_mode == 'VERTEXCOLOR'
is_vertex = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT' or is_pin_vertex
is_vertex = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_brush_type == 'TINT' or is_pin_vertex
if brush.gpencil_tool not in {'ERASE', 'CUTTER', 'EYEDROPPER'} and is_vertex:
if brush.gpencil_brush_type not in {'ERASE', 'CUTTER', 'EYEDROPPER'} and is_vertex:
split = layout.split(factor=0.1)
split.prop(brush, "color", text="")
split.template_color_picker(brush, "color", value_slider=True)
@@ -8459,12 +8459,12 @@ class VIEW3D_PT_greasepencil_draw_context_menu(Panel):
col.prop_menu_enum(gp_settings, "vertex_mode", text="Mode")
col.separator()
if brush.gpencil_tool not in {'FILL', 'CUTTER', 'ERASE'}:
if brush.gpencil_brush_type not in {'FILL', 'CUTTER', 'ERASE'}:
radius = "size" if (brush.use_locked_size == 'VIEW') else "unprojected_radius"
layout.prop(brush, radius, text="Radius", slider=True)
if brush.gpencil_tool == 'ERASE':
if brush.gpencil_brush_type == 'ERASE':
layout.prop(brush, "size", slider=True)
if brush.gpencil_tool not in {'ERASE', 'FILL', 'CUTTER'}:
if brush.gpencil_brush_type not in {'ERASE', 'FILL', 'CUTTER'}:
layout.prop(gp_settings, "pen_strength")
layer = context.object.data.layers.active
@@ -8528,7 +8528,7 @@ class VIEW3D_PT_greasepencil_vertex_paint_context_menu(Panel):
col = layout.column()
if brush.gpencil_vertex_tool in {'DRAW', 'REPLACE'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'REPLACE'}:
split = layout.split(factor=0.1)
split.prop(tool_settings.unified_paint_settings, "color", text="")
split.template_color_picker(tool_settings.unified_paint_settings, "color", value_slider=True)
@@ -8542,7 +8542,7 @@ class VIEW3D_PT_greasepencil_vertex_paint_context_menu(Panel):
row.prop(tool_settings.unified_paint_settings, "size", text="Radius")
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
if brush.gpencil_vertex_brush_type in {'DRAW', 'BLUR', 'SMEAR'}:
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
@@ -8847,7 +8847,7 @@ class VIEW3D_PT_sculpt_context_menu(Panel):
if capabilities.has_pinch_factor:
text = "Pinch"
if brush.sculpt_tool in {'BLOB', 'SNAKE_HOOK'}:
if brush.sculpt_brush_type in {'BLOB', 'SNAKE_HOOK'}:
text = "Magnify"
layout.prop(brush, "crease_pinch_factor", slider=True, text=text)
@@ -8920,7 +8920,7 @@ class TOPBAR_PT_grease_pencil_vertex_color(Panel):
layout.template_palette(paint, "palette", color=True)
gp_settings = brush.gpencil_settings
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
row = layout.row(align=True)
@@ -9035,63 +9035,54 @@ class VIEW3D_AST_brush_sculpt(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'SCULPT'
mode_prop = "use_paint_sculpt"
brush_type_prop = "sculpt_brush_type"
tool_prop = "sculpt_tool"
class VIEW3D_AST_brush_sculpt_curves(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'SCULPT_CURVES'
mode_prop = "use_paint_sculpt_curves"
brush_type_prop = "curves_sculpt_brush_type"
tool_prop = "curves_sculpt_tool"
class VIEW3D_AST_brush_vertex_paint(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'VERTEX_PAINT'
mode_prop = "use_paint_vertex"
brush_type_prop = "vertex_brush_type"
tool_prop = "vertex_tool"
class VIEW3D_AST_brush_weight_paint(AssetShelfHiddenByDefault, View3DAssetShelf, bpy.types.AssetShelf):
mode = 'WEIGHT_PAINT'
mode_prop = "use_paint_weight"
brush_type_prop = "weight_brush_type"
tool_prop = "weight_tool"
class VIEW3D_AST_brush_texture_paint(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'TEXTURE_PAINT'
mode_prop = "use_paint_image"
brush_type_prop = "image_brush_type"
tool_prop = "image_tool"
class VIEW3D_AST_brush_gpencil_paint(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'PAINT_GREASE_PENCIL'
mode_prop = "use_paint_grease_pencil"
brush_type_prop = "gpencil_brush_type"
tool_prop = "gpencil_tool"
class VIEW3D_AST_brush_gpencil_sculpt(View3DAssetShelf, bpy.types.AssetShelf):
mode = 'SCULPT_GREASE_PENCIL'
mode_prop = "use_sculpt_grease_pencil"
brush_type_prop = "gpencil_sculpt_brush_type"
tool_prop = "gpencil_sculpt_tool"
class VIEW3D_AST_brush_gpencil_vertex(AssetShelfHiddenByDefault, View3DAssetShelf, bpy.types.AssetShelf):
mode = 'VERTEX_GREASE_PENCIL'
mode_prop = "use_vertex_grease_pencil"
brush_type_prop = "gpencil_vertex_brush_type"
tool_prop = "gpencil_vertex_tool"
class VIEW3D_AST_brush_gpencil_weight(AssetShelfHiddenByDefault, View3DAssetShelf, bpy.types.AssetShelf):
mode = 'WEIGHT_GREASE_PENCIL'
mode_prop = "use_weight_grease_pencil"
brush_type_prop = "gpencil_weight_brush_type"
tool_prop = "gpencil_weight_tool"
classes = (

View File

@@ -381,7 +381,7 @@ class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
mode = cls.get_brush_mode(context)
if mode == 'SCULPT_GREASE_PENCIL':
settings = cls.paint_settings(context)
tool = settings.brush.gpencil_sculpt_tool
tool = settings.brush.gpencil_sculpt_brush_type
return tool in {'SMOOTH', 'RANDOMIZE'}
return mode is not None and mode != 'SCULPT_CURVES'
@@ -599,7 +599,7 @@ class VIEW3D_PT_slots_paint_canvas(SelectPaintSlotHelper, View3DPanel, Panel):
if tool.use_brushes:
brush = context.tool_settings.sculpt.brush
if brush:
is_paint_tool = brush.sculpt_tool in {'PAINT', 'SMEAR'}
is_paint_tool = brush.sculpt_brush_type in {'PAINT', 'SMEAR'}
else:
# TODO: The property use_paint_canvas doesn't work anymore since its associated
# C++ function 'rna_WorkSpaceTool_use_paint_canvas_get' passes in a nullptr for
@@ -811,7 +811,7 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
if context.sculpt_object or context.vertex_paint_object:
return True
elif context.image_paint_object:
return (brush.image_tool == 'DRAW')
return (brush.image_brush_type == 'DRAW')
return False
def draw(self, context):
@@ -1617,7 +1617,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(Panel, View3DPanel, GreasePen
if brush is not None:
gp_settings = brush.gpencil_settings
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
row = layout.row(align=True)
row_mat = row.row()
if gp_settings.use_material_pin:
@@ -1646,7 +1646,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_advanced(View3DPanel, Panel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'TINT'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'TINT'}
def draw(self, context):
layout = self.layout
@@ -1660,7 +1660,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_advanced(View3DPanel, Panel):
col = layout.column(align=True)
if brush is not None:
if brush.gpencil_tool != 'FILL':
if brush.gpencil_brush_type != 'FILL':
col.prop(gp_settings, "input_samples")
col.separator()
@@ -1684,7 +1684,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_advanced(View3DPanel, Panel):
subcol.enabled = False
subcol.prop(gp_settings, "aspect")
elif brush.gpencil_tool == 'FILL':
elif brush.gpencil_brush_type == 'FILL':
row = col.row(align=True)
row.prop(gp_settings, "fill_draw_mode", text="Boundary", text_ctxt=i18n_contexts.id_gpencil)
row.prop(
@@ -1726,7 +1726,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_stroke(Panel, View3DPanel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'DRAW'
return brush is not None and brush.gpencil_brush_type == 'DRAW'
def draw(self, _context):
layout = self.layout
@@ -1744,7 +1744,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(Panel, View3DPanel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'DRAW'
return brush is not None and brush.gpencil_brush_type == 'DRAW'
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -1777,7 +1777,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_post_processing(View3DPanel, Panel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL', 'TINT'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'FILL', 'TINT'}
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -1832,7 +1832,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL', 'TINT'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'FILL', 'TINT'}
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -1926,7 +1926,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_paint_falloff(GreasePencilBrushFalloff
if tool and tool.idname != "builtin_brush.Tint":
return False
gptool = brush.gpencil_tool
gptool = brush.gpencil_brush_type
return (settings and settings.brush and settings.brush.curve and gptool == 'TINT')
@@ -1940,7 +1940,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_gap_closure(View3DPanel, Panel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'FILL'
return brush is not None and brush.gpencil_brush_type == 'FILL'
def draw(self, context):
layout = self.layout
@@ -2018,7 +2018,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_brush_advanced(GreasePencilSculptAdva
if brush is None:
return False
tool = brush.gpencil_sculpt_tool
tool = brush.gpencil_sculpt_brush_type
return tool in {'SMOOTH', 'RANDOMIZE'}
@@ -2036,7 +2036,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover(GreasePencilSculptAdvan
if brush is None:
return False
tool = brush.gpencil_sculpt_tool
tool = brush.gpencil_sculpt_brush_type
return tool in {'SMOOTH', 'RANDOMIZE'}
@@ -2150,7 +2150,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
if ob is None or brush is None:
return False
if context.region.type == 'TOOL_HEADER' or brush.gpencil_vertex_tool in {'BLUR', 'AVERAGE', 'SMEAR'}:
if context.region.type == 'TOOL_HEADER' or brush.gpencil_vertex_brush_type in {'BLUR', 'AVERAGE', 'SMEAR'}:
return False
return True
@@ -2211,7 +2211,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_palette(View3DPanel, Panel):
if ob is None or brush is None:
return False
if brush.gpencil_vertex_tool in {'BLUR', 'AVERAGE', 'SMEAR'}:
if brush.gpencil_vertex_brush_type in {'BLUR', 'AVERAGE', 'SMEAR'}:
return False
return True
@@ -2254,10 +2254,10 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
if tool and tool.idname in {"builtin.cutter", "builtin.eyedropper", "builtin.interpolate"}:
return False
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
return True
if brush.gpencil_tool not in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type not in {'DRAW', 'FILL'}:
return False
return True
@@ -2269,14 +2269,14 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
brush = settings.brush
gp_settings = brush.gpencil_settings
if brush.gpencil_tool != 'TINT':
if brush.gpencil_brush_type != 'TINT':
row = layout.row()
row.prop(settings, "color_mode", expand=True)
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
col.enabled = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'
col.enabled = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_brush_type == 'TINT'
col.template_color_picker(brush, "color", value_slider=True)
@@ -2286,11 +2286,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
sub_row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
col.prop(gp_settings, "vertex_mode", text="Mode")
@@ -2315,10 +2315,10 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
if tool and tool.idname in {"builtin.cutter", "builtin.eyedropper", "builtin.interpolate"}:
return False
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
return True
if brush.gpencil_tool not in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type not in {'DRAW', 'FILL'}:
return False
return True
@@ -2332,7 +2332,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
brush = settings.brush
col = layout.column()
col.enabled = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'
col.enabled = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_brush_type == 'TINT'
row = col.row(align=True)
row.template_ID(settings, "palette", new="palette.new")
@@ -2445,7 +2445,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_settings(Panel, View3DPanel, Grease
if brush is not None:
gp_settings = brush.gpencil_settings
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
row = layout.row(align=True)
row_mat = row.row()
if gp_settings.use_material_pin:
@@ -2477,7 +2477,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_advanced(View3DPanel, Panel):
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'TINT', 'FILL'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'TINT', 'FILL'}
def draw(self, context):
layout = self.layout
@@ -2535,7 +2535,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_fill_advanced(View3DPanel, Panel):
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'FILL'
return brush is not None and brush.gpencil_brush_type == 'FILL'
def draw(self, context):
layout = self.layout
@@ -2597,7 +2597,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_stroke(Panel, View3DPanel):
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'DRAW'
return brush is not None and brush.gpencil_brush_type == 'DRAW'
def draw(self, _context):
layout = self.layout
@@ -2618,7 +2618,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_post_processing(View3DPanel, Panel)
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL', 'TINT'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'FILL', 'TINT'}
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -2676,7 +2676,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_random(View3DPanel, Panel):
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL', 'TINT'}
return brush is not None and brush.gpencil_brush_type not in {'ERASE', 'FILL', 'TINT'}
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -2765,7 +2765,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_stabilizer(Panel, View3DPanel):
if ob.type != 'GREASEPENCIL':
return False
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'DRAW'
return brush is not None and brush.gpencil_brush_type == 'DRAW'
def draw_header(self, context):
brush = context.tool_settings.gpencil_paint.brush
@@ -2809,10 +2809,10 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_mixcolor(View3DPanel, Panel):
if tool and tool.idname in {"builtin.cutter", "builtin.eyedropper", "builtin.interpolate"}:
return False
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
return True
if brush.gpencil_tool not in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type not in {'DRAW', 'FILL'}:
return False
return True
@@ -2848,7 +2848,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_mixcolor(View3DPanel, Panel):
sub_row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
if brush.gpencil_tool in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
@@ -2874,10 +2874,10 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_mix_palette(View3DPanel, Panel):
if tool and tool.idname in {"builtin.cutter", "builtin.eyedropper", "builtin.interpolate"}:
return False
if brush.gpencil_tool == 'TINT':
if brush.gpencil_brush_type == 'TINT':
return True
if brush.gpencil_tool not in {'DRAW', 'FILL'}:
if brush.gpencil_brush_type not in {'DRAW', 'FILL'}:
return False
return True
@@ -2934,7 +2934,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_gap_closure(View3DPanel, Panel):
@classmethod
def poll(cls, context):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'FILL'
return brush is not None and brush.gpencil_brush_type == 'FILL'
def draw(self, context):
layout = self.layout

View File

@@ -2456,33 +2456,33 @@ static void rna_def_brush(BlenderRNA *brna)
*
* keep in sync with #BKE_paint_get_tool_prop_id_from_paintmode
*/
prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "sculpt_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "sculpt_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_sculpt_brush_type_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "vertex_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "vertex_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_vertex_brush_type_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "weight_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "weight_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_weight_brush_type_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "image_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "image_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_image_brush_type_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
prop = RNA_def_property(srna, "gpencil_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "gpencil_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "gpencil_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_types_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
@@ -2490,14 +2490,14 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "gpencil_vertex_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "gpencil_vertex_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "gpencil_vertex_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_vertex_types_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "gpencil_sculpt_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "gpencil_sculpt_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "gpencil_sculpt_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_sculpt_types_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
@@ -2505,14 +2505,14 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "gpencil_weight_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "gpencil_weight_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "gpencil_weight_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_weight_types_items);
RNA_def_property_ui_text(prop, "Brush Type", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "curves_sculpt_tool", PROP_ENUM, PROP_NONE);
prop = RNA_def_property(srna, "curves_sculpt_brush_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "curves_sculpt_brush_type");
RNA_def_property_enum_items(prop, rna_enum_brush_curves_sculpt_brush_type_items);
RNA_def_property_ui_text(prop, "Brush Type", "");

View File

@@ -60,7 +60,7 @@ class AssetSaveAsTest(unittest.TestCase):
self.assertTrue("Local Copy" in bpy.data.brushes)
local_brush = bpy.data.brushes["Local Copy"]
self.assertEqual(local_brush.sculpt_tool, 'SMOOTH')
self.assertEqual(local_brush.sculpt_brush_type, 'SMOOTH')
self.assertGreaterEqual(local_brush.users, 1)