diff --git a/korman/properties/__init__.py b/korman/properties/__init__.py index 741a519..fa3b5e4 100644 --- a/korman/properties/__init__.py +++ b/korman/properties/__init__.py @@ -21,6 +21,7 @@ from .prop_lamp import * from . import modifiers from .prop_object import * from .prop_scene import * +from .prop_sound import * from .prop_text import * from .prop_texture import * from .prop_world import * @@ -33,6 +34,7 @@ def register(): bpy.types.Object.plasma_net = bpy.props.PointerProperty(type=PlasmaNet) bpy.types.Object.plasma_object = bpy.props.PointerProperty(type=PlasmaObject) bpy.types.Scene.plasma_scene = bpy.props.PointerProperty(type=PlasmaScene) + bpy.types.Sound.plasma_sound = bpy.props.PointerProperty(type=PlasmaSound) bpy.types.Text.plasma_text = bpy.props.PointerProperty(type=PlasmaText) bpy.types.Texture.plasma_layer = bpy.props.PointerProperty(type=PlasmaLayer) bpy.types.World.plasma_age = bpy.props.PointerProperty(type=PlasmaAge) diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index ec4482b..bacfe5c 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -154,6 +154,24 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): fade_in = PointerProperty(type=PlasmaSfxFade, options=set()) fade_out = PointerProperty(type=PlasmaSfxFade, options=set()) + def _get_package_value(self): + if self.sound is not None: + self.package_value = self.sound.plasma_sound.package + return self.package_value + + def _set_package_value(self, value): + if self.sound is not None: + self.sound.plasma_sound.package = value + + # This is really a property of the sound itself, not of this particular emitter instance. + # However, to prevent weird UI inconsistencies where the button might be missing or change + # states when clearing the sound pointer, we'll cache the actual value here. + package = BoolProperty(name="Export", + description="Package this file in the age export", + get=_get_package_value, set=_set_package_value, + options=set()) + package_value = BoolProperty(options={"HIDDEN", "SKIP_SAVE"}) + @property def channel_override(self): if self.is_stereo and len(self.channel) == 1: @@ -166,7 +184,8 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): length = dataSize / header.avgBytesPerSec # HAX: Ensure that the sound file is copied to game, if applicable. - exporter.output.add_sfx(self._sound) + if self._sound.plasma_sound.package: + exporter.output.add_sfx(self._sound) # There is some bug in the MOUL code that causes a crash if this does not match the expected # result. There's no sense in debugging that though--the user should never specify diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index e51b383..af5020a 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -40,8 +40,11 @@ def soundemit(modifier, layout, context): except: pass else: + split = layout.split(percentage=0.75) + col = split.column() + # Sound datablock picker - row = layout.row(align=True) + row = col.row(align=True) 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) @@ -55,6 +58,10 @@ def soundemit(modifier, layout, context): else: row.operator_menu_enum("sound.plasma_unpack", "method", icon="PACKAGE", text="") + col = split.column() + col.enabled = data is not None + col.prop(sound, "package", text="Export") + # If an invalid sound data block is spec'd, let them know about it. if data and not sound.is_valid: layout.label(text="Invalid sound specified", icon="ERROR")