Script: Class Browser for DaVinci Resolve/Fusion

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

roger.magnusson

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

Script: Class Browser for DaVinci Resolve/Fusion

PostSun Feb 23, 2020 3:38 pm

An invaluable tool when creating GUI:s for Resolve/Fusion scripts is the FusionScript Help Browser by Andrew Hazelden (also available in Reactor for Fusion and Resolve). It uses the built-in script help/documentation system in Fusion/Resolve and displays it in an easy to use way.

I always wanted two more features though:
  • Clearly identify a class member as a property or a method
  • A graphical representation of the class hierarchy
I added these two features and some other small stuff that I haven't seen done in other scripts.

Startup time is a few seconds slower than Andrews script since I'm putting all the classes in a Tree instead of the faster ComboBox. Once it's started performance is not an issue though.

Note that Resolve kidnaps the keyboard in certain scenarios. Up/Down arrows in the class tree won't work if the script is opened on the Edit page for example. This only affects Resolve, not Fusion. If you need to use the keyboard you can make the Class Browser window a modal window (see the create_window function).

The filtering functionality is set to "contains" but you can use wildcards (* and ?). To list all classes that starts with "UI" just type UI* and press enter (note that classes might be hidden by the "Hide Classes Without Members" checkbox even when filtering).

One thing to note is that sometimes a property says Read-only when you might assume it's Read-write, like UITreeItem.Text. That's because the property is an indexer to a collection of values. The collection is Read-only, but the individual values inside it are Read-write.



Image
Class Browser in Flat View mode


Image
Nested View, with a filter applied to show all classes starting with "UI"


Image
New in v1.1, Registry Attributes for Fusion classes


@BMD, it would be very helpful if the existing Resolve API documentation (readme.txt) was added to the built-in script help system instead of the separate text file. Fusion has many class members documented like this and even Fairlight has some as well. The Resolve readme.txt implies this is already available in the script system, but it's only a list of method names without any description.

Running the script

Unzip the file first (the forum doesn't allow the .lua file extension). The easiest way to run the script is to drag and drop it on the console. To open the console go to the Workspace menu and select Console.

Image


To add the script to the Workspace > Scripts menu, place the script in this folder:
  • Linux
    ~/.local/share/DaVinciResolve/Fusion/Scripts/Comp

  • macOS
    ~/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Comp

  • Windows
    %AppData%\Blackmagic Design\DaVinci Resolve\Support\Fusion\Scripts\Comp
Tested on CentOS 7.6, macOS Catalina, Windows 10 v1909. Resolve v16.1.2 (free and Studio versions), Fusion Studio v16.1.1. Fusion v9 works but might have some visual glitches.

Any feedback is welcome!

Release notes

v1.3 2022-02-23
  • New: The "See also" references are now links where possible (not clickable in Fusion 9)
  • New: The class name and inheritance hierarchy is now shown in a sticky header above the scrollable text area
  • New: Added links to matching Qt documentation (according to my best guesses) when displaying the UI classes
  • New: Option to enable verbose log for debugging
  • New: Option to always rebuild the cached data file on start (set force_update_file = true)
  • New: Support for manually added classes and class members (currently, methods are added to the Fairlight, Timeline and Timeline item classes in DaVinci Resolve)
  • New: Open Script Folder button, for easy access to the code when the script has been installed
  • New: Hover on a method return type to see if it has been given a descriptive name
  • Fixed: Tag Maps didn't work in v17+ because the table structure had changed
  • Fixed: UI issues after Qt was updated to 5.15.2

v1.2.3 2021-03-18
  • Fixed: Startup crash in Resolve/Fusion v17.1 caused by class types that are no longer available
  • Fixed: Classes containing only ignored discovered methods (like _cast) caused properties to be skipped
  • Fixed: FuPath methods weren't being discovered

v1.2.2 2020-05-14
  • Fixed: The Plugins path was incorrect for Fusion on Windows

v1.2.1 2020-05-13
  • New: Additional properties discovered automatically
  • New: Several more files are probed for methods and properties
  • Fixed: Some PreviewControl classes weren't showing in the nested view

v1.2 2020-05-10
  • New: Tag Maps and Enum Maps
  • New: Additional methods that aren't documented in the help system are now discovered automatically
  • Fixed: Fusion v9 window layout issue
  • Fixed: Fusion v9 didn't show property types when available
  • Fixed: Fusion v9 error when registry entries contained tables, added workaround for dumptostring() bug

v1.1 2020-04-02
  • Added support for showing Fusion registry entries associated with a class
  • Registry attributes have tooltips with descriptions from the Fusion 8 Scripting Guide

v1.0 2020-02-23
  • First!
Attachments
Class Browser 1.3.zip
(22.81 KiB) Downloaded 409 times
Last edited by roger.magnusson on Wed Feb 23, 2022 7:54 pm, edited 8 times in total.
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSun Feb 23, 2020 6:19 pm

Very nice. I'll test it out for sure.

Sent from my S60 using Tapatalk
www.metafide.com - DaVinci Resolve™ Apps
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSun Feb 23, 2020 10:04 pm

Nice work. It works in Windows 10. I haven't had much time to explore though. Windows users can also drop the script in
Code: Select all
%AppData%\Blackmagic Design\DaVinci Resolve\Support\Fusion\Scripts\Comp

and it will be permanently available under Workspace/Scripts dropdown menu (v16) or Fusion/Scripts in V15.
www.metafide.com - DaVinci Resolve™ Apps
Offline
User avatar

iddos-l

  • Posts: 798
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostMon Feb 24, 2020 7:07 am

Great stuff!
Tested on mac Mojave resolve 16.1.2, works great.
Thanks for this.
The hierarchy of the resolve class in the nested view is different from what I expected. From the python API docs I would expect the MediaPool object to be under the project class and so on.
Is this my lack of understanding of the objects hierarchy?
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostMon Feb 24, 2020 8:17 am

I don't know if BMD:s system for generating the help data has some manual parts in it (besides the text) or if it's entirely automatic. If it's automatic I would say it's correct.

However, just because you need a Project reference to get a MediaPool reference doesn't say anything about where they inherit from. They don't need to be related at all. Think of inheritance as "is a", as in "MediaPool is a Project". Then it should be clear that it's not correct.
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostTue Mar 31, 2020 3:14 am

While the script still works in Resolve, the latest Fusion Studio (v16.2 build 22) on macOS has an issue where any Lua script that is executed from the Script menu fails when running loops. Hopefully it will be fixed soon since this affects a ton of scripts made by the Fusion community.
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostThu Apr 02, 2020 10:13 pm

Class Browser 1.1 adds the ability to view registry attributes for Fusion classes. Download link is in the first post.
Offline
User avatar

Pieter Van Houte

  • Posts: 631
  • Joined: Wed Nov 05, 2014 1:04 am

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostMon Apr 06, 2020 5:56 am

This looks very useful indeed! You should put this in Reactor... ;)
Support We Suck Less on Patreon -> https://www.patreon.com/wesuckless

https://www.steakunderwater.com/wesuckless
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSun May 10, 2020 8:09 pm

I think the next version of the Class Browser might be worthy of a Reactor release. It's all about Fusion this time.

...and it's released today! :D
Link in the first post.

Anyone who has ever tried to make a Fuse script will appreciate this I think. The Class Browser can now discover methods that aren't listed in Fusion's built-in script help system.

Some notable Fuse-related classes to look at:
  • Operator (/Object/Operator)
    Here you will find methods like GetPrevKeyTime(t) which allows a Fuse easy access to relevant keyframe details.

  • Request (/Object/Message/Request)
    Ever needed to get the current tool inside the Fuse Process() method? GetOp() will take care of that.

  • InputControl and its sub classes (/Object/InputControl/*)
    The Tag Map (also known as TagList or Attributes) is listed for each input control. Tag Maps that use enum values have them listed here as well.

  • Image (/Object/Parameter/Image)
    95 methods that weren't visible before. :o
    Oh, and all the Tag Maps you can eat.
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostMon May 11, 2020 3:46 pm

Fantastic! Thank you so much!
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline
User avatar

robozb

  • Posts: 420
  • Joined: Wed Apr 17, 2019 6:48 am
  • Location: Hungary
  • Real Name: Roboz Bela Tamas

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSat Jul 18, 2020 10:25 am

Cooool!!! Thank you!!!
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSat Jul 18, 2020 10:58 am

This is fantastic! I've wanted to start getting into scripting and this is going to be an incredible help.

Lovely UI, too.

Please do put this in Reactor if/when you've got the time. It deserves to be seen by the biggest audience possible, and it'd be great to have automatic version management and the rest.

Thanks so much for this.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline

OlliVan

  • Posts: 29
  • Joined: Sun Jan 31, 2021 2:08 pm
  • Location: Italy
  • Real Name: Olli Vanhoja

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostThu Mar 18, 2021 10:25 am

It fails on Resolve Studio 17:

Code: Select all
...inci Resolve/Fusion/Scripts/Comp/Class Browser 1.2.2.lua:68: table index is nil
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostThu Mar 18, 2021 1:07 pm

Fixed in v1.2.3 that's now available in the first post.
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSat Mar 20, 2021 11:14 am

Class Browser is now available in Reactor as well.
Offline
User avatar

iddos-l

  • Posts: 798
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostSat Mar 20, 2021 1:57 pm

Cheers


Sent from my iPhone using Tapatalk
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostTue Mar 23, 2021 3:32 pm

Has anyone tried the Class Browser on an M1 Mac? I don't have one and I'm curious to know if the detection of methods in the binary files work as expected. If it fails it would probably just detect fewer methods without showing any warnings or errors.
Offline
User avatar

roger.magnusson

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

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostWed Feb 23, 2022 7:55 pm

The Class Browser is two years old today and we will celebrate with a new release. :D

Details and download in the first post.

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Bootstrap635, Firehouse Creative, panos_mts and 141 guests