2020-03-20 14:56:50 +01:00
|
|
|
# ##### 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
|
2019-11-04 17:55:41 +01:00
|
|
|
import bpy
|
|
|
|
import mathutils
|
|
|
|
|
2020-04-01 11:37:05 +02:00
|
|
|
from .dump_anything import Loader, Dumper
|
2019-11-04 17:55:41 +01:00
|
|
|
from .bl_datablock import BlDatablock
|
|
|
|
|
|
|
|
|
|
|
|
class BlSpeaker(BlDatablock):
|
2020-01-13 18:51:31 +01:00
|
|
|
bl_id = "speakers"
|
|
|
|
bl_class = bpy.types.Speaker
|
2020-09-17 22:47:11 +02:00
|
|
|
bl_check_common = False
|
2020-01-13 18:51:31 +01:00
|
|
|
bl_icon = 'SPEAKER'
|
2020-12-09 14:49:26 +01:00
|
|
|
bl_reload_parent = False
|
2020-01-13 18:51:31 +01:00
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def load(data: dict, datablock: object):
|
2020-04-01 11:34:24 +02:00
|
|
|
loader = Loader()
|
|
|
|
loader.load(target, data)
|
2019-11-04 17:55:41 +01:00
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def construct(data: dict) -> object:
|
2019-11-04 17:55:41 +01:00
|
|
|
return bpy.data.speakers.new(data["name"])
|
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def dump(datablock: object) -> dict:
|
2020-04-07 14:49:43 +02:00
|
|
|
assert(instance)
|
2019-11-04 17:55:41 +01:00
|
|
|
|
2020-04-01 11:34:24 +02:00
|
|
|
dumper = Dumper()
|
2019-11-04 17:55:41 +01:00
|
|
|
dumper.depth = 1
|
|
|
|
dumper.include_filter = [
|
|
|
|
"muted",
|
|
|
|
'volume',
|
|
|
|
'name',
|
|
|
|
'pitch',
|
2020-09-19 00:47:46 +02:00
|
|
|
'sound',
|
2019-11-04 17:55:41 +01:00
|
|
|
'volume_min',
|
|
|
|
'volume_max',
|
|
|
|
'attenuation',
|
|
|
|
'distance_max',
|
|
|
|
'distance_reference',
|
|
|
|
'cone_angle_outer',
|
|
|
|
'cone_angle_inner',
|
|
|
|
'cone_volume_outer'
|
|
|
|
]
|
|
|
|
|
2020-04-07 14:49:43 +02:00
|
|
|
return dumper.dump(instance)
|
2019-11-04 17:55:41 +01:00
|
|
|
|
2021-03-25 14:55:53 +01:00
|
|
|
@staticmethod
|
2021-03-26 12:30:15 +01:00
|
|
|
def resolve_deps(datablock: object) -> [object]:
|
2020-09-19 00:47:46 +02:00
|
|
|
deps = []
|
|
|
|
|
2021-03-25 14:55:53 +01:00
|
|
|
sound = datablock.sound
|
2020-09-19 00:47:46 +02:00
|
|
|
|
|
|
|
if sound:
|
|
|
|
deps.append(sound)
|
|
|
|
|
|
|
|
return deps
|
2020-03-09 15:59:30 +01:00
|
|
|
|
2019-11-04 17:55:41 +01:00
|
|
|
|