WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 381 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 74 additions and 31 deletions
Showing only changes of commit ea833527f6 - Show all commits

View File

@ -1368,6 +1368,8 @@ class _defs_sculpt:
@staticmethod @staticmethod
def generate_brush_tool(context): def generate_brush_tool(context):
# Though `data_block` is conceptually unnecessary with a single brush tool,
# it's still used because many areas assume that brush tools have it set #bToolRef.
tool = None tool = None
if context: if context:
brush = context.tool_settings.sculpt.brush brush = context.tool_settings.sculpt.brush
@ -1634,13 +1636,23 @@ class _defs_vertex_paint:
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):
return generate_from_enum_ex( # Though `data_block` is conceptually unnecessary with a single brush tool,
context, # it's still used because many areas assume that brush tools have it set #bToolRef.
idname_prefix="builtin_brush.", tool = None
icon_prefix="brush.paint_vertex.", if context:
type=bpy.types.Brush, brush = context.tool_settings.vertex_paint.brush
attr="vertex_tool", if brush:
) tool = brush.vertex_tool
return [
ToolDef.from_dict(
dict(
idname="builtin.brush",
label="Brush",
icon="brush.sculpt.paint",
data_block=tool
)
)
]
class _defs_texture_paint: class _defs_texture_paint:
@ -1655,14 +1667,24 @@ class _defs_texture_paint:
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):
return generate_from_enum_ex( # Though `data_block` is conceptually unnecessary with a single brush tool,
context, # it's still used because many areas assume that brush tools have it set #bToolRef.
idname_prefix="builtin_brush.", tool = None
icon_prefix="brush.paint_texture.", if context:
type=bpy.types.Brush, brush = context.tool_settings.image_paint.brush
attr="image_tool", if brush:
cursor='PAINT_CROSS', tool = brush.image_tool
) return [
ToolDef.from_dict(
dict(
idname="builtin.brush",
label="Brush",
icon="brush.sculpt.paint",
cursor='PAINT_CROSS',
data_block=tool
)
)
]
class _defs_weight_paint: class _defs_weight_paint:
@ -1682,13 +1704,23 @@ class _defs_weight_paint:
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):
return generate_from_enum_ex( # Though `data_block` is conceptually unnecessary with a single brush tool,
context, # it's still used because many areas assume that brush tools have it set #bToolRef.
idname_prefix="builtin_brush.", tool = None
icon_prefix="brush.paint_weight.", if context:
type=bpy.types.Brush, brush = context.tool_settings.weight_paint.brush
attr="weight_tool", if brush:
) tool = brush.weight_tool
return [
ToolDef.from_dict(
dict(
idname="builtin.brush",
label="Brush",
icon="brush.sculpt.paint",
data_block=tool
)
)
]
@ToolDef.from_fn @ToolDef.from_fn
def sample_weight(): def sample_weight():
@ -1765,14 +1797,23 @@ class _defs_paint_grease_pencil:
# #
# @staticmethod # @staticmethod
# def generate_from_brushes(context): # def generate_from_brushes(context):
# return generate_from_enum_ex( # # Though `data_block` is conceptually unnecessary with a single brush tool,
# context, # # it's still used because many areas assume that brush tools have it set #bToolRef.
# idname_prefix="builtin_brush.", # tool = None
# icon_prefix="brush.gpencil_draw.", # if context:
# type=bpy.types.Brush, # brush = context.tool_settings.gpencil_paint.brush
# attr="gpencil_tool", # if brush:
# cursor='DOT', # tool = brush.gpencil_tool
# ) # return [
# ToolDef.from_dict(
# dict(
# idname="builtin.brush",
# label="Brush",
# icon="brush.sculpt.paint",
# data_block=tool
# )
# )
# ]
@ToolDef.from_fn @ToolDef.from_fn
def draw(): def draw():
@ -2432,9 +2473,11 @@ class _defs_curves_sculpt:
@staticmethod @staticmethod
def generate_brush_tool(context): def generate_brush_tool(context):
# Though `data_block` is conceptually unnecessary with a single brush tool,
# it's still used because many areas assume that brush tools have it set #bToolRef.
tool = None tool = None
if context: if context:
brush = context.tool_settings.sculpt.brush brush = context.tool_settings.curves_sculpt.brush
if brush: if brush:
tool = brush.curves_sculpt_tool tool = brush.curves_sculpt_tool
return [ return [