Copying keyframe to one sequence to another using python

Hi everyone,

what I’m trying to achieve is conceptually very simple: I’d like to understand if it’s possible to create a button in a utility widget editor that essentially copies all the keyframes of the transform track of a cube from the cam01 sequence to the same track of the cube in the cam02 sequence, all using Python.

So basically if you take a look at the CAM01.JPG, what i want is to take all the keyframes from the cube track transform in CAM01 sequence and copy everything to cube track transform in the CAM02 sequence by pressing a button on the basic ui (connecting an execute python script node to the “onClicked” function of a button

Furthermore, I would like to know if it’s possible to copy the keyframe previous to the current one and set it to the current one, still using Python.

You can follow at the pic “Folder_Location.JPG” to catch the correct files, even for the basic ui

I’ve also attached the basic scene that i was using for this little test, hope can help. If you need anything else or more clarification, please let me know.

Thank you in advance for your support,

Luca

Hey there,

Yes this is possible. There are a couple of references to help you out.

For EUW, this link shows you how to run a python command or file from blueprint. You can use this to bind your python event.

https://dev.epicgames.com/documentation/en-us/unreal-engine/scripting-the-unreal-editor-using-python#fromeditor-onlyblueprints

For scripting sequencer commands, there are two resources you’ll want to look at:

https://dev.epicgames.com/documentation/en-us/unreal-engine/python-scripting-in-sequencer-in-unreal-engine#copyandpastecommands

and inside

…\Engine\Plugins\MovieScene\SequencerScripting\Content\Python\sequencer_key_examples.pyTo copy the keys, you’ll be grabbing the values of the keys you want from cube1’s properties and then creating new keys on cube2 properties*.*

Hope this gets you on the right track.