Download

How to add keys in sequencer by python ?

Hey guys, how can I add keys on a track’s section in sequencer by python ?
I wanna add a transform animation on one actor, but I didn’t find any methods on section or track objects to achieve it.
Hope your suggestion, thanks.

I figured it out:
unreal.MovieSceneScriptingChannel and unreal.MovieSceneScriptingKey classes are used to handle the channels and keys on sections, e.g:



# add a key on a transform section's translate-x channel
tx_channel =  trans_section.get_channels()[0]
tx_channel.add_key(time=unreal.FrameNumber(10), new_value=50.0)

Hope this can help someone who runs into the same problem.

Glad you figured it out. There’s also some examples in the source here::

Engine\Plugins\MovieScene\SequencerScripting\Content\Python

In particular, sequencer_key_examples.py