Sequencer - Assign Actor via Python

Hello,

I’m working on something where I import an FBX camera and add it to the Sequencer, which works just fine. However, I need to rename the camera and the created SequencerBindingProxy label.

The camera and SequencerBindingProxy are renamed correctly, but the problem is that after the rename, the connection is broken and I have to select the camera on the Sequencer, go to ‘Assign Actor,’ and then find my camera in the list.

How can I do this with the Python API? I’ve been trying for quite some time now and I’m not really getting any closer. I know that SequencerBindingProxy and SequencerBoundObjects both have an ‘assign’ method but those don’t seem to fix the:

new_bindings = unreal.SequencerBoundObjects(binding_proxy, [camera_actor])
bindings[0].assign(new_bindings)
bindings = sequencer_tools.get_object_bindings(
	editor_world,
	sequence_controller.get_active_level_sequence(),
	[camera_actor, camera_actor.camera_component],
	scripting_range
)

binding_proxy = bindings[0].binding_proxy
new_bindings = unreal.SequencerBoundObjects(binding_proxy, [camera_actor])
binding_proxy.assign(new_bindings)

I realize the second snippet might make no sense (like it’s assigning a binding to itself…?) but I’ve tried just about every variation of this I can think of to no avail.

Thanks!

Hi,

I’m having a similar issue. I need to duplicate a level sequence, then add it into a new level. When I open the new level, the camera is no longer connected to the level sequence. I need to replicate the ‘assign actor’ functionality to reattach the camera, but I can’t find any way in python to do it. I’d love to know what the ‘assign actor’ menu option is doing under the hood?

Thanks.

If you’re on 5.1, there are now new python functions that should do what you want:

https://docs.unrealengine.com/5.1/en-US/PythonAPI/class/LevelSequenceEditorSubsystem.html#unreal.LevelSequenceEditorSubsystem

1 Like