35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
def main(output: pathlib.Path) -> None:
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
source = pathlib.Path(__file__).resolve().parents[3] / "tests/files/web/media/sequencer-silence.wav"
|
|
sound = bpy.data.sounds.load(str(source), check_existing=False)
|
|
sound.name = "WebGapSpeakerSound"
|
|
sound.use_fake_user = True
|
|
speaker = bpy.data.speakers.new("WebGapSpeaker")
|
|
speaker.sound = sound
|
|
speaker.volume_max = 0.85
|
|
speaker.volume_min = 0.15
|
|
speaker.distance_max = 12.5
|
|
speaker.distance_reference = 2.25
|
|
speaker.attenuation = 0.75
|
|
speaker.cone_angle_outer = 270.0
|
|
speaker.cone_angle_inner = 120.0
|
|
speaker.cone_volume_outer = 0.35
|
|
speaker.volume = 0.65
|
|
speaker.pitch = 1.1
|
|
speaker.use_fake_user = True
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(output.resolve()), check_existing=False, compress=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
|
if len(arguments) != 1:
|
|
raise SystemExit("usage: blender -b --python M16-GAP-00023.py -- OUTPUT")
|
|
main(pathlib.Path(arguments[0]))
|