|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
import bpy |
|
|
|
|
from bpy.props import * |
|
|
|
|
from bpy.app.handlers import persistent |
|
|
|
|
from contextlib import contextmanager |
|
|
|
|
import math |
|
|
|
|
from PyHSPlasma import * |
|
|
|
|
|
|
|
|
@ -39,7 +40,19 @@ class PlasmaSfxFade(bpy.types.PropertyGroup):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): |
|
|
|
|
@contextmanager |
|
|
|
|
def _lock_sound(self): |
|
|
|
|
exclusive = not self.updating_sound |
|
|
|
|
self.updating_sound = True |
|
|
|
|
try: |
|
|
|
|
yield exclusive |
|
|
|
|
finally: |
|
|
|
|
if exclusive: |
|
|
|
|
self.updating_sound = False |
|
|
|
|
|
|
|
|
|
def _update_sound(self, value): |
|
|
|
|
with self._lock_sound() as exclusive: |
|
|
|
|
if exclusive: |
|
|
|
|
if not value: |
|
|
|
|
self.name = "[Empty]" |
|
|
|
|
return |
|
|
|
@ -67,6 +80,8 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup):
|
|
|
|
|
description="Sound Datablock", |
|
|
|
|
type=bpy.types.Sound, |
|
|
|
|
update=_update_sound) |
|
|
|
|
updating_sound = BoolProperty(default=False, |
|
|
|
|
options={"HIDDEN", "SKIP_SAVE"}) |
|
|
|
|
|
|
|
|
|
is_stereo = BoolProperty(default=True, options={"HIDDEN"}) |
|
|
|
|
is_valid = BoolProperty(default=False, options={"HIDDEN"}) |
|
|
|
|