Hi,
I’m using python to reimport SkeletalMesh in Unreal automatically.
I have a SkeletalMesh with 4 animations sequence and i would like to reimport the SkeletalMesh and the animations related, with an FBX.
I reimport the Skeletal using this function:
def import_skeletal(skel, fbx_path):
import_task = unreal.AssetImportTask()
import_task.destination_name = skel.get_name()
import_task.destination_path = skel.get_path_name().rpartition("/")[0]
import_task.filename = fbx_path
import_task.replace_existing = True
import_task.automated = True
import_task.factory = unreal.FbxFactory()
import_task.options = unreal.FbxImportUI()
import_task.options.import_animations = True
import_task.options.mesh_type_to_import = unreal.FBXImportType.FBXIT_SKELETAL_MESH
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([import_task])
and seems import SkeletalMesh without any problem, but doesn’t reimport animations sequence from the fbx.
So when i saw the problem i tried from the editor clicking on Reimport Animation
it asks me for the fbx and it works!
but i’m having a lot of trouble implementing this behavior from python!
I saw that exists the ReimportFbxAnimSequenceFactory and i tried to use it like this:
def reimport_animation(anim_sequence, fbx_path):
import_task = unreal.AssetImportTask()
import_task.destination_name = anim_sequence.get_name()
import_task.destination_path = anim_sequence.get_path_name().rpartition("/")[0]
import_task.filename = fbx_path
import_task.replace_existing = True
import_task.automated = True
import_task.factory = unreal.ReimportFbxAnimSequenceFactory()
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([import_task])
but it gives me this error here:
LogAssetTools: Warning: Failed to import ‘path-to-fbx’ Unknown extension ‘fbx’.
so, what is the correct way to replicate the behavior of Reimport Animation with python, or i can reimport SkeletalMesh and animations sequence with one AssetImportTask??
Thanks for the patience!