-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
69 lines (57 loc) · 2.1 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
bl_info = {
"name": "DispMapping",
"author": "Derek Wang",
"version": (1, 0, 2),
"blender": (3, 2, 0),
"location": "N PANEL",
"description": "Blender API 插件开发QQ交流群:735831986,微信:wx_frame3d",
"warning": "",
"wiki_url": "https://www.bilibili.com/video/BV1Y54y1M7GP/",
"category": "DispMapping",
}
import bpy
from bpy.props import BoolProperty, EnumProperty, FloatProperty, IntProperty, PointerProperty, StringProperty
from .properties import DMMISCSettings
from .operators import myoperator
from .ui import DM_PT_First_Panel, DM_PT_Second_Panel, DM_User_Preferences
classes = (
DMMISCSettings,
DM_PT_First_Panel,
DM_PT_Second_Panel,
DM_User_Preferences,
myoperator.Translate_OT_Col_to_New_Location,
myoperator.Apply_OT_Obj_All_Transforms,
myoperator.Add_OT_Non_PBR_Mat,
myoperator.Add_OT_DM_to_Mesh_Object,
)
addon_keymaps = []
def register():
bpy.app.handlers.depsgraph_update_post.clear()
bpy.app.handlers.save_pre.clear()
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.dm_misc_settings = PointerProperty(type=DMMISCSettings)
wm = bpy.context.window_manager
#Window manager data-block defining open windows and other user interface data
if wm.keyconfigs.addon:
#Key maps configured as part of this configuration
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
#Items in the keymap, linking an operator to an input event
kmi = km.keymap_items.new('wm.call_panel', 'Y', 'PRESS',
# alt=False
)
kmi.properties.name = "ADDON_MISC_PT_DM_PANEL"
#kmi.properties.name = "EXAMPLE_PT_panel_1"
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
del bpy.types.Scene.dm_misc_settings
if __name__ == '__main__':
register()