-
Notifications
You must be signed in to change notification settings - Fork 8
/
__init__.py
90 lines (81 loc) · 2.71 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
81
82
83
84
85
86
87
88
89
90
import bpy
import os
import sys
# current_folder = os.path.dirname(os.path.abspath(__file__))
# if current_folder not in sys.path:
# sys.path.append(current_folder)
# # add paths of external libraries to sys.path
# if os.path.exists(os.path.join(current_folder, "extern")):
# external_libs = ["fileseq/src", "meshio/src", "python-future/src", "rich"]
# for lib in external_libs:
# lib_path = os.path.join(current_folder, "extern", lib)
# if lib_path not in sys.path:
# sys.path.append(lib_path)
# if bpy.context.preferences.filepaths.use_relative_paths == True:
# bpy.context.preferences.filepaths.use_relative_paths = False
from .bseq import *
from .bseq.operators import menu_func_import, add_keymap, delete_keymap
classes = [
BSEQ_obj_property,
BSEQ_scene_property,
BSEQ_mesh_property,
BSEQ_OT_load,
BSEQ_OT_edit,
BSEQ_OT_resetpt,
BSEQ_OT_resetins,
BSEQ_OT_resetmesh,
BSEQ_PT_Import,
BSEQ_PT_Import_Child1,
BSEQ_PT_Import_Child2,
BSEQ_Globals_Panel,
BSEQ_List_Panel,
BSEQ_UL_Obj_List,
BSEQ_Settings,
BSEQ_Advanced_Panel,
BSEQ_Templates,
BSEQ_UL_Att_List,
BSEQ_OT_set_as_split_norm,
BSEQ_OT_remove_split_norm,
BSEQ_OT_disable_selected,
BSEQ_OT_enable_selected,
BSEQ_OT_refresh_seq,
BSEQ_OT_disable_all,
BSEQ_OT_enable_all,
BSEQ_OT_refresh_sequences,
BSEQ_OT_set_start_end_frames,
BSEQ_OT_batch_sequences,
BSEQ_PT_batch_sequences_settings,
BSEQ_OT_meshio_object,
# BSEQ_OT_import_zip,
# BSEQ_OT_delete_zips,
# BSEQ_addon_preferences,
BSEQ_OT_load_all,
BSEQ_OT_load_all_recursive
]
def register():
bpy.app.handlers.load_post.append(BSEQ_initialize)
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.TEXT_MT_templates.append(draw_template)
bpy.types.Scene.BSEQ = bpy.props.PointerProperty(type=BSEQ_scene_property)
bpy.types.Object.BSEQ = bpy.props.PointerProperty(type=BSEQ_obj_property)
bpy.types.Mesh.BSEQ = bpy.props.PointerProperty(type=BSEQ_mesh_property)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
add_keymap()
# manually call this function once
# so when addon being installed, it can run correctly
# because scene is not used, so pass None into it
BSEQ_initialize(None)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
bpy.types.TEXT_MT_templates.remove(draw_template)
del bpy.types.Scene.BSEQ
del bpy.types.Object.BSEQ
bpy.app.handlers.load_post.remove(BSEQ_initialize)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
delete_keymap()
unsubscribe_to_selected()
if __name__ == "__main__":
# unregister()
register()