Page 1 of 1

Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Sun Feb 23, 2020 3:38 pm
by roger.magnusson
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.

Class Browser in Flat View mode

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

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.


To add the script to the Workspace > Scripts menu, place the script in this folder:
  • Linux

  • 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.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!

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Sun Feb 23, 2020 6:19 pm
by Igor Riđanović
Very nice. I'll test it out for sure.

Sent from my S60 using Tapatalk

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Sun Feb 23, 2020 10:04 pm
by Igor Riđanović
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.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Mon Feb 24, 2020 7:07 am
by iddos-l
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?

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Mon Feb 24, 2020 8:17 am
by roger.magnusson
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.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Tue Mar 31, 2020 3:14 am
by roger.magnusson
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.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Thu Apr 02, 2020 10:13 pm
by roger.magnusson
Class Browser 1.1 adds the ability to view registry attributes for Fusion classes. Download link is in the first post.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Mon Apr 06, 2020 5:56 am
by Pieter Van Houte
This looks very useful indeed! You should put this in Reactor... ;)

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Sun May 10, 2020 8:09 pm
by roger.magnusson
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.

Re: Script: Class Browser for DaVinci Resolve/Fusion

PostPosted: Mon May 11, 2020 3:46 pm
by Bryan Ray
Fantastic! Thank you so much!