Importing FBX to metahuman control rig causes crash.. but only when using Python

jamesptrujillo
Tue, 31 May 2022 13:50:32 +0000
Character & Animation

I’m trying to use Python with UE4 to import level, sequence, and then animation onto my metahuman actor. Loading the level and the sequence seem to work fine, but when I run the last line (importing the fbx file onto the Face Control Rig), UE always crashes. The strange thing is that if I do this step manually, it works fine.

So I’m wondering if there is perhaps something wrong in my code that could cause this crash?

Thanks in advance for any tips!

Extra info: I’m running Windows 10, 32gb ram, NVIDIA GeForce RTX 2080 Ti

editor_util = unreal.EditorUtilityLibrary()
editor_asset_lib = unreal.EditorAssetLibrary()
editor_level_lib = unreal.EditorLevelLibrary()
editor_seq_lib = unreal.LevelSequenceEditorBlueprintLibrary()
editor_sequencer = unreal.SequencerTools()

FBX_path = "C:/data/Animation/fbx_files/"

# Step 1:  load LEVEL (meta_level)
level_path = "/Game/meta_level.umap"
editor_level_lib.load_level(level_path)

# Step 2: load SEQUENCE (sequence_base)
sequence_path = "/Game/sequence_base"
level_sequence = editor_asset_lib.load_asset(sequence_path)
# open sequencer
editor_seq_lib.open_level_sequence(level_sequence)

# Step 3: load ANIMATIONS
#face
myWorld = editor_level_lib.get_game_world()

#lipsync_fbx ="Game/WDJDDK_OnlyLips"
lipsync_fbx = FBX_path + "WDJDDK_OnlyLips.fbx"
face_rig_settings = unreal.MovieSceneUserImportFBXControlRigSettings()

animation_path = "/Game/WDJDDK_OnlyTurn"
actors = editor_level_lib.get_all_level_actors()
actor_in_world = actors[7]
face_rig_settings = unreal.MovieSceneUserImportFBXControlRigSettings()
# next line crashes UE every time
editor_sequencer.import_fbx_to_control_rig(myWorld,level_sequence,"BP_Katara","Face_ControlBoard_CtrlRig", face_rig_settings, import_filename=lipsync_fbx)

1 post - 1 participant