From 539e2743671012c2e1fbe07808ebcf3808e4af06 Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Mon, 14 Feb 2022 14:30:04 -0500 Subject: [PATCH] Add random sound check Random sound mods mixed with local only cause problems, so we raise an error message if that happens. --- korman/properties/modifiers/sound.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index f885694..219ac6e 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -373,7 +373,12 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): if self.incidental: sound.properties |= plSound.kPropIncidental if self.local_only: - sound.properties |= plSound.kPropLocalOnly + # Local only and random sounds hate each other, so we must check for both + for i in bpy.data.objects: + if i.plasma_modifiers.random_sound: + raise ExportError("SoundEmitter '{}': cannot have local only sounds and a random sound mod.".format(self.id_data.name)) + else: + sound.properties |= plSound.kPropLocalOnly sound.dataBuffer = self._find_sound_buffer(exporter, so, wavHeader, dataSize, channel) # Cone effect