Inspecting Resolve Objects with Lua

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Artur Piel

  • Posts: 11
  • Joined: Wed Jun 28, 2017 2:25 pm

Inspecting Resolve Objects with Lua

PostFri May 07, 2021 4:47 pm

Hi,
Similair to a topic relating to Python viewtopic.php?f=21&t=79200 , I couldn't find equivalent info for Lua, so

BM scripting documentation states that:
...resolve object... can be inspected for further scriptable properties - using table iteration and "getmetatable" in Lua... each object is inspectable for properties and functions...

so I understand this is what is implied:
Code: Select all
resolve = Resolve()
for key,value in pairs(getmetatable(resolve)) do
    print(key, " ", value)
end


however that returns a table like this:
    __call function: 0x01d65e6de4b8
    __add function: 0x01d65e6de730
    __sub function: 0x01d65e6de768
    __mul function: 0x01d65e6de630
    __div function: 0x01d65e6de668
    __pow function: 0x01d65e6de6a0
    __unm function: 0x01d65e6de928
    __tostring function: 0x01d65e6de558
    _typename function: 0x01d65e6de480
    _istypeof function: 0x01d65e6de520
    __index function: 0x01d65e6de590
    __newindex function: 0x01d65e6de6f8
    __gc function: 0x01d65e6de5f8
    __eq function: 0x01d65e6de960
    __lt function: 0x01d65e6de998
    __le function: 0x01d65e6de9d0
    __concat function: 0x01d65e6dea08
And the result is the same no matter what object is inspected

What would be the correct syntax to explore the objects for usable propetries and functions?
Offline
User avatar

roger.magnusson

  • Posts: 3398
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Inspecting Resolve Objects with Lua

PostFri May 07, 2021 9:48 pm

I don't remember the syntax off the top of my head, but I collected everything I could possibly extract from Resolve in the Class Browser script.

Unfortunately the Resolve objects aren't documented as the Fusion objects are. The Resolve objects can be inspected but they don't contain any additional information. I have asked that they document the Resolve objects in the same way as the Fusion objects (instead of the readme.txt file) but so far that hasn't happened. In fact they later removed some of the documentation from the Fairlight object. I guess it wasn't supposed to be public.
Offline

Artur Piel

  • Posts: 11
  • Joined: Wed Jun 28, 2017 2:25 pm

Re: Inspecting Resolve Objects with Lua

PostSat May 08, 2021 10:59 am

That's awesome, super useful script, and thanks for pointing me to it!

Still dissapointingly few functions exposed through API it seems. Even in Premiere Pro that has not the greatest support for scripting I could do more scripting with the items on the timeline. But at least with this Class Browser I can be sure there's nothing left to dig for. Thanks again!

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Gary Hango, Yahoo [Bot] and 209 guests