Hello,
i’m currently importing my Skeletal Mesh, Skeleton, and Physicas asset via command line Python like allot of folks here.
i got everything working, but when i set the name Physics and Skeleton Asset to have the correct prefix (PA, SKEL) before saving, after save the Skeletal Mesh is still pointing to the old Skeleton name.
i can fix this in the UI by reassinging the Skeleton, however i’m wondering if there’s a line to reassing the skeleton in python?
skelMesh has a skeleton property but it’s read only.
is there any other way to reassing the skeleton after import?
this is what my post import script looks like…
def _post_skel_mesh(gamepath, task):
base = os.path.basename(task.filename)
base, _ = os.path.splitext(base)
skmeshpath = '%s/%s' % (gamepath, base)
al = unreal.EditorAssetLibrary()
tokens = base.split('_')
del tokens[0]
postn = '_'.join(tokens)
extra = {'Skeleton': 'SKEL',
'PhysicsAsset': 'PA'}
for ex, pre in extra.items():
skel_base = "%s_%s" % (base, ex)
skel_path = os.path.join(gamepath, '%s.%s' % (skel_base, skel_base))
skel_path = skel_path.replace('\\', '/')
skel_asset = unreal.find_asset(skel_path)
if not skel_asset:
raise ValueError('could not find asset %s ' % skel_path)
fname = '%s/%s_%s' % (gamepath, pre, postn)
al.rename_asset(skel_path, fname)
al.save_loaded_asset(skel_asset, True)
ideally i would like to so do something like this at the end…
is there a better way to do this?
skelmesh = unreal.find_asset('skelmesh')
skelmesh.skeleton = skel_asset.path
al.save_loaded_asset(skel_mesh,True)
but the skeleton property is read only.