Please convert this script from python to Lua for DaVinci Resolve liste =…
- User
Please convert this script from python to Lua for DaVinci Resolve
liste = timeline.GetItemListInTrack('video',1) for item in liste: print(f"item property {item.GetProperty()}") totem = item.GetMediaPoolItem() item.SetProperty('CompositeMode',0) print(f"item property {item.GetProperty()}") print(f"{totem.GetClipProperty('Input Sizing Preset')}") totem.SetClipProperty('Input Sizing Preset','My_preset_Name') print(f"{totem.GetClipProperty('Input Sizing Preset')}")
- Assistant
Below is a Lua script equivalent of the given Python script for DaVinci Resolve. This assumes that you are executing this script within the context of DaVinci Resolve's Lua scripting environment.
-- Get the current project and timeline project = resolve:GetProjectManager():GetCurrentProject() timeline = project:GetCurrentTimeline() -- Get the list of items in video track 1 liste = timeline:GetItemListInTrack("video", 1) -- Iterate over each item in the list for i, item in ipairs(liste) do -- Print item properties before change print("item property", item:GetProperty()) -- Get the media pool item and change the composite mode totem = item:GetMediaPoolItem() item:SetProperty('CompositeMode', 0) -- Print item properties after change print("item property", item:GetProperty()) -- Print and set the 'Input Sizing Preset' property print(totem:GetClipProperty('Input Sizing Preset')) totem:SetClipProperty('Input Sizing Preset', 'My_preset_Name') print(totem:GetClipProperty('Input Sizing Preset')) end - User
How to execute this script from console?
- Assistant
Executing a Lua script in DaVinci Resolve can be done through the DaVinci Resolve console. Here's a step-by-step guide on how to do this:
-
Open DaVinci Resolve: Start DaVinci Resolve on your computer.
-
Enable the Console:
-
- User
SetClipProperty('Input Sizing Preset', 'My_preset_Name') fails to be executed with no errors, the rest of the code works ok
- Assistant
- User
can you update the code with latest suggestions?
- Assistant
- User
it outputs 'Input Sizing Preset' set successfully but the preset is not changed, why is so?
- Assistant