From cbcb44e2baacc1e7d7fc1fc4b1d3bc64bc653161 Mon Sep 17 00:00:00 2001 From: Ryan Inch Date: Fri, 5 Apr 2024 05:02:21 -0400 Subject: [PATCH] Switch the audio-params override to be disabled by default. Make audio zones and audio targets specifically enable the override because that's their whole purpose. When migrating, check to see if the field is present, if it is then its value is respected otherwise the override is set to true in order to preserve the previous state. --- .../io_hubs_addon/components/definitions/audio_params.py | 9 +++++++-- .../io_hubs_addon/components/definitions/audio_target.py | 4 ++++ .../io_hubs_addon/components/definitions/audio_zone.py | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/io_hubs_addon/components/definitions/audio_params.py b/addons/io_hubs_addon/components/definitions/audio_params.py index f174bc5a..d8d0d3b3 100644 --- a/addons/io_hubs_addon/components/definitions/audio_params.py +++ b/addons/io_hubs_addon/components/definitions/audio_params.py @@ -18,13 +18,13 @@ class AudioParams(HubsComponent): 'display_name': 'Audio Params', 'node_type': NodeType.NODE, 'panel_type': [PanelType.OBJECT, PanelType.BONE], - 'version': (1, 0, 0) + 'version': (1, 0, 1) } overrideAudioSettings: BoolProperty( name="Override Audio Settings", description="Override Audio Settings", - default=True) + default=False) audioType: EnumProperty( name="Audio Type", @@ -119,6 +119,11 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_ migration_report.append( f"Warning: The Media Cone angles may not have migrated correctly for the Audio Params component on the {panel_type.value} {host_reference}") + if instance_version <= (1, 0, 0): + if self.get("overrideAudioSettings") is None: + migration_occurred = True + self.overrideAudioSettings = True + return migration_occurred def draw(self, context, layout, panel): diff --git a/addons/io_hubs_addon/components/definitions/audio_target.py b/addons/io_hubs_addon/components/definitions/audio_target.py index 9be112f4..5592c04e 100644 --- a/addons/io_hubs_addon/components/definitions/audio_target.py +++ b/addons/io_hubs_addon/components/definitions/audio_target.py @@ -122,6 +122,10 @@ class AudioTarget(HubsComponent): description="Show debug visuals", default=False) + @classmethod + def init(cls, obj): + obj.hubs_component_audio_params.overrideAudioSettings = True + def draw(self, context, layout, panel): dep_name = AudioSource.get_name() diff --git a/addons/io_hubs_addon/components/definitions/audio_zone.py b/addons/io_hubs_addon/components/definitions/audio_zone.py index da3324c8..e290a393 100644 --- a/addons/io_hubs_addon/components/definitions/audio_zone.py +++ b/addons/io_hubs_addon/components/definitions/audio_zone.py @@ -61,6 +61,10 @@ def create_gizmo(cls, ob, gizmo_group): return gizmo + @classmethod + def init(cls, obj): + obj.hubs_component_audio_params.overrideAudioSettings = True + def migrate(self, migration_type, panel_type, instance_version, host, migration_report, ob=None): migration_occurred = False if instance_version < (1, 0, 0):