1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
22 "name": "Hotkey: 'W'",
23 "description": "Sculpt Brush Menu",
24 "author": "pitiwazou, meta-androcto",
26 "blender": (2, 80, 0),
30 "category": "Sculpt Pie"
35 from bpy
.types
import (
42 class PIE_OT_SculptSculptDraw(Operator
):
43 bl_idname
= "sculpt.sculptraw"
44 bl_label
= "Sculpt SculptDraw"
45 bl_options
= {'REGISTER', 'UNDO'}
47 def execute(self
, context
):
48 context
.tool_settings
.sculpt
.brush
= bpy
.data
.brushes
['SculptDraw']
52 # Pie Sculp Pie Menus - W
53 class PIE_MT_SculptPie(Menu
):
54 bl_idname
= "PIE_MT_sculpt"
55 bl_label
= "Pie Sculpt"
57 def draw(self
, context
):
60 pie
= layout
.menu_pie()
63 pie
.operator("paint.brush_select",
64 text
=" Crease", icon_value
=brush_icons
["crease"]).sculpt_tool
= 'CREASE'
66 pie
.operator("paint.brush_select",
67 text
=" Blob", icon_value
=brush_icons
["blob"]).sculpt_tool
= 'BLOB'
69 pie
.menu(PIE_MT_Sculpttwo
.bl_idname
, text
="More Brushes")
71 pie
.operator("sculpt.sculptraw",
72 text
=" Draw", icon_value
=brush_icons
["draw"])
74 pie
.operator("paint.brush_select",
75 text
=" Clay", icon_value
=brush_icons
["clay"]).sculpt_tool
= 'CLAY'
77 pie
.operator("paint.brush_select",
78 text
=" Clay Strips", icon_value
=brush_icons
["clay_strips"]).sculpt_tool
= 'CLAY_STRIPS'
80 pie
.operator("paint.brush_select",
81 text
=" Inflate/Deflate", icon_value
=brush_icons
["inflate"]).sculpt_tool
= 'INFLATE'
83 pie
.menu(PIE_MT_Sculptthree
.bl_idname
,
84 text
=" Grab Brushes", icon_value
=brush_icons
["grab"])
88 class PIE_MT_Sculpttwo(Menu
):
89 bl_idname
= "PIE_MT_sculpttwo"
90 bl_label
= "Pie Sculpt 2"
92 def draw(self
, context
):
97 layout
.operator("paint.brush_select", text
=' Smooth',
98 icon_value
=brush_icons
["smooth"]).sculpt_tool
= 'SMOOTH'
99 layout
.operator("paint.brush_select", text
=' Flatten',
100 icon_value
=brush_icons
["flatten"]).sculpt_tool
= 'FLATTEN'
101 layout
.operator("paint.brush_select", text
=' Scrape/Peaks',
102 icon_value
=brush_icons
["scrape"]).sculpt_tool
= 'SCRAPE'
103 layout
.operator("paint.brush_select", text
=' Fill/Deepen',
104 icon_value
=brush_icons
["fill"]).sculpt_tool
= 'FILL'
105 layout
.operator("paint.brush_select", text
=' Pinch/Magnify',
106 icon_value
=brush_icons
["pinch"]).sculpt_tool
= 'PINCH'
107 layout
.operator("paint.brush_select", text
=' Layer',
108 icon_value
=brush_icons
["layer"]).sculpt_tool
= 'LAYER'
109 layout
.operator("paint.brush_select", text
=' Mask',
110 icon_value
=brush_icons
["mask"]).sculpt_tool
= 'MASK'
114 class PIE_MT_Sculptthree(Menu
):
115 bl_idname
= "PIE_MT_sculptthree"
116 bl_label
= "Pie Sculpt 3"
118 def draw(self
, context
):
123 layout
.operator("paint.brush_select",
124 text
=' Grab', icon_value
=brush_icons
["grab"]).sculpt_tool
= 'GRAB'
125 layout
.operator("paint.brush_select",
126 text
=' Nudge', icon_value
=brush_icons
["nudge"]).sculpt_tool
= 'NUDGE'
127 layout
.operator("paint.brush_select",
128 text
=' Thumb', icon_value
=brush_icons
["thumb"]).sculpt_tool
= 'THUMB'
129 layout
.operator("paint.brush_select",
130 text
=' Snakehook', icon_value
=brush_icons
["snake_hook"]).sculpt_tool
= 'SNAKE_HOOK'
131 layout
.operator("paint.brush_select",
132 text
=' Rotate', icon_value
=brush_icons
["rotate"]).sculpt_tool
= 'ROTATE'
139 icons_directory
= bpy
.utils
.system_resource('DATAFILES', "icons")
140 brushes
= ["crease", "blob", "smooth", "draw", "clay", "clay_strips", "inflate", "grab",
141 "nudge", "thumb", "snake_hook", "rotate", "flatten", "scrape", "fill", "pinch",
143 for brush
in brushes
:
144 filename
= os
.path
.join(icons_directory
, f
"brush.sculpt.{brush}.dat")
145 icon_value
= bpy
.app
.icons
.new_triangles_from_file(filename
)
146 brush_icons
[brush
] = icon_value
151 for value
in brush_icons
.values():
152 bpy
.app
.icons
.release(value
)
158 PIE_OT_SculptSculptDraw
,
168 bpy
.utils
.register_class(cls
)
170 wm
= bpy
.context
.window_manager
171 if wm
.keyconfigs
.addon
:
173 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Sculpt')
174 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'W', 'PRESS')
175 kmi
.properties
.name
= "PIE_MT_sculpt"
176 addon_keymaps
.append((km
, kmi
))
183 bpy
.utils
.unregister_class(cls
)
185 wm
= bpy
.context
.window_manager
186 kc
= wm
.keyconfigs
.addon
188 for km
, kmi
in addon_keymaps
:
189 km
.keymap_items
.remove(kmi
)
190 addon_keymaps
.clear()
193 if __name__
== "__main__":