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