From fb5030b499f77ec30594a9c85d6999db178b6b9c Mon Sep 17 00:00:00 2001 From: jamesbaber1 <31859220+jamesbaber1@users.noreply.github.com> Date: Tue, 17 Nov 2020 17:10:36 -0600 Subject: [PATCH] use only the name of the child mesh that is under the mesh collection otherwise require the user to specify the path #133 --- send2ue/addon/__init__.py | 2 +- send2ue/addon/functions/export.py | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/send2ue/addon/__init__.py b/send2ue/addon/__init__.py index ba340bf6..5f9d58df 100644 --- a/send2ue/addon/__init__.py +++ b/send2ue/addon/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "Send to Unreal", "author": "Epic Games Inc.", - "version": (1, 4, 10), # addon plugin version + "version": (1, 4, 11), # addon plugin version "blender": (2, 83, 0), # minimum blender version "location": "Header > Pipeline > Export > Send to Unreal", "description": "Sends an asset to the first open Unreal Editor instance on your machine.", diff --git a/send2ue/addon/functions/export.py b/send2ue/addon/functions/export.py index 179949ab..b2d22376 100644 --- a/send2ue/addon/functions/export.py +++ b/send2ue/addon/functions/export.py @@ -104,12 +104,19 @@ def get_skeleton_game_path(rig_object, properties): else: if rig_object.children: - # set the skeleton game path to the first child of the skeletons children - return f'{properties.unreal_mesh_folder_path}{get_unreal_asset_name(rig_object.children[0].name, properties)}_Skeleton' - else: - utilities.report_error( - f'"{rig_object.name}" does not have any mesh as children, so it can not be imported!' - ) + # get all meshes from the mesh collection + mesh_collection = get_from_collection(properties.mesh_collection_name, 'MESH') + + # use the child mesh that is in the mesh collection to build the skeleton game path + for child in rig_object.children: + if child in mesh_collection: + asset_name = get_unreal_asset_name(child.name, properties) + return f'{properties.unreal_mesh_folder_path}{asset_name}_Skeleton' + + utilities.report_error( + f'"{rig_object.name}" needs its unreal skeleton asset path specified under the "Path" settings ' + f'so it can be imported correctly!' + ) def get_pre_scaled_context():