Skip to content

Commit

Permalink
Use the object directly when getting the host reference message for b…
Browse files Browse the repository at this point in the history
…ones.

Switch from attempting to get the object from the id_data to passing in
the object directly.  Using the id_data actually returned the armature,
in this case, rather than the object.
  • Loading branch information
Exairnous committed Dec 16, 2022
1 parent 48c39cd commit d426486
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_
self.coneOuterAngle)

if migration_type != MigrationType.GLOBAL or is_linked(ob):
host_reference = get_host_reference_message(panel_type, host)
host_reference = get_host_reference_message(panel_type, host, ob=ob)
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}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_
track.track_type = track_type

if migration_warning:
host_reference = get_host_reference_message(panel_type, host)
host_reference = get_host_reference_message(panel_type, host, ob=ob)
migration_report.append(
f"Warning: The Loop Animation component on the {panel_type.value} {host_reference} may not have migrated correctly")

Expand Down
2 changes: 1 addition & 1 deletion addons/io_hubs_addon/components/definitions/media_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_
self.bounds = bounds

if migration_type != MigrationType.GLOBAL or is_linked(ob):
host_reference = get_host_reference_message(panel_type, host)
host_reference = get_host_reference_message(panel_type, host, ob=ob)
migration_report.append(
f"Warning: The Media Frame component's Y and Z bounds on the {panel_type.value} {host_reference} may not have migrated correctly")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def poll(cls, panel_type, host, ob=None):
return False

@classmethod
def get_unsupported_host_message(cls, panel_type, host):
def get_unsupported_host_message(cls, panel_type, host, ob=None):
if panel_type == PanelType.BONE:
host_reference = f"\"{host.name}\" in \"{host.id_data.name_full}\""
host_reference = f"\"{host.name}\" in \"{ob.name_full}\""
object_message = ""
else:
host_reference = f"\"{host.name_full}\""
Expand Down
2 changes: 1 addition & 1 deletion addons/io_hubs_addon/components/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def migrate(component, migration_type, panel_type, host, migration_report, ob=No
component.instance_version = definition_version

if panel_type not in component.__class__.get_panel_type() or not component.__class__.poll(panel_type, host, ob=ob):
message = component.__class__.get_unsupported_host_message(panel_type, host)
message = component.__class__.get_unsupported_host_message(panel_type, host, ob=ob)
migration_report.append(message)

return was_migrated
Expand Down
4 changes: 2 additions & 2 deletions addons/io_hubs_addon/components/hubs_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ def poll(cls, panel_type, host, ob=None):
return True

@classmethod
def get_unsupported_host_message(cls, panel_type, host):
def get_unsupported_host_message(cls, panel_type, host, ob=None):
'''This method will return the message to use if this component isn't supported on this host.
This is currently called during migrations.'''
from .utils import get_host_reference_message
host_reference = get_host_reference_message(panel_type, host)
host_reference = get_host_reference_message(panel_type, host, ob=ob)
host_type = panel_type.value
message = f"Warning: Unsupported component on {host_type} {host_reference}, {host_type}s don't support {cls.get_display_name()} components"

Expand Down
4 changes: 2 additions & 2 deletions addons/io_hubs_addon/components/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ def display_wrapped_text(layout, wrapped_text, *, heading_icon='NONE'):
text_column.label(text=line, icon=padding_icon)


def get_host_reference_message(panel_type, host):
def get_host_reference_message(panel_type, host, ob=None):
if panel_type == PanelType.BONE:
host_reference = f"\"{host.name}\" in \"{host.id_data.name_full}\""
host_reference = f"\"{host.name}\" in \"{ob.name_full}\""
else:
host_reference = f"\"{host.name_full}\""

Expand Down

0 comments on commit d426486

Please sign in to comment.