i had an experience this week that made me think of this thread.
i am a video editor and i’m working on a project in davinci resolve. i’m out of practice with it, and consequently, i made a big technical mistake: all of my notes for my show were the wrong format (resolve distinguishes “timeline markers” from “clip markers”—only the latter are searchable, leaving me with several hundred carefully curated and unsearchable (useless) markers).
many googles later, it was looking like i was out of luck. this issue is the subject of a number of support forum threads going back years, all ending in “submit a feature request”
i never would have had time to clean this up manually and was resigning myself to go into the edit without access to any notes.
but digging around the manual i discovered resolve has significant support for scripting with lua. it’s been well over a year since the last time i wrote more than 3 lines of code, but between my faded norns scripting memories and the resolve API i had a viable solution to my unsolvable problem in like 2 hours!
spaghetti code 😎
resolve = Resolve()
project = resolve:GetProjectManager():GetCurrentProject()
--get current timeline with markers
resolve:OpenPage("edit")
current_timeline=project:GetCurrentTimeline()
current_timeline_name=current_timeline:GetName()
--get markers
timeline_markers = timeline:GetMarkers()
--get correct multicam we are copying markers to
mediapool = project:GetMediaPool()
workingfolder = mediapool:GetCurrentFolder()
--for every clip in current bin, if the clip has the same name as the current timeline, set multicam to that clip
for k,v in ipairs(workingfolder:GetClipList()) do
if v:GetName() == current_timeline_name then
multicam=v
end
end
--write function copying markers from timeline to Multi
local function CopyTLmarkerstoMCmarkers (frame,markercontents)
multicam:AddMarker(frame, markercontents["color"],
("COUCH_".. markercontents["name"]),
markercontents["note"],
markercontents["duration"])
end
--move the markers
for key,value in pairs(timeline_markers) do
CopyTLmarkerstoMCmarkers(key,value)
end
this isn’t as “pure” in scope as the original context of the thread—i’m using my script to control a locked up corporate owned application. nonetheless i’m v grateful to have been exposed to this idea—scripting is an approachable topic, it’s totally doable to write some lines of code for personal use without knowing what the “right way” is, and you really don’t have to be a computer scientist, etc.
i dabbled in applescript etc a little bit over the years, but without norns i’d never have felt comfortable attempting something like this. i was still a little afraid of wasting time on something over my head. but it wasn’t even that hard. i only had to google one thing (“attempt to call a table value lua”—something about ipairs that i didn’t actually need to understand in order to fix)
just wanted to say thanks for that, and thanks to everyone on here over the years who has made a point to draw this distinction between programming and engineering, etc. this was not something that was intuitive for me to understand at all, but figuring it out has provided so much value to my life!