Browse Source

Add workaround for sound upgrade recursion error.

pull/183/head
Adam Johnson 5 years ago
parent
commit
88f4e6a624
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 15
      korman/properties/modifiers/sound.py

15
korman/properties/modifiers/sound.py

@ -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"})

Loading…
Cancel
Save