diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index 00f289a..3bb9346 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -155,6 +155,17 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): fade_in = PointerProperty(type=PlasmaSfxFade, options=set()) fade_out = PointerProperty(type=PlasmaSfxFade, options=set()) + + random = BoolProperty(name="Random", default=False, options=set()) + min_delay = FloatProperty(name="Minimum Delay", + description="Minimum number of seconds before playing", + default=1.0, min=0.0, + options=set(), subtype="TIME", unit="TIME") + max_delay = FloatProperty(name="Maximum Delay", + description="Maximum number of seconds before playing", + default=1.0, min=0.0, + options=set(), subtype="TIME", unit="TIME") + def _get_package_value(self): if self.sound is not None: self.package_value = self.sound.plasma_sound.package @@ -286,6 +297,12 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): else: sound.channel = plWin32Sound.kRightChannel + # Add RandomSound modifier for this SO if requested + if self.random: + rsm = exporter.mgr.find_create_object(plRandomSoundMod, so=so, name=name) + rsm.minDelay = self.min_delay + rsm.maxDelay = self.max_delay + # Whew, that was a lot of work! return sound.key diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index f80fae6..19d2921 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -83,6 +83,11 @@ def soundemit(modifier, layout, context): col.separator() _draw_fade_ui(sound.fade_out, col, "Fade Out:") + col.separator() + col.prop(sound, "random") + col.prop(sound, "min_delay") + col.prop(sound, "max_delay") + col = split.column() col.label("Cone Effect:") col.prop(sound, "inner_cone")