From cd927d433c47810ca4671987ac42b5a91839309c Mon Sep 17 00:00:00 2001 From: JoshQuake Date: Sat, 30 Nov 2024 12:05:47 -0800 Subject: [PATCH 1/2] guarded mats and textures with import check fixed issue with affixes extension failing when properties.import_materials_and_textures is disabled. Also prevents it from doing redundant file actions if disabled. --- .../send2ue/resources/extensions/affixes.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/addons/send2ue/resources/extensions/affixes.py b/src/addons/send2ue/resources/extensions/affixes.py index 085e2d51..6b6d4e21 100644 --- a/src/addons/send2ue/resources/extensions/affixes.py +++ b/src/addons/send2ue/resources/extensions/affixes.py @@ -36,15 +36,15 @@ def add_affixes(): ) else: append_affix(mesh_object, properties.extensions.affixes.static_mesh_name_affix) + if properties.import_materials_and_textures: + for slot in mesh_object.material_slots: + if slot.material: + append_affix(slot.material, properties.extensions.affixes.material_name_affix) - for slot in mesh_object.material_slots: - if slot.material: - append_affix(slot.material, properties.extensions.affixes.material_name_affix) - - texture_images = get_texture_images(mesh_object) - for image in texture_images: - save_image_filepath(image) - rename_all_textures(texture_images, append_affix, properties) + texture_images = get_texture_images(mesh_object) + for image in texture_images: + save_image_filepath(image) + rename_all_textures(texture_images, append_affix, properties) for rig_object in rig_objects: actions = utilities.get_actions(rig_object, properties.export_all_actions) @@ -72,12 +72,12 @@ def remove_affixes(): discard_affix(mesh_object, properties.extensions.affixes.skeletal_mesh_name_affix) if old_mesh_object_name == mesh_object.name: break + if properties.import_materials_and_textures: + for slot in mesh_object.material_slots: + discard_affix(slot.material, properties.extensions.affixes.material_name_affix) - for slot in mesh_object.material_slots: - discard_affix(slot.material, properties.extensions.affixes.material_name_affix) - - texture_images = get_texture_images(mesh_object) - rename_all_textures(texture_images, discard_affix, properties) + texture_images = get_texture_images(mesh_object) + rename_all_textures(texture_images, discard_affix, properties) for rig_object in rig_objects: actions = utilities.get_actions(rig_object, properties.export_all_actions) @@ -352,7 +352,7 @@ def post_operation(self, properties): if self.auto_remove_asset_name_affixes: remove_affixes() - if self.auto_add_asset_name_affixes: + if properties.import_materials_and_textures and self.auto_add_asset_name_affixes: restore_texture_paths() def pre_validations(self, properties): From d2cb77120b8707e3ddf58d3ad9ffee5b107abdda Mon Sep 17 00:00:00 2001 From: JoshQuake Date: Sat, 30 Nov 2024 13:04:32 -0800 Subject: [PATCH 2/2] removed guards from add and remove affixes --- .../send2ue/resources/extensions/affixes.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/addons/send2ue/resources/extensions/affixes.py b/src/addons/send2ue/resources/extensions/affixes.py index 6b6d4e21..fe7316e8 100644 --- a/src/addons/send2ue/resources/extensions/affixes.py +++ b/src/addons/send2ue/resources/extensions/affixes.py @@ -36,15 +36,15 @@ def add_affixes(): ) else: append_affix(mesh_object, properties.extensions.affixes.static_mesh_name_affix) - if properties.import_materials_and_textures: - for slot in mesh_object.material_slots: - if slot.material: - append_affix(slot.material, properties.extensions.affixes.material_name_affix) + + for slot in mesh_object.material_slots: + if slot.material: + append_affix(slot.material, properties.extensions.affixes.material_name_affix) - texture_images = get_texture_images(mesh_object) - for image in texture_images: - save_image_filepath(image) - rename_all_textures(texture_images, append_affix, properties) + texture_images = get_texture_images(mesh_object) + for image in texture_images: + save_image_filepath(image) + rename_all_textures(texture_images, append_affix, properties) for rig_object in rig_objects: actions = utilities.get_actions(rig_object, properties.export_all_actions) @@ -72,12 +72,12 @@ def remove_affixes(): discard_affix(mesh_object, properties.extensions.affixes.skeletal_mesh_name_affix) if old_mesh_object_name == mesh_object.name: break - if properties.import_materials_and_textures: - for slot in mesh_object.material_slots: - discard_affix(slot.material, properties.extensions.affixes.material_name_affix) + + for slot in mesh_object.material_slots: + discard_affix(slot.material, properties.extensions.affixes.material_name_affix) - texture_images = get_texture_images(mesh_object) - rename_all_textures(texture_images, discard_affix, properties) + texture_images = get_texture_images(mesh_object) + rename_all_textures(texture_images, discard_affix, properties) for rig_object in rig_objects: actions = utilities.get_actions(rig_object, properties.export_all_actions)