From 23d0aeb363ce1171652ccf402f653d14cd2a0837 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Sun, 1 Aug 2021 12:40:01 +0200 Subject: [PATCH] Implement suggestions: - syntax improvements - merge both EAX presets lists into one Co-authored-by: Adam Johnson --- korman/properties/modifiers/region.py | 193 ++++++++++++-------------- korman/properties/modifiers/sound.py | 2 +- korman/ui/modifiers/sound.py | 2 +- 3 files changed, 92 insertions(+), 105 deletions(-) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index 1cc9f06..c51db96 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -249,104 +249,97 @@ class PlasmaReverbRegion(PlasmaModifierProperties): ("DRUGGED", "Drugged", ""), ("DIZZY", "Drizzy", ""), ("PSYCHOTIC", "Psychotic", ""), - ("MORE", "More choices...", ""), + ("CASTLE_SMALLROOM", "Castle - Small room", ""), + ("CASTLE_SHORTPASSAGE", "Castle - Short passage", ""), + ("CASTLE_MEDIUMROOM", "Castle - Medium room", ""), + ("CASTLE_LONGPASSAGE", "Castle - Long passage", ""), + ("CASTLE_LARGEROOM", "Castle - Large room", ""), + ("CASTLE_HALL", "Castle - Hall", ""), + ("CASTLE_CUPBOARD", "Castle - Cupboard", ""), + ("CASTLE_COURTYARD", "Castle - Courtyard", ""), + ("CASTLE_ALCOVE", "Castle - Alcove", ""), + ("FACTORY_ALCOVE", "Factory - Alcove", ""), + ("FACTORY_SHORTPASSAGE", "Factory - Short passage", ""), + ("FACTORY_MEDIUMROOM", "Factory - Medium room", ""), + ("FACTORY_LONGPASSAGE", "Factory - Long passage", ""), + ("FACTORY_LARGEROOM", "Factory - Large room", ""), + ("FACTORY_HALL", "Factory - Hall", ""), + ("FACTORY_CUPBOARD", "Factory - Cupboard", ""), + ("FACTORY_COURTYARD", "Factory - Courtyard", ""), + ("FACTORY_SMALLROOM", "Factory - Small room", ""), + ("ICEPALACE_ALCOVE", "Ice palace - Alcove", ""), + ("ICEPALACE_SHORTPASSAGE", "Ice palace - Short passage", ""), + ("ICEPALACE_MEDIUMROOM", "Ice palace - Medium room", ""), + ("ICEPALACE_LONGPASSAGE", "Ice palace - Long passage", ""), + ("ICEPALACE_LARGEROOM", "Ice palace - Large room", ""), + ("ICEPALACE_HALL", "Ice palace - Hall", ""), + ("ICEPALACE_CUPBOARD", "Ice palace - Cupboard", ""), + ("ICEPALACE_COURTYARD", "Ice palace - Courtyard", ""), + ("ICEPALACE_SMALLROOM", "Ice palace - Small room", ""), + ("SPACESTATION_ALCOVE", "Space station - Alcove", ""), + ("SPACESTATION_MEDIUMROOM", "Space station - Medium room", ""), + ("SPACESTATION_SHORTPASSAGE", "Space station - Short passage", ""), + ("SPACESTATION_LONGPASSAGE", "Space station - Long passage", ""), + ("SPACESTATION_LARGEROOM", "Space station - Large room", ""), + ("SPACESTATION_HALL", "Space station - Hall", ""), + ("SPACESTATION_CUPBOARD", "Space station - Cupboard", ""), + ("SPACESTATION_SMALLROOM", "Space station - Small room", ""), + ("WOODEN_ALCOVE", "Wooden alcove", ""), + ("WOODEN_SHORTPASSAGE", "Wooden short passage", ""), + ("WOODEN_MEDIUMROOM", "Wooden medium room", ""), + ("WOODEN_LONGPASSAGE", "Wooden long passage", ""), + ("WOODEN_LARGEROOM", "Wooden large room", ""), + ("WOODEN_HALL", "Wooden hall", ""), + ("WOODEN_CUPBOARD", "Wooden cupboard", ""), + ("WOODEN_SMALLROOM", "Wooden small room", ""), + ("WOODEN_COURTYARD", "Wooden courtyard", ""), + ("SPORT_EMPTYSTADIUM", "Sport - Empty stadium", ""), + ("SPORT_SQUASHCOURT", "Sport - Squash court", ""), + ("SPORT_SMALLSWIMMINGPOOL", "Sport - Small swimming pool", ""), + ("SPORT_LARGESWIMMINGPOOL", "Sport - Large swimming pool", ""), + ("SPORT_GYMNASIUM", "Sport - Gymnasium", ""), + ("SPORT_FULLSTADIUM", "Sport - Full stadium", ""), + ("SPORT_STADIUMTANNOY", "Sport - Stadium tannoy", ""), + ("PREFAB_WORKSHOP", "Prefab - Workshop", ""), + ("PREFAB_SCHOOLROOM", "Prefab - Schoolroom", ""), + ("PREFAB_PRACTISEROOM", "Prefab - Practise room", ""), + ("PREFAB_OUTHOUSE", "Prefab - Outhouse", ""), + ("PREFAB_CARAVAN", "Prefab - Zandi's Trailer", ""), + ("DOME_TOMB", "Tomb dome", ""), + ("DOME_SAINTPAULS", "St Paul's Dome", ""), + ("PIPE_SMALL", "Pipe - small", ""), + ("PIPE_LONGTHIN", "Pipe - long & thin", ""), + ("PIPE_LARGE", "Pipe - large", ""), + ("PIPE_RESONANT", "Pipe - resonant", ""), + ("OUTDOORS_BACKYARD", "Outdoors - Backyard", ""), + ("OUTDOORS_ROLLINGPLAINS", "Outdoors - Rolling plains", ""), + ("OUTDOORS_DEEPCANYON", "Outdoors - Deep canyon", ""), + ("OUTDOORS_CREEK", "Outdoors - Creek", ""), + ("OUTDOORS_VALLEY", "Outdoors - Valley", ""), + ("MOOD_HEAVEN", "Mood - Heaven", ""), + ("MOOD_HELL", "Mood - Hell", ""), + ("MOOD_MEMORY", "Mood - Memory", ""), + ("DRIVING_COMMENTATOR", "Driving - Commentator", ""), + ("DRIVING_PITGARAGE", "Driving - In pit garage", ""), + ("DRIVING_INCAR_RACER", "Driving - In racer car", ""), + ("DRIVING_INCAR_SPORTS", "Driving - In sports car", ""), + ("DRIVING_INCAR_LUXURY", "Driving - In luxury car", ""), + ("DRIVING_FULLGRANDSTAND", "Driving - Full grand stand", ""), + ("DRIVING_EMPTYGRANDSTAND", "Driving - Empty grand stand", ""), + ("DRIVING_TUNNEL", "Driving - Tunnel", ""), + ("CITY_STREETS", "City - Streets", ""), + ("CITY_SUBWAY", "City - Subway", ""), + ("CITY_MUSEUM", "City - Museum", ""), + ("CITY_LIBRARY", "City - Library", ""), + ("CITY_UNDERPASS", "City - Underpass", ""), + ("CITY_ABANDONED", "City - Abandoned", ""), + ("DUSTYROOM", "Dusty room", ""), + ("CHAPEL", "Chapel", ""), + ("SMALLWATERROOM", "Small water room", ""), ("CUSTOM", "Custom", "Setup your own environment")], default="GENERIC", options=set()) - # Thicc list for annoying users. - preset_more = EnumProperty(name="More Environment Preset", - description="Some more environment presets for your convenience", - items=[("CASTLE_SMALLROOM", "Castle - Small room", ""), - ("CASTLE_SHORTPASSAGE", "Castle - Short passage", ""), - ("CASTLE_MEDIUMROOM", "Castle - Medium room", ""), - ("CASTLE_LONGPASSAGE", "Castle - Long passage", ""), - ("CASTLE_LARGEROOM", "Castle - Large room", ""), - ("CASTLE_HALL", "Castle - Hall", ""), - ("CASTLE_CUPBOARD", "Castle - Cupboard", ""), - ("CASTLE_COURTYARD", "Castle - Courtyard", ""), - ("CASTLE_ALCOVE", "Castle - Alcove", ""), - ("FACTORY_ALCOVE", "Factory - Alcove", ""), - ("FACTORY_SHORTPASSAGE", "Factory - Short passage", ""), - ("FACTORY_MEDIUMROOM", "Factory - Medium room", ""), - ("FACTORY_LONGPASSAGE", "Factory - Long passage", ""), - ("FACTORY_LARGEROOM", "Factory - Large room", ""), - ("FACTORY_HALL", "Factory - Hall", ""), - ("FACTORY_CUPBOARD", "Factory - Cupboard", ""), - ("FACTORY_COURTYARD", "Factory - Courtyard", ""), - ("FACTORY_SMALLROOM", "Factory - Small room", ""), - ("ICEPALACE_ALCOVE", "Ice palace - Alcove", ""), - ("ICEPALACE_SHORTPASSAGE", "Ice palace - Short passage", ""), - ("ICEPALACE_MEDIUMROOM", "Ice palace - Medium room", ""), - ("ICEPALACE_LONGPASSAGE", "Ice palace - Long passage", ""), - ("ICEPALACE_LARGEROOM", "Ice palace - Large room", ""), - ("ICEPALACE_HALL", "Ice palace - Hall", ""), - ("ICEPALACE_CUPBOARD", "Ice palace - Cupboard", ""), - ("ICEPALACE_COURTYARD", "Ice palace - Courtyard", ""), - ("ICEPALACE_SMALLROOM", "Ice palace - Small room", ""), - ("SPACESTATION_ALCOVE", "Space station - Alcove", ""), - ("SPACESTATION_MEDIUMROOM", "Space station - Medium room", ""), - ("SPACESTATION_SHORTPASSAGE", "Space station - Short passage", ""), - ("SPACESTATION_LONGPASSAGE", "Space station - Long passage", ""), - ("SPACESTATION_LARGEROOM", "Space station - Large room", ""), - ("SPACESTATION_HALL", "Space station - Hall", ""), - ("SPACESTATION_CUPBOARD", "Space station - Cupboard", ""), - ("SPACESTATION_SMALLROOM", "Space station - Small room", ""), - ("WOODEN_ALCOVE", "Wooden alcove", ""), - ("WOODEN_SHORTPASSAGE", "Wooden short passage", ""), - ("WOODEN_MEDIUMROOM", "Wooden medium room", ""), - ("WOODEN_LONGPASSAGE", "Wooden long passage", ""), - ("WOODEN_LARGEROOM", "Wooden large room", ""), - ("WOODEN_HALL", "Wooden hall", ""), - ("WOODEN_CUPBOARD", "Wooden cupboard", ""), - ("WOODEN_SMALLROOM", "Wooden small room", ""), - ("WOODEN_COURTYARD", "Wooden courtyard", ""), - ("SPORT_EMPTYSTADIUM", "Sport - Empty stadium", ""), - ("SPORT_SQUASHCOURT", "Sport - Squash court", ""), - ("SPORT_SMALLSWIMMINGPOOL", "Sport - Small swimming pool", ""), - ("SPORT_LARGESWIMMINGPOOL", "Sport - Large swimming pool", ""), - ("SPORT_GYMNASIUM", "Sport - Gymnasium", ""), - ("SPORT_FULLSTADIUM", "Sport - Full stadium", ""), - ("SPORT_STADIUMTANNOY", "Sport - Stadium tannoy", ""), - ("PREFAB_WORKSHOP", "Prefab - Workshop", ""), - ("PREFAB_SCHOOLROOM", "Prefab - Schoolroom", ""), - ("PREFAB_PRACTISEROOM", "Prefab - Practise room", ""), - ("PREFAB_OUTHOUSE", "Prefab - Outhouse", ""), - ("PREFAB_CARAVAN", "Prefab - Zandi's Trailer", ""), - ("DOME_TOMB", "Tomb dome", ""), - ("DOME_SAINTPAULS", "St Paul's Dome", ""), - ("PIPE_SMALL", "Pipe - small", ""), - ("PIPE_LONGTHIN", "Pipe - long & thin", ""), - ("PIPE_LARGE", "Pipe - large", ""), - ("PIPE_RESONANT", "Pipe - resonant", ""), - ("OUTDOORS_BACKYARD", "Outdoors - Backyard", ""), - ("OUTDOORS_ROLLINGPLAINS", "Outdoors - Rolling plains", ""), - ("OUTDOORS_DEEPCANYON", "Outdoors - Deep canyon", ""), - ("OUTDOORS_CREEK", "Outdoors - Creek", ""), - ("OUTDOORS_VALLEY", "Outdoors - Valley", ""), - ("MOOD_HEAVEN", "Mood - Heaven", ""), - ("MOOD_HELL", "Mood - Hell", ""), - ("MOOD_MEMORY", "Mood - Memory", ""), - ("DRIVING_COMMENTATOR", "Driving - Commentator", ""), - ("DRIVING_PITGARAGE", "Driving - In pit garage", ""), - ("DRIVING_INCAR_RACER", "Driving - In racer car", ""), - ("DRIVING_INCAR_SPORTS", "Driving - In sports car", ""), - ("DRIVING_INCAR_LUXURY", "Driving - In luxury car", ""), - ("DRIVING_FULLGRANDSTAND", "Driving - Full grand stand", ""), - ("DRIVING_EMPTYGRANDSTAND", "Driving - Empty grand stand", ""), - ("DRIVING_TUNNEL", "Driving - Tunnel", ""), - ("CITY_STREETS", "City - Streets", ""), - ("CITY_SUBWAY", "City - Subway", ""), - ("CITY_MUSEUM", "City - Museum", ""), - ("CITY_LIBRARY", "City - Library", ""), - ("CITY_UNDERPASS", "City - Underpass", ""), - ("CITY_ABANDONED", "City - Abandoned", ""), - ("DUSTYROOM", "Dusty room", ""), - ("CHAPEL", "Chapel", ""), - ("SMALLWATERROOM", "Small water room", "")], - default="OUTDOORS_ROLLINGPLAINS", - options=set()) - environment_size = FloatProperty(name="Environment Size", description="Environment Size", default=7.5, min=1.0, max=100.0, options=set()) @@ -405,15 +398,11 @@ class PlasmaReverbRegion(PlasmaModifierProperties): default=250.0, min=20.0, max=1000.0, options=set()) - # Room rolloff - always at 0 in all presets, so screw it. - # room_rolloff_factor = FloatProperty(name="Room Rolloff Factor", description="Room Rolloff Factor", - # default=0.0, min=0.0, max=1.0) - flags = EnumProperty(name="Flags", description="Reverb flags", items=reverb_flags, - default={ "kFlagDecayTimeScale", "kFlagReflectionsScale", "kFlagReflectionsDelayScale", - "kFlagReverbScale", "kFlagReverbDelayScale", "kFlagEchoTimeScale" }, + default={"kFlagDecayTimeScale", "kFlagReflectionsScale", "kFlagReflectionsDelayScale", + "kFlagReverbScale", "kFlagReverbDelayScale", "kFlagEchoTimeScale"}, options={"ENUM_FLAG"}) def export(self, exporter, bo, so): @@ -445,10 +434,8 @@ class PlasmaReverbRegion(PlasmaModifierProperties): for flag in self.flags: props.flags |= getattr(EAXReverbProperties, flag) eax_listener.listenerProps = props - elif self.preset == "MORE": - eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset_more) else: - eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset) + eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_{}".format(self.preset)) class PlasmaSoftVolume(idprops.IDPropMixin, PlasmaModifierProperties): diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index ff99fd7..1025d40 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -297,7 +297,7 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): sound.channel = plWin32Sound.kRightChannel # Reverb/EAX - if self.sfx_type in ("kSoundFX", "kNPCVoices") and self.reverb_amount > 0: + if self.sfx_type in {"kSoundFX", "kNPCVoices"} and self.reverb_amount > 0: eax = sound.eaxSettings eax.enable = True # Occlusion: the minimum is -100 dB (but the value is multiplied by 100 in EAX's API) diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index e2569bb..b0f9692 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -83,7 +83,7 @@ def soundemit(modifier, layout, context): col.separator() _draw_fade_ui(sound.fade_out, col, "Fade Out:") - if sound.sfx_type in ("kSoundFX", "kNPCVoices"): + if sound.sfx_type in {"kSoundFX", "kNPCVoices"}: col.separator() col.prop(sound, "reverb_amount", text="Reverb Amount")