I have this on my wishlist, too. Being able to change Clip Names via python would really help to automate my workflow.
My current workaround is use a script to place markers on all clips which display the custom name that I have chosen. I also write the custom name into the "Version" attribute of each clip which is accessible on the delivery page to place individual clips in subfolders of the chosen name.
- 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()
# Media Pool
mediaPool = project.GetMediaPool()
# Get the root bin
binRoot = mediaPool.GetRootFolder()
# Get the currently opened timeline
tl = project.GetCurrentTimeline()
# Get the start frame of the timeline
tlStart = tl.GetStartFrame()
# Get a list of all clips in the video track
clips = tl.GetItemListInTrack('video', 1)
i = 1000
for clip in clips:
# New clip name
clipName = 'MyClipName' + str('%04d' % i)
# Timeline start frame needs to be subtracted from clip start as the first clip always starts at 0 - no matter the timeline start TC
clipStart = clip.GetStart() - tlStart
# Clip duration
clipDur = clip.GetDuration()
# Add a marker for each clip displaying the custom name
tl.AddMarker(clipStart, 'Red', clipName, '', clipDur, 'Renamed')
# Add a color version as an attribute to use for subfolder generation
clip.AddVersion(clipName , 0)
print('Added custom name "' + clipName + '"')
i += 1
That's the best I can do under the current limitations. Being able to actually change the Clip Name attribute would be much better, of course.