-
Notifications
You must be signed in to change notification settings - Fork 7
/
__init__.py
executable file
·223 lines (203 loc) · 8.27 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#====================== BEGIN GPL LICENSE BLOCK ======================
#
# 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 2
# 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, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#======================= END GPL LICENSE BLOCK ========================
bl_info = {
"name": "EVERTims, real-time auralization framework",
"author": "David Poirier-Quinot",
"version": (0, 1),
"blender": (2, 7, 8),
"location": "3D View > Toolbox",
"description": "A collection of tools to configure your EVERTims environment.",
"warning": "",
'tracker_url': "https://evertims.github.io/#contact",
"wiki_url": "https://evertims.github.io",
'support': 'COMMUNITY',
"category": "Game Engine"
}
if "bpy" in locals():
import importlib
importlib.reload(ui)
else:
import bpy
import os
from bpy.props import (
StringProperty,
EnumProperty,
BoolProperty,
IntProperty,
FloatProperty,
PointerProperty
)
from bpy.types import (
PropertyGroup,
AddonPreferences
)
from . import (
ui,
operators
)
import imp
# tag update required when changing mat file
def updateMatFileCallback(self, context):
evertims = context.scene.evertims
evertims.mat_list_need_update = True
class EVERTimsSettings(PropertyGroup):
enable_bge = BoolProperty(
name="Enable EVERTims",
description='Activate EVERTims module in BGE',
default=False,
)
enable_edit_mode = BoolProperty(
name="Enable EVERTims in EDIT mode",
description='Activate real-time update of the EVERTims client from Blender outside the BGE (in casual edit mode)',
default=False,
)
debug_logs_raytracing = BoolProperty(
name="Print Raytracing Logs",
description='Print raytracing client logs in Blender console',
default=False,
)
debug_rays = BoolProperty(
name="Draw Rays",
description='Enable visual feedback on EVERTims raytracing in Blender',
default=True,
)
debug_logs = BoolProperty(
name="Print Logs",
description='Print logs of the EVERTims python module in Blender console',
default=False,
)
movement_threshold_loc = FloatProperty(
name="Movement threshold location",
description="Minimum value a listener / source must move to be updated on EVERTims client",
default=0.1,
)
movement_threshold_rot = FloatProperty(
name="Movement threshold rotation",
description="Minimum value a listener / source must rotate to be updated on EVERTims client",
default=1,
)
ip_local = StringProperty(
name="IP local",
description="IP of the computer running Blender",
default="127.0.0.1", maxlen=1024,
)
ip_raytracing = StringProperty(
name="IP EVERTims client",
description="IP of the computer running the EVERTims raytracing client",
default="127.0.0.1", maxlen=1024,
)
port_write_raytracing = IntProperty(
name="Port write",
description="Port used by EVERTims raytracing client to read data sent by the Blender",
default=3858,
)
port_read = IntProperty(
name="Port read",
description="Port used by Blender to read data sent by the EVERTims raytracing client",
default=3862,
)
# EVERTims Raytracing client properties
enable_raytracing_client = BoolProperty(
name="Launch EVERTims raytracing client",
description='Launch the EVERTims raytracing client as a subprocess (embedded in Blender)',
default=False,
)
ip_auralization = StringProperty(
name="IP EVERTims auralization client",
description="IP of the computer running the EVERTims auralization client",
default="127.0.0.1", maxlen=1024,
)
port_write_auralization = IntProperty(
name="Port EVERTims auralization client",
description="Port used by the auralization client to read data sent by the raytracing client",
default=3860,
)
min_reflection_order = IntProperty(
name="Min reflection order",
description="Min reflection order passed to the embedded EVERTims client",
default=1,
)
max_reflection_order = IntProperty(
name="Max reflection order",
description="Max reflection order passed to the embedded EVERTims client",
default=2,
)
# EVERTims auralization client properties
enable_auralization_client = BoolProperty(
name="Launch EVERTims auralization client",
description='Launch the EVERTims auralization client as a subprocess (embedded in Blender)',
default=False,
)
# EVERTims elements
room_object = StringProperty(
name="Room",
description="Current room selected for auralization",
default="", maxlen=1024,
)
listener_object = StringProperty(
name="Listener",
description="Current listener selected for auralization",
default="", maxlen=1024,
)
source_object = StringProperty(
name="Source",
description="Current source selected for auralization",
default="", maxlen=1024,
)
mat_list = StringProperty(
name="Material List",
description="A string of all available materials, displayed in GUI",
default="", maxlen=0, # unlimited length
)
mat_list_need_update = BoolProperty(
name="Check whether mat_list need update of not",
description='',
default=True,
)
class EVERTimsPreferences(AddonPreferences):
bl_idname = __name__
raytracing_client_path_to_binary = StringProperty(
name="EVERTims Raytracing client binary path",
description="Path to the ims binary that handles EVERTims raytracing",
default="//", maxlen=1024, subtype="FILE_PATH",
)
raytracing_client_path_to_matFile = StringProperty(
name="EVERTims Raytracing client material path",
description="Path to the .mat file used by the EVERTims raytracing client",
default="//", maxlen=1024, subtype="FILE_PATH", update = updateMatFileCallback,
)
auralization_client_path_to_binary = StringProperty(
name="EVERTims auralization client binary path",
description="Path to the binary that handles EVERTims auralization",
default="//", maxlen=1024, subtype="FILE_PATH",
)
# ############################################################
# Un/Registration
# ############################################################
def register():
bpy.utils.register_class(EVERTimsSettings)
bpy.utils.register_class(EVERTimsPreferences)
ui.register()
operators.register()
bpy.types.Scene.evertims = PointerProperty(type=EVERTimsSettings)
def unregister():
bpy.utils.unregister_class(EVERTimsSettings)
bpy.utils.unregister_class(EVERTimsPreferences)
ui.unregister()
operators.unregister()
del bpy.types.Scene.evertims