-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path__init__.py
67 lines (53 loc) · 1.5 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
# Blender addon sorcery
bl_info = {
"name": "Audionodes",
"description": "Create complex soundscapes in real time using nodes.",
"author": "Roope Salmi, Théo Friberg",
"version": (0,3,4),
"blender": (2,80,0),
"location": "Node Editor > Sound Icon > Add new",
"warning": "Very much alpha, may blow up in your face.",
"category": "Node",
"tracker_url": "https://github.com/nomelif/Audionodes/issues",
"wiki_url": "https://github.com/nomelif/Audionodes/wiki"
}
# Move all of this into blender/__init__.py?
import bpy
import time
from bpy.types import NodeTree, Node, NodeSocket, NodeSocketFloat
from struct import pack
from array import array
import threading
import wave
import struct
import tempfile
import platform
from . import blender
node_tree = blender.node_tree
ffi = blender.ffi
def register():
blender.register()
ffi.initialize()
def unregister():
ffi.cleanup()
blender.unregister()
import atexit
def exit_handler():
ffi.cleanup()
atexit.register(exit_handler)
from bpy.app.handlers import persistent
@persistent
def pre_load_handler(_):
ffi.flag_loading_file = True
ffi.cleanup()
@persistent
def post_load_handler(_):
ffi.initialize()
ffi.flag_loading_file = False
for tree in bpy.data.node_groups:
if type(tree) == node_tree.AudioTree:
tree.post_load_handler()
bpy.app.handlers.load_pre.append(pre_load_handler)
bpy.app.handlers.load_post.append(post_load_handler)
if __name__ == "__main__":
register()