[url]https://youtu.be/yFYfCm5m4BA
[/url]
We have some graphics, who do relink wrong or don't want to link. Its seems, Resolve does not check the filename or is confused about something. Most of our lower graphics do work, but some are completely wrong. That is very bad with a 50min documentary with 40 lowers, graphics, maps, titles, subtitles and more.
Because the original name disappears when linked to the wrong media, its not possible to find the right one later- of course, there is the conform lock fonction with the <!> to choose an other clip, but in this case it shows sometimes almost every clip in the system.
With a script we would like to reconnect the graphics by their name and length. There seems to be no way to link to clips to the timeline item. Any good ideas about our workaround?
Chatbot helped me so far, but nothing happens:
function findMatchingClipInMediaPool(name, duration)
local project = resolve:GetProjectManager():GetCurrentProject()
local mediaPool = project:GetMediaPool()
local rootFolder = mediaPool:GetRootFolder()
local function scanFolder(folder)
local clips = folder:GetClips()
for _, clip in pairs(clips) do
local clipProps = clip:GetClipProperty()
if clipProps["Clip Name"] == name and tonumber(clipProps["Frames"]) == duration then
return clip
end
end
local subFolders = folder:GetSubFolders()
for _, subFolder in pairs(subFolders) do
local matchingClip = scanFolder(subFolder)
if matchingClip then
return matchingClip
end
end
end
return scanFolder(rootFolder)
end
function relinkOfflineClips()
print("Starting to relink offline clips...")
local project = resolve:GetProjectManager():GetCurrentProject()
local timeline = project:GetCurrentTimeline()
if not timeline then
print("No timeline selected.")
return
end
local videoTrackIndex = 1 -- Example: using the first video track
local trackItems = timeline:GetItemListInTrack("video", videoTrackIndex)
if trackItems then
for _, item in ipairs(trackItems) do
local mediaPoolItem = item:GetMediaPoolItem()
if mediaPoolItem then -- Check if the timeline item is linked to a media pool item
local clipProps = mediaPoolItem:GetClipProperty()
if clipProps then
local offlineStatus = clipProps["Offline"]
local name = clipProps["Clip Name"]
local duration = tonumber(clipProps["Frames"])
if offlineStatus then
print("Attempting to relink: " .. name)
local matchingClip = findMatchingClipInMediaPool(name, duration)
if matchingClip then
-- Attempt to replace the media pool item of the timeline item with the matching one
if item:ReplaceMediaPoolItem(matchingClip) then
print("Successfully relinked offline clip: " .. name)
else
print("Failed to relink clip: " .. name)
end
else
print("No matching clip found for: " .. name)
end
end
end
else
print("Item does not have an associated media pool item or is offline.")
end
end
else
print("No items found in the specified track.")
end
print("Finished attempting to relink clips.")
end
relinkOfflineClips()
[/url]
We have some graphics, who do relink wrong or don't want to link. Its seems, Resolve does not check the filename or is confused about something. Most of our lower graphics do work, but some are completely wrong. That is very bad with a 50min documentary with 40 lowers, graphics, maps, titles, subtitles and more.
Because the original name disappears when linked to the wrong media, its not possible to find the right one later- of course, there is the conform lock fonction with the <!> to choose an other clip, but in this case it shows sometimes almost every clip in the system.
With a script we would like to reconnect the graphics by their name and length. There seems to be no way to link to clips to the timeline item. Any good ideas about our workaround?
Chatbot helped me so far, but nothing happens:
function findMatchingClipInMediaPool(name, duration)
local project = resolve:GetProjectManager():GetCurrentProject()
local mediaPool = project:GetMediaPool()
local rootFolder = mediaPool:GetRootFolder()
local function scanFolder(folder)
local clips = folder:GetClips()
for _, clip in pairs(clips) do
local clipProps = clip:GetClipProperty()
if clipProps["Clip Name"] == name and tonumber(clipProps["Frames"]) == duration then
return clip
end
end
local subFolders = folder:GetSubFolders()
for _, subFolder in pairs(subFolders) do
local matchingClip = scanFolder(subFolder)
if matchingClip then
return matchingClip
end
end
end
return scanFolder(rootFolder)
end
function relinkOfflineClips()
print("Starting to relink offline clips...")
local project = resolve:GetProjectManager():GetCurrentProject()
local timeline = project:GetCurrentTimeline()
if not timeline then
print("No timeline selected.")
return
end
local videoTrackIndex = 1 -- Example: using the first video track
local trackItems = timeline:GetItemListInTrack("video", videoTrackIndex)
if trackItems then
for _, item in ipairs(trackItems) do
local mediaPoolItem = item:GetMediaPoolItem()
if mediaPoolItem then -- Check if the timeline item is linked to a media pool item
local clipProps = mediaPoolItem:GetClipProperty()
if clipProps then
local offlineStatus = clipProps["Offline"]
local name = clipProps["Clip Name"]
local duration = tonumber(clipProps["Frames"])
if offlineStatus then
print("Attempting to relink: " .. name)
local matchingClip = findMatchingClipInMediaPool(name, duration)
if matchingClip then
-- Attempt to replace the media pool item of the timeline item with the matching one
if item:ReplaceMediaPoolItem(matchingClip) then
print("Successfully relinked offline clip: " .. name)
else
print("Failed to relink clip: " .. name)
end
else
print("No matching clip found for: " .. name)
end
end
end
else
print("Item does not have an associated media pool item or is offline.")
end
end
else
print("No items found in the specified track.")
end
print("Finished attempting to relink clips.")
end
relinkOfflineClips()
- Attachments
-
- matching clip is there, why confused?
- Bildschirmfoto 2024-03-28 um 22.57.50.png (226.67 KiB) Viewed 1056 times