Skip to content

Commit

Permalink
check for ue2rigify attr in scene
Browse files Browse the repository at this point in the history
also includes replacement .strip(self.action_prefix) with .removeprefix(self.action_prefix)
  • Loading branch information
JoshQuake committed Aug 8, 2024
1 parent 21224e5 commit bffd4fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/addons/send2ue/resources/extensions/ue2rigify.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def set_source_rig_hide_value(self, hide_value):
:param bool hide_value: The hide value to set the source rig to.
:return bool: The original hide value of the source rig.
"""
if self.use_ue2rigify:
if self.use_ue2rigify and hasattr(bpy.context.scene, 'ue2rigify'):
ue2rigify_properties = bpy.context.scene.ue2rigify
if ue2rigify_properties.source_rig:
self.original_hide_value = ue2rigify_properties.source_rig.hide_get()
Expand All @@ -45,7 +45,7 @@ def set_ue2rigify_state(self):
"""
Sets the use_ue2rigify property depending on whether to use code from the ue2rigify addon or not.
"""
if bpy.context.preferences.addons.find('ue2rigify'):
if bpy.context.preferences.addons.find('ue2rigify') and hasattr(bpy.context.scene, 'ue2rigify'):
ue2rigify_properties = bpy.context.scene.ue2rigify
if ue2rigify_properties.selected_mode == self.control_mode:
self.use_ue2rigify = True
Expand Down Expand Up @@ -78,7 +78,7 @@ def pre_animation_export(self, asset_data, properties):
asset_path = asset_data.get('asset_path')
file_path = asset_data.get('file_path')
control_rig_object = bpy.data.objects.get(self.control_rig_name)
action_name = asset_data.get('_action_name').strip(self.action_prefix)
action_name = asset_data.get('_action_name').removeprefix(self.action_prefix)

if self.use_ue2rigify and control_rig_object:
if control_rig_object.animation_data:
Expand All @@ -95,7 +95,7 @@ def pre_animation_export(self, asset_data, properties):
'asset_path': f'{os.path.dirname(asset_path)}/{action_name}',
'file_path': os.path.join(
os.path.dirname(file_path),
os.path.basename(file_path).strip(self.action_prefix)
os.path.basename(file_path).removeprefix(self.action_prefix)
)
})

Expand All @@ -105,7 +105,7 @@ def post_animation_export(self, asset_data, properties):
"""
asset_path = asset_data.get('asset_path')
control_rig_object = bpy.data.objects.get(self.control_rig_name)
action_name = os.path.basename(asset_path).strip(self.action_prefix)
action_name = os.path.basename(asset_path).removeprefix(self.action_prefix)

if self.use_ue2rigify and control_rig_object:
# mute the action
Expand Down

0 comments on commit bffd4fa

Please sign in to comment.