Adding track to possessable via python api

I am trying to add a track to a possessed actor in the sequencer via python.

To manually do this, I can make the actor possessable by dragging it into the sequencer, then adding the parameter (called visibility) track like so.

image

This is how far I have got so far via python.

#load sequence
ls = unreal.EditorAssetLibrary.load_asset(’/Game/Master/assets/sets/exampleSequence’)
#get possessables
possessables = ls.get_possessables()
#add track to first possessable
possessables[0].add_track(unreal.MovieSceneBoolTrack)

this creates the following

image

I am unsure how to link/bind this to a parameter on the actor (in this case a blueprint with a variable I made called visibility)

Am I on the right track, or is there a better way of getting what I am trying to achieve?

I had to do something similar but i used a movieSceneFloatTrack in order to animate the visibility overtime. In order to bind/link, I found that you need to know the property_name and property_path. To do that, I manually added visibility, drilled into the object and looked up what the property_name and property_path was which was bHidden…The following should work with pure code. Make sure you save and reopen the levelSequence to see if it worked.

TrackVis = possessables[0].add_track(unreal.MovieSceneBoolTrack)
TrackVis .set_property_name_and_path('bHidden', 'bHidden')
TrackVis .set_editor_property('display_name', 'Visibility')
section = TrackVis.add_section()
section.set_end_frame_bounded(False)
section.set_start_frame_bounded(False)

For code testing I also use the following
unreal.LevelSequenceEditorBlueprintLibrary.refresh_current_level_sequence()

1 Like

Thanks, this is what I was looking for!