Fundamentals
Sequencer is a cinematic editing tool that uses various specialized tracks which are used to define the makeup of scenes.
This document will be fo…
Hopefully, all of this will make it somewhere in the documentation. More examples and coverage of making/using unreal tools in your documentation and/or learning center would be very useful.
Found some answers.
Here is how to add a geom cache to a sequence:
cache_asset = unreal.load_asset("/Game/path/to/cache_asset")
cache_actor = unreal.EditorLevelLibrary.spawn_actor_from_object(cache_asset,unreal.Vector(x=0.0, y=0.0, z=0.0))
actor_binding = level_sequence.add_spawnable_from_instance(cache_actor)
# adding a geom cache
cache_track = actor_binding.add_track(unreal.MovieSceneGeometryCacheTrack)
anim_section = cache_track.add_section()
anim_section.set_range(start_frame,end_frame) # start and end frames
# add the cache asset
params = anim_section.get_editor_property("params")
params.set_editor_property("geometry_cache_asset",cache_asset)
unreal.LevelSequenceEditorBlueprintLibrary.refresh_current_level_sequence()
And this is of use to others who may be looking for it.
Adding sub sequences to another sequence:
# this adds an empty subscenes track to add something too
master_track = top_sequence.add_master_track(unreal.MovieSceneSubTrack)
subseq = unreal.load_asset("/Game/path/to/subsequence" )
subsequence_section = master_track.add_section()
subsequence_section.set_sequence(subseq)
# shift to proper location in timeline
subsequence_section.set_range(start_frame,end_frame)
Excuse me, How to create a morph target sequence using python? I have imported a fbx with morph targets of face, and I could using ui to set a level sequence, how to implement it with python? Thank you
Also,I have got another problem, when I first open the project(without opening the sequence), and using section.get_channels() to get the Face’s channels, it will return None, but if I once open the level sequence, it could work, I have tested the metahuman’s control rig sequence, the issue didn’t occur. So does anything else I need to set with morph target or the sequence? Maybe it’s a bug(I have meet it both in 4.26.2 and 5.0.3)
I also found that I must open the sequence manually (after creating it) in the editor before any further manipulation was possible through python -
OR
I have to call unreal.LevelSequenceEditorBlueprintLibrary.refresh_current_level_sequence() which also allows further python commands