forked from wheybags/freeablo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
symmetry_menu.py
72 lines (53 loc) · 2.41 KB
/
symmetry_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from bpy.props import *
from .Utils.core import *
class MasterSymmetryMenu(bpy.types.Menu):
bl_label = "Symmetry Options"
bl_idname = "VIEW3D_MT_master_symmetry_menu"
@classmethod
def poll(self, context):
if get_mode() in [sculpt, texture_paint]:
return True
else:
return False
def draw(self, context):
menu = Menu(self)
if get_mode() == texture_paint:
menu.add_item().prop(context.tool_settings.image_paint, "use_symmetry_x", toggle=True)
menu.add_item().prop(context.tool_settings.image_paint, "use_symmetry_y", toggle=True)
menu.add_item().prop(context.tool_settings.image_paint, "use_symmetry_z", toggle=True)
else:
menu.add_item().menu(SymmetryMenu.bl_idname)
menu.add_item().menu(SymmetryRadialMenu.bl_idname)
menu.add_item().prop(context.tool_settings.sculpt, "use_symmetry_feather", toggle=True)
class SymmetryMenu(bpy.types.Menu):
bl_label = "Symmetry"
bl_idname = "VIEW3D_MT_symmetry_menu"
def draw(self, context):
menu = Menu(self)
menu.add_item().label(text="Symmetry")
menu.add_item().separator()
menu.add_item().prop(context.tool_settings.sculpt, "use_symmetry_x", toggle=True)
menu.add_item().prop(context.tool_settings.sculpt, "use_symmetry_y", toggle=True)
menu.add_item().prop(context.tool_settings.sculpt, "use_symmetry_z", toggle=True)
class SymmetryRadialMenu(bpy.types.Menu):
bl_label = "Radial"
bl_idname = "VIEW3D_MT_symmetry_radial_menu"
def draw(self, context):
menu = Menu(self)
menu.add_item().label(text="Radial")
menu.add_item().separator()
menu.add_item("column").prop(context.tool_settings.sculpt, "radial_symmetry", text="", slider=True)
### ------------ New hotkeys and registration ------------ ###
addon_keymaps = []
def register():
wm = bpy.context.window_manager
modes = ['Sculpt', 'Image Paint']
for mode in modes:
km = wm.keyconfigs.addon.keymaps.new(name=mode)
kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', alt=True)
kmi.properties.name = "VIEW3D_MT_master_symmetry_menu"
addon_keymaps.append((km, kmi))
def unregister():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()