forked from JamesPerlman/TurboNeRF-Blender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
83 lines (58 loc) · 2.31 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
"""
A Blender addon that makes it easy to work with NeRF Datasets
"""
bl_info = {
"name": "TurboNeRF",
# Do not break this line, otherwise the addon can not be activated!
"description": "An artistic tool for working with NeRFs in Blender",
"author": "James Perlman",
"version": (0, 0, 18),
"blender": (3, 0, 0),
"location": "View3D > Sidebar > TurboNeRF",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "3D View",
}
import bpy
import importlib
from turbo_nerf.panels.nerf_object_panel import NeRFObjectPanel
from .utility import developer_utility
importlib.reload(developer_utility)
modules = developer_utility.setup_addon_modules(
__path__, __name__, "bpy" in locals()
)
# The root dir is Blenders addon folder.
# Therefore, we need the "turbo_nerf" specifier for this addon
from turbo_nerf.blender_utility.logging_utility import log_report
from turbo_nerf.panels.nerf_3dview_panels.index import register_nerf_3dview_panels, unregister_nerf_3dview_panels
from turbo_nerf.registration.registration import Registration
from turbo_nerf.renderer.nerf_snapshot_manager import NeRFSnapshotManager
from turbo_nerf.constants import NERF_PATH_ID
@bpy.app.handlers.persistent
def load_handler(dummy):
Registration.register_drivers()
def register():
"""Register importers, exporters and panels."""
Registration.register_importers()
Registration.register_exporters()
bpy.utils.register_class(NeRFObjectPanel)
register_nerf_3dview_panels()
bpy.app.handlers.load_post.append(load_handler)
Registration.register_misc_components()
log_report("INFO", "Registered {} with {} modules".format(bl_info["name"], len(modules)))
def unregister_drivers():
Registration.unregister_drivers()
def unregister():
"""Unregister importers, exporters and panels."""
Registration.unregister_importers()
Registration.unregister_exporters()
unregister_nerf_3dview_panels()
# bpy.utils.unregister_class(NeRFTrainingPanel)
# bpy.utils.unregister_class(NeRFRenderPanel)
bpy.utils.unregister_class(NeRFObjectPanel)
bpy.app.handlers.load_post.remove(load_handler)
Registration.unregister_misc_components()
log_report("INFO", "Unregistered {}".format(bl_info["name"]))
if __name__ == "__main__":
log_report("INFO", "main called")