Download

Import animation without mesh in Unreal 4.22 using python

Hello !
I do a script for import a animation in unreal engine but the parameter FbxImportUI.import_mesh does not work :confused: When I run the script it import the animation and the mesh but I want import only the animation, the mesh already exists in another folder.

This is my code :

import os.path
import unreal

# Option
taskoptions = unreal.FbxImportUI()
taskoptions.set_editor_property('Skeleton', unreal.find_asset(r'/Game/Temp/SK_Armature_Skeleton.SK_Armature_Skeleton'))
taskoptions.set_editor_property('import_materials', False)
taskoptions.set_editor_property('import_textures', False)
taskoptions.set_editor_property('import_animations', True)
taskoptions.set_editor_property('import_mesh', False)
taskoptions.set_editor_property('create_physics_asset',False)
taskoptions.set_editor_property('original_import_type', unreal.FBXImportType.FBXIT_ANIMATION)
taskoptions.skeletal_mesh_import_data.set_editor_property('import_morph_targets', True)

# Task
task = unreal.AssetImportTask()
task.filename = r'D:\MyAnim\ArmatureAction.fbx'
task.destination_path = r'/Game/Temp/Anim'
task.automated = True
task.save = True
task.replace_existing = True
task.set_editor_property('options', taskoptions)

unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task,])

I did something wrong? Thank you for your reply !

In unreal you cannot import an animation without a mesh it seems.
I tried many times before.
You cant even import a multi take/animation fbx

You can do it if the skeleton already exists it was enough to select the skeleton and uncheck import mesh. (Like in the picture)
I do the same manipulation with python but it does not work :confused:

You could check if you get the same result with the unofficial Python plugin: GitHub - 20tab/UnrealEnginePython: Embed Python in Unreal Engine 4 (example of importing animations in /Tutorials/YourFirstAutomatedPipeline.md)

If that works fine submit a bug report for the UE4 python plugin.

I find a solution.



options.automated_import_should_detect_type = False


I was facing the same issue as Loux_xavier, but your solution doesn’t fix my problem.

I’m trying to import an FBX containing nothing but an animated cylinder.
The corresponding Skeleton, SkeletalMesh and Material have already been imported elsewhere.

Importing the FBX manually with these settings is giving the expected result : just an AnimationSequence.

And now here is my code :
options = unreal.FbxImportUI()
# options.automated_import_should_detect_type = False
options.original_import_type = unreal.FBXImportType.FBXIT_ANIMATION
options.import_animations = True
options.create_physics_asset = False
options.import_mesh = False
options.import_rigid_mesh = False
options.import_materials = False
options.import_textures = False
options.import_as_skeletal = False
options.skeleton = unreal.load_asset(skeleton_path)
return options

The second line (options.automated_import_should_detect_type = False) is giving a StaticMesh.
If I comment or remove it, the import gives a SkeletalMesh + an AnimationSequence, which is better, but I still want to get rid of this SkeletalMesh and I can’t manage to only get the AnimationSequence.

I’ve tried using set_editor_property rather than the direct parameters but it doesn’t change anything.