Display project and folder tree
小于 1 分钟
Display project and folder tree
Python
#!/usr/bin/env python
"""
Example DaVinci Resolve script:
Draw folder and project tree from project manager window.
Example usage: 4_display_project_and_folder_tree.py
"""
from python_get_resolve import GetResolve
def DisplayProjectsWithinFolder( projectManager, folderString = "- ", projectString = " " ):
folderString = " " + folderString
projectString = " " + projectString
projects = sorted(projectManager.GetProjectListInCurrentFolder())
for projectName in projects:
print(projectString + projectName)
folders = sorted(projectManager.GetFolderListInCurrentFolder())
for folderName in folders:
print(folderString + folderName)
if projectManager.OpenFolder(folderName):
DisplayProjectsWithinFolder(projectManager, folderString, projectString)
projectManager.GotoParentFolder()
return
def DisplayProjectTree( resolve ):
projectManager = resolve.GetProjectManager()
projectManager.GotoRootFolder()
print("- Root folder")
DisplayProjectsWithinFolder(projectManager)
return
# Get currently open project
resolve = GetResolve()
DisplayProjectTree(resolve)
Lua
--[[
Example DaVinci Resolve script:
Draw folder and project tree from project manager window.
--]]
local function DisplayProjectsWithinFolder( projectManager, folderString, projectString )
folderString = folderString or "- "
projectString = projectString or " "
folderString = " "..folderString
projectString = " "..projectString
local projects = projectManager:GetProjectsInCurrentFolder()
for projectIndex in pairs(projects) do
print(projectString..projects[projectIndex])
end
local folders = projectManager:GetFoldersInCurrentFolder()
for folderIndex in pairs(folders) do
print(folderString..folders[folderIndex])
if projectManager:OpenFolder(folders[folderIndex]) then
DisplayProjectsWithinFolder(projectManager, folderString, projectString)
projectManager:GotoParentFolder()
end
end
end
local function DisplayProjectTree( resolve )
projectManager = resolve:GetProjectManager()
projectManager:GotoRootFolder()
print("- Root folder")
DisplayProjectsWithinFolder(projectManager)
end
resolve = Resolve()
DisplayProjectTree(resolve)