Sequencer MovieScene3DAttachTrack

Hey guys!

I am writing a python script that spawns two cubes (cube_1, cube_2) in a sequencer, as spawnables with the “add_spawnable_from_instance” method .

So what I am trying next is to attach cube_2 to cube_1 with the MovieScene3DAttachTrack and spawning and adjusting the track was fairly easy.

But I am failing at the “Contraint Binding ID”.

Just a very rough example:

attach_track = cube_2.add_track(unreal.MovieScene3DAttachTrack)
attach_settings = attach_track.add_section()
attach_settings.set_range(0, playbackend)

and I tried to set the binding with:
attach_settings.set_constraint_binding_id(guid of cube_1)

and sadly some other methods that did not work out in my case…

If you could give me a hint or even the solution that would be great! :smiley:

Thank you in advance!
Have a nice day!

Cheers!

You need to use make_binding_id() and pass that into set_constraint_binding_id():


attach_binding_id = sequence.make_binding_id(guid_of_cube_1, unreal.MovieSceneObjectBindingSpace.LOCAL)
attach_settings.set_constraint_binding_id(attach_binding_id)

Take a look at the examples here: Engine\Plugins\MovieScene\SequencerScripting\Content\Python\sequencer_examples.py. In create_master_level_sequence(), there’s an example of creating a binding id for the camera cut section.

Thank you very much!