From 71fe4dcdbaadc6fbd5c3a4fa7b0d110bd5b0dd8e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 1 Oct 2017 14:04:28 -0400 Subject: [PATCH] Fix adding sounds to Sound Emitter mods This was not completely converted to the new ID Property scheme, it appears. We have to use an intermediate string property so we can have get/set callbacks. :( --- korman/operators/op_sound.py | 9 ++++----- korman/ui/modifiers/sound.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/korman/operators/op_sound.py b/korman/operators/op_sound.py index 220222b..c61981b 100644 --- a/korman/operators/op_sound.py +++ b/korman/operators/op_sound.py @@ -44,8 +44,9 @@ class PlasmaSoundOpenOperator(SoundOperator, bpy.types.Operator): sound = bpy.data.sounds.load(self.filepath) # Now do the stanky leg^H^H^H^H^H^H^H^H^H^H deed and put the sound on the mod + # NOTE: must use the name so that the mod can receive update callbacks dest = eval(self.data_path) - setattr(dest, self.sound_property, sound) + setattr(dest, self.sound_property, sound.name) return {"FINISHED"} def invoke(self, context, event): @@ -60,8 +61,7 @@ class PlasmaSoundPackOperator(SoundOperator, bpy.types.Operator): def execute(self, context): soundemit = context.active_object.plasma_modifiers.soundemit - sound = bpy.data.sounds.get(soundemit.sounds[soundemit.active_sound_index].sound_data) - sound.pack() + soundemit.sounds[soundemit.active_sound_index].sound.pack() return {"FINISHED"} @@ -80,6 +80,5 @@ class PlasmaSoundUnpackOperator(SoundOperator, bpy.types.Operator): def execute(self, context): soundemit = context.active_object.plasma_modifiers.soundemit - sound = bpy.data.sounds.get(soundemit.sounds[soundemit.active_sound_index].sound_data) - sound.unpack(self.method) + soundemit.sounds[soundemit.active_sound_index].sound.unpack(self.method) return {"FINISHED"} diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index 1997ed6..376a29e 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -52,7 +52,7 @@ def soundemit(modifier, layout, context): row.prop_search(sound, "sound_data_proxy", bpy.data, "sounds", text="") open_op = row.operator("sound.plasma_open", icon="FILESEL", text="") open_op.data_path = repr(sound) - open_op.sound_property = "sound_data" + open_op.sound_property = "sound_data_proxy" # Pack/Unpack data = sound.sound