-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
80 lines (67 loc) · 2.56 KB
/
__init__.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
73
74
75
76
77
78
79
80
# Copyright (C) 2023 Daniel Boxer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import bpy
from .ui import POLYBLOCKER_MT_pie, POLYBLOCKER_AP_preferences
from .add_mesh import POLYBLOCKER_OT_add_mesh, POLYBLOCKER_OT_make_collection
from .cap_tool import POLYBLOCKER_OT_cap_tool
from .quick_mirror import POLYBLOCKER_OT_quick_mirror
from .bump import POLYBLOCKER_OT_bump, POLYBLOCKER_OT_random_bumps
bl_info = {
"name": "PolyBlocker",
"author": "Daniel Boxer",
"description": "Enhanced add mesh menu, cap tool, quick mirror, and more",
"blender": (2, 80, 0),
"version": (1, 3, 1),
"location": "View3D > Ctrl Shift A/C, Alt M",
"category": "Mesh",
}
keymaps = []
classes = (
POLYBLOCKER_OT_add_mesh,
POLYBLOCKER_OT_make_collection,
POLYBLOCKER_OT_cap_tool,
POLYBLOCKER_OT_quick_mirror,
POLYBLOCKER_OT_bump,
POLYBLOCKER_OT_random_bumps,
POLYBLOCKER_MT_pie,
POLYBLOCKER_AP_preferences,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
key_config = bpy.context.window_manager.keyconfigs.addon
if key_config:
keymap = key_config.keymaps.new("3D View", space_type="VIEW_3D")
keymap_item = keymap.keymap_items.new(
"wm.call_menu_pie", type="A", value="PRESS", shift=True, ctrl=True
)
keymap_item.properties.name = "POLYBLOCKER_MT_pie"
keymaps.append((keymap, keymap_item))
keymap_item = keymap.keymap_items.new(
"polyblocker.cap_tool", type="C", value="PRESS", shift=True, ctrl=True
)
keymaps.append((keymap, keymap_item))
keymap_item = keymap.keymap_items.new(
"polyblocker.quick_mirror", type="M", value="PRESS", alt=True
)
keymaps.append((keymap, keymap_item))
def unregister():
for keymap, keymap_item in keymaps:
keymap.keymap_items.remove(keymap_item)
keymaps.clear()
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()