Documentation Davinci Resolve Scripting

foxdanger
Posts: 1
Joined: Sat Jun 15, 2019 4:30 pm

Documentation Davinci Resolve Scripting

Hi guys. Trying to create something here and I didn't understood yet how Davinci Resolve Scripting really works.

Tried to found in all internet the documentation for the API. So with that I could know what I can and what I Can't do.

But there's nothing. I can't find any information or documentation about it. Only for old versions of fusion.

So, How I'm suposed to know the function names, how to get a button, how to send a command and etc?

For example: Can I create a script which increments contrast with one click in a button? Can I create a script to turn the gain wheel to left or to right? Can I control the color wheels with a script?

And if I can, how? Where is the documentation to learn the functions and etc?

Thank you for any help.

SecondMan
Posts: 3489
Joined: Thu Jul 31, 2014 5:31 pm
Been thanked: 95 times
Contact:

Re: Documentation Davinci Resolve Scripting

There's not much, currently. Documentation is in progress, I hear, but no ETA has been given.

The venerable @Greg Bovine made a pretty spectacular intro to Scripting in Resolve here: viewtopic.php?f=35&t=2012

I don't know if you've already seen it, but if not I suggest you start there and see if answers some of your questions?
foxdanger wrote:
Sat Jun 15, 2019 4:34 pm
Can I create a script which increments contrast with one click in a button? Can I create a script to turn the gain wheel to left or to right? Can I control the color wheels with a script?
I have not seen examples of this. So I have no idea if that is possible already, or if it will be

What you could do is send an email to support@blackmagicdesign.com with your questions (and then report back with their answers)

Hope this helps.

Out of interest, what specifically are you trying to do that you want scripting access to those controls for?

Igor Ridanovic
Posts: 24
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Documentation Davinci Resolve Scripting

All API methods are documented in the readme.txt. You can locate it by going to Resolve Help/Developers menu.

It is not directly possible to control any parameter values within Resolve color page. Depending on what you need done you may get by using a method called ApplyGradeFromDRX(). It applies a grade specified in a DRX file to a clip on the timeline.

This intro video shows Resolve scripting using Python. I have a couple of other videos that touch the subject there as well.

sgsgesgg
Posts: 5
Joined: Mon Jun 17, 2019 6:18 pm

Re: Documentation Davinci Resolve Scripting

@Igor Ridanovic

i cant import DaVinciResolveScript

i get an error: ModuleNotFoundError: No module named 'DaVinciResolveScript'

What do i do? what do i import?

edit: on win 10 and using DR 16

AndrewHazelden
Fusionator
Posts: 1329
Joined: Fri Apr 03, 2015 3:20 pm
Location: West Dover, Nova Scotia, Canada
Been thanked: 41 times
Contact:

Re: Documentation Davinci Resolve Scripting

As a quick double-check, are you running Resolve Studio? Did you enable scripting access in Resolve's preference window?

The free version of Resolve has limitations where it doesn't allow you to control areas outside of the Fusion page via scripting, and you can't externally access Resolve's scripting API via Fuscript/Python from a command prompt/terminal session.

Igor Ridanovic
Posts: 24
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Documentation Davinci Resolve Scripting

You can see in the script examples folder how BMD do it. But it can be simpler if you just care about Windows. Since you know where the library is located you can use imp to import it.
1. import imp
2. lib = 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll'
4.
5. # Create the instances you need...
6. resolve = dvr_script.scriptapp('Resolve')
7. fusion   = dvr_script.scriptapp('Fusion')

sgsgesgg
Posts: 5
Joined: Mon Jun 17, 2019 6:18 pm

Re: Documentation Davinci Resolve Scripting

from the above code i get: ImportError: DLL load failed: %1 is not a valid Win32 application.

Igor Ridanovic
Posts: 24
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Documentation Davinci Resolve Scripting

Are you maybe using 32-bit Python? I wasn't aware 64-bit Python is a requirement, but maybe it is.

sgsgesgg
Posts: 5
Joined: Mon Jun 17, 2019 6:18 pm

Re: Documentation Davinci Resolve Scripting

i didnt think i was

but ive updated to the current version, had to change imp to importlib
and dvr_script = importlib.import_module('fusionscript', lib)

and now i get: ModuleNotFoundError: No module named 'fusionscript'

Iddos
Posts: 15
Joined: Sat Oct 06, 2018 4:21 pm
Been thanked: 2 times

Re: Documentation Davinci Resolve Scripting

Hi

What python version are you using?

Python 3 doesn’t support imp in some versions, I think above 3.4.
And I think resolve supports up till 3.6
Try 2.7 with imp.

This can also be a environmental thing.
Did you set the environment variable in windows path?

sgsgesgg
Posts: 5
Joined: Mon Jun 17, 2019 6:18 pm

Re: Documentation Davinci Resolve Scripting

i think i put the variables in the right spot
i changed my python version to 3.6 but i cant open the console in resolve, it says i need python 3.6 ...
imp works but i cant get DaVinciResolveScript, i get: ModuleNotFoundError: No module named 'DaVinciResolveScript'

Igor Ridanovic
Posts: 24
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Documentation Davinci Resolve Scripting

sgsgesgg wrote:
Mon Jun 17, 2019 7:39 pm

and now i get: ModuleNotFoundError: No module named 'fusionscript'
I can't exactly repro. I'm on Linux machine without Resolve right now. But if I try to import a module that's not there I get:

ImportError: /opt/resolve/libs/Fusion/fusionscript.so: cannot open shared object file: No such file or directory

This is Python 2.7.6. Although the error is not the same as yours I think both mean the same thing. The module is missing. Check if the .dll is in that path.

sgsgesgg
Posts: 5
Joined: Mon Jun 17, 2019 6:18 pm

Re: Documentation Davinci Resolve Scripting

fusionscript.dll? its in there

edit:
so the script now doesnt give any errors, but it also doesnt do anything. it runs and gives a 'press any key to continue'. no project is created when resolve is open.

Code: Select all

import imp
lib = r'C:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll'
resolve = dvr_script.scriptapp("Resolve")
fusion = resolve.Fusion()
projectManager = resolve.GetProjectManager()
projectManager.CreateProject("Hello World")

Iddos
Posts: 15
Joined: Sat Oct 06, 2018 4:21 pm
Been thanked: 2 times

Re: Documentation Davinci Resolve Scripting

Try assignment.
myProject = projectManager.CreateProject("Hello World")

Igor Ridanovic
Posts: 24
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Documentation Davinci Resolve Scripting

The only time I came across that is when the project settings or preferences windows are open in Resolve Studio. You're using the Resolve Studio, not Resolve, right?

The assignment won't make a difference, but if you do:
1. myProject = projectManager.CreateProject("Hello World")
2. print myProject
You'll at least be able to tell if myProject is a valid object. The exception reporting from the API can be very silent.