MovieSceneBindingProxy differences between binding_id and get_id

import unreal

seq = unreal.LevelSequenceEditorBlueprintLibrary.get_current_level_sequence()

bindings = seq.get_bindings()

for binding in bindings:

assert binding.binding_id == binding.get_id()

Steps to Reproduce
Hi,

Open a LevelSequence.

Execute the following Python script. It results in an AssertionError.

import unreal
seq = unreal.LevelSequenceEditorBlueprintLibrary.get_current_level_sequence()
bindings = seq.get_bindings()
for binding in bindings:
 assert binding.binding_id == binding.get_id()

What’s the difference between the two methods? I can see BindingID declared in MovieSceneBindingProxy.h, but no GetId, where does it come from?

Thanks

Hey there,

binding.binding_id is not a guid, it’s MovieSceneObjectID. You can read about the different flavors of IDs on the documentation here.

https://dev.epicgames.com/documentation/en-us/unreal-engine/python-api/class/MovieSceneObjectBindingID?application_version=5.0#unreal.MovieSceneObjectBindingID

get_id() is a function that actually resides in movie extensions.

unreal.MovieSceneBindingExtensions.get_id(binding)

Modifying your script a little bit, you can see the different outputs from 3 different ways of fetching ids.

import unreal
seq = unreal.LevelSequenceEditorBlueprintLibrary.get_current_level_sequence()
bindings = seq.get_bindings()
for binding in bindings:
 print(binding.get_id())
 print(binding.binding_id)
 print(unreal.MovieSceneBindingExtensions.get_id(binding))

Depending on your use case for comparison you may need to do things a little different.

Dustin

Hey Dustin,

Thanks for the reply and for the documentation link.

I ran your snippet, I’m still a bit confused with Guid vs MovieSceneObjectID, as the printed `type` of MovieSceneObjectID is `Guid`:

seq = unreal.LevelSequenceEditorBlueprintLibrary.get_current_level_sequence()
bindings = seq.get_bindings()
for binding in bindings:
    print(type(binding.get_id()))
    print(type(binding.binding_id))
    print(type(unreal.MovieSceneBindingExtensions.get_id(binding)))
# Will print
<class 'Guid'>
<class 'Guid'>
<class 'Guid'>

Cheers,

Baptiste

It is a guide at the end of the day, according to the Python API, but the way it resolves against a sequence is the primary difference. If you use subsequences and proxy bindings, with bindings to objects defined in a parent sequence, using binding_id will return to you the local id of that object and you will need to use other information to determine what it is like comparing the sequence_id to determine which subsequence a proxy binding might be in.

As I mentioned in my previous post, there are a couple of different binding ID types depending on how you fetch the data. For tooling, get_id and MovieSceneBindingExtension.get_id should suffice for most cases and comparisons at editor time, where Python can run.

Dustin