Browse Source

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. :(
pull/73/head
Adam Johnson 7 years ago
parent
commit
71fe4dcdba
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 9
      korman/operators/op_sound.py
  2. 2
      korman/ui/modifiers/sound.py

9
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"}

2
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

Loading…
Cancel
Save