Skip to content

Commit

Permalink
Switch the audio-params override to be disabled by default.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Exairnous committed Apr 5, 2024
1 parent 7017c5e commit cbcb44e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions addons/io_hubs_addon/components/definitions/audio_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions addons/io_hubs_addon/components/definitions/audio_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions addons/io_hubs_addon/components/definitions/audio_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit cbcb44e

Please sign in to comment.