- Posts: 17
- Joined: Mon Mar 04, 2019 10:58 am
- Real Name: Dominik Eckold
I was thrilled to find the new function 'GetUniqueId()' in the scripting documentation of Resolve 18.1.
I thought maybe it is finally possible to identify a Timeline object in the Mediapool by ID rather than just by its name (not robust enough as there may be duplicate names in a project) or its index (not possible to match that to a MediapoolItem).
However, it seems like a Timeline object has a different 'unique id' than its corresponding MediapoolItem.
To test it, create a new project with just one timeline in the 'Master' bin and run this:
Returns this:
As you can see, the IDs are different.
So the unique id is not so unique after all. Or put another way: a 'Timeline' object and a 'MediaPoolItem' object are two separate entities and there seems to be no way to match one to the other. Even though every 'Timeline' object must have a 'MediaPoolItem' associated with it.
Unless I'm missing something. Is that correct or does anybody know a way?
I thought maybe it is finally possible to identify a Timeline object in the Mediapool by ID rather than just by its name (not robust enough as there may be duplicate names in a project) or its index (not possible to match that to a MediapoolItem).
However, it seems like a Timeline object has a different 'unique id' than its corresponding MediapoolItem.
To test it, create a new project with just one timeline in the 'Master' bin and run this:
- Code: Select all
import DaVinciResolveScript as dvrs
# ########## Global variables ##########
# Scripting Engine
resolve = dvrs.scriptapp('Resolve')
# Project Manager
projectManager = resolve.GetProjectManager()
# Current Project
project = projectManager.GetCurrentProject()
# Number of timelines in project
tlCount = project.GetTimelineCount()
# Media Pool
mediaPool = project.GetMediaPool()
# Get the root bin
rootFolder = mediaPool.GetRootFolder()
# Find all objects in the media pool
mediaPoolObjects = rootFolder.GetClipList()
# Print the unique ID of each mediapool object
for obj in mediaPoolObjects:
print('Obj ID: ' + obj.GetUniqueId())
# Print the unique ID of each timeline in the project
for i in range(tlCount):
tl = project.GetTimelineByIndex(i+1.0)
print('TL ID: ' + tl.GetUniqueId())
Returns this:
- Code: Select all
Obj ID: 05cb51ff-4992-4d46-ad54-129f4de74b26
TL ID: 8d05f53e-b05d-419c-832e-c00027ff29d0
As you can see, the IDs are different.
So the unique id is not so unique after all. Or put another way: a 'Timeline' object and a 'MediaPoolItem' object are two separate entities and there seems to be no way to match one to the other. Even though every 'Timeline' object must have a 'MediaPoolItem' associated with it.
Unless I'm missing something. Is that correct or does anybody know a way?