Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| def generate_from_enum_ex( | def generate_from_enum_ex( | ||||
| _context, *, | _context, *, | ||||
| idname_prefix, | idname_prefix, | ||||
| icon_prefix, | icon_prefix, | ||||
| type, | type, | ||||
| attr, | attr, | ||||
| cursor='DEFAULT', | cursor='DEFAULT', | ||||
| tooldef_keywords={}, | tooldef_keywords={}, | ||||
| exclude_filter = {} | |||||
| ): | ): | ||||
| tool_defs = [] | tool_defs = [] | ||||
| for enum in type.bl_rna.properties[attr].enum_items_static: | for enum in type.bl_rna.properties[attr].enum_items_static: | ||||
| name = enum.name | name = enum.name | ||||
| idname = enum.identifier | idname = enum.identifier | ||||
| if idname in exclude_filter: | |||||
| continue | |||||
| tool_defs.append( | tool_defs.append( | ||||
| ToolDef.from_dict( | ToolDef.from_dict( | ||||
| dict( | dict( | ||||
| idname=idname_prefix + name, | idname=idname_prefix + name, | ||||
| label=name, | label=name, | ||||
| icon=icon_prefix + idname.lower(), | icon=icon_prefix + idname.lower(), | ||||
| cursor=cursor, | cursor=cursor, | ||||
| data_block=idname, | data_block=idname, | ||||
| ▲ Show 20 Lines • Show All 1,107 Lines • ▼ Show 20 Lines | def generate_from_brushes(context): | ||||
| attr="tool", | attr="tool", | ||||
| ) | ) | ||||
| class _defs_sculpt: | class _defs_sculpt: | ||||
| @staticmethod | @staticmethod | ||||
| def generate_from_brushes(context): | def generate_from_brushes(context): | ||||
| if bpy.context.preferences.experimental.use_sculpt_vertex_colors: | |||||
| exclude_filter = {} | |||||
| else: | |||||
| exclude_filter = {'PAINT', 'SMEAR'} | |||||
| return generate_from_enum_ex( | return generate_from_enum_ex( | ||||
| context, | context, | ||||
| idname_prefix="builtin_brush.", | idname_prefix="builtin_brush.", | ||||
| icon_prefix="brush.sculpt.", | icon_prefix="brush.sculpt.", | ||||
| type=bpy.types.Brush, | type=bpy.types.Brush, | ||||
| attr="sculpt_tool", | attr="sculpt_tool", | ||||
| exclude_filter = exclude_filter, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def hide_border(): | def hide_border(): | ||||
| return dict( | return dict( | ||||
| idname="builtin.box_hide", | idname="builtin.box_hide", | ||||
| label="Box Hide", | label="Box Hide", | ||||
| icon="ops.sculpt.border_hide", | icon="ops.sculpt.border_hide", | ||||
| ▲ Show 20 Lines • Show All 1,285 Lines • ▼ Show 20 Lines | _tools = { | ||||
| ( | ( | ||||
| _defs_sculpt.mask_border, | _defs_sculpt.mask_border, | ||||
| _defs_sculpt.mask_lasso, | _defs_sculpt.mask_lasso, | ||||
| ), | ), | ||||
| _defs_sculpt.hide_border, | _defs_sculpt.hide_border, | ||||
| None, | None, | ||||
| _defs_sculpt.mesh_filter, | _defs_sculpt.mesh_filter, | ||||
| _defs_sculpt.cloth_filter, | _defs_sculpt.cloth_filter, | ||||
| _defs_sculpt.color_filter, | lambda context: ( | ||||
| (_defs_sculpt.color_filter,) | |||||
| if bpy.context.preferences.view.show_developer_ui and \ | |||||
| bpy.context.preferences.experimental.use_sculpt_vertex_colors | |||||
| else () | |||||
| ), | |||||
| None, | None, | ||||
| _defs_sculpt.mask_by_color, | lambda context: ( | ||||
| (_defs_sculpt.mask_by_color,) | |||||
| if bpy.context.preferences.view.show_developer_ui and \ | |||||
| bpy.context.preferences.experimental.use_sculpt_vertex_colors | |||||
| else () | |||||
| ), | |||||
| None, | None, | ||||
| _defs_transform.translate, | _defs_transform.translate, | ||||
| _defs_transform.rotate, | _defs_transform.rotate, | ||||
| _defs_transform.scale, | _defs_transform.scale, | ||||
| _defs_transform.transform, | _defs_transform.transform, | ||||
| None, | None, | ||||
| *_tools_annotate, | *_tools_annotate, | ||||
| ], | ], | ||||
| ▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines | |||||