Resolve Scripting Documentation

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

ElLudo

  • Posts: 2
  • Joined: Fri Aug 31, 2018 1:58 pm
  • Real Name: Ludovic Lebart

Resolve Scripting Documentation

PostFri Aug 31, 2018 2:14 pm

Hi,

I would like to start scripting in resolve but I can't find the api documentation...
I'm also looking for a step by step for installin an external editor for lua, where we need to store the modules ect...

Thank you for your help !
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 13875
  • Joined: Wed Aug 22, 2012 7:08 am

Re: Resolve Scripting Documentation

PostMon Sep 03, 2018 8:16 am

Help menu, dev documentation is all we currently have.
DaVinci Resolve Product Manager
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostTue Sep 04, 2018 7:33 pm

Peter Chamberlain wrote:Help menu, dev documentation is all we currently have.


Sadly that's not very much.
Especially on Windows.
The 3 environment variables are wrong. They must not contain quotation marks.

It does not explain much about executing scripts.
(script menu only works in the fusion tab. New users wonder why their scripts are greyed and cannot be clicked.)

What command line parameters does fuscript.exe accept? It's neither documented nor does it react to a Windows "/?" or a Unix "--help".

Where is the python executable? A Windows user would not expect "#!/usr/bin/env python" to work without a unix-shell or a /usr/bin/env exexcutabe. That you can run .py files because they are associated with the installed python as documents is not intuitive.)

The supplied sample scripts do not work when one has finally pieced together how to do this.

Code: Select all
set RESOLVE_SCRIPT_API=%PROGRAMDATA%\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting\\
set RESOLVE_SCRIPT_LIB=C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll
set PYTHONPATH=%PYTHONPATH%;%RESOLVE_SCRIPT_API%\\Modules\\

echo %PYTHONPATH%
%PYTHONPATH%;C:\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting\\\\Modules\\

"C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Examples\5_get_project_information.py"
Traceback (most recent call last):
  File "C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Examples\5_get_project_information.py", line 67, in <module>
    projectManager = resolve.GetProjectManager()
AttributeError: 'NoneType' object has no attribute 'GetProjectManager'
Last edited by MarcusWolschon on Tue Sep 24, 2019 10:31 am, edited 1 time in total.
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostWed Sep 05, 2018 6:32 am

These two videos may offer some insight.

Resolve scripting intro:


Scripting over Internet:
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostWed Sep 05, 2018 6:39 am

Been there, seen that.
It doesn't cover any of the this and 3rd party YouTube videos don't improve Blackmagic's documentation.
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 12:03 am

Just trying to help. I hear your frustration. I struggle with the lack of documentation too, but you have to consider that scripting is of interest to a small subset of Resolve users and therefore probably not a priority item for BMD.

I've been focused on developing standalone apps that connect to the API. To expedite the process I have ignored parts of the documentation. Therefore my recommendations are not canonical, but...

Regarding the PATH variable, I ignore it. You can dynamically import fusionscript.dll or fusionscript.so because you know where they reside based on the OS. In fact, BMD provides GetDaVinciResolve.py that does just that.

The Windows Python interpreter typically resides in C:\Python[x], where 'x' is the version number. It's a standard Windows practice that files with .py extension are associated with python.exe in this location. The shebang line is ignored. There could be variations when using virtual environments, I don't know how that works in Windows.

Which sample scripts did you find to fail? I don't remember if I ran them, but I can try. Here are a few more sample scripts: https://github.com/IgorRidanovic?tab=repositories
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 4:45 am

Igor Riđanović wrote:Which sample scripts did you find to fail?


See above.
5_get_project_information.py
and
4_display_project_and_folder_tree.py
fail with the same error.
It finds the module DaVinciResolveScript (else it would complain) but
bmd.scriptapp("Resolve") seems to return something with no type.
(Maybe it's the python version of null/nil/none/... . This isn't a language I usually work with.)

Thee is no c:\Python and I don't think that's a place where Microsoft would want any user programs to install binaries. That's what %ProgramFiles% and %ProgramFiles(x86)% are for.
Offline

Hendrik Proosa

  • Posts: 3015
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 8:29 am

MarcusWolschon wrote:Thee is no c:\Python and I don't think that's a place where Microsoft would want any user programs to install binaries. That's what %ProgramFiles% and %ProgramFiles(x86)% are for.

Python is usually by default installed just there, Microsoft wanting something is irrelevant, they are all just folders. Program files folder has spaces in directory path and as stupid as it is, can still cause additional fiddling in some cases.
I do stuff.
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 8:35 am

Hendrik Proosa wrote:
MarcusWolschon wrote:Thee is no c:\Python and I don't think that's a place where Microsoft would want any user programs to install binaries. That's what %ProgramFiles% and %ProgramFiles(x86)% are for.

Python is usually by default installed just there, Microsoft wanting something is irrelevant, they are all just folders. Program files folder has spaces in directory path and as stupid as it is, can still cause additional fiddling in some cases.
only in English versions of Windows and in Windows 8/10 (where the translations are handled in Explorer and the folder always has the same name).

Still, the most pressing issue is getting that null value instead of a reference to Resolve. And when we have a solution to get that and the other details into the README file distributed to other developers.
Last edited by MarcusWolschon on Tue Sep 24, 2019 10:30 am, edited 1 time in total.
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 6:35 pm

Marcus,

Can you launch the Python interpreter and try these statements:

Code: Select all
import imp

imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')


What happens after you run the second line above?
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 7:01 pm

Igor Riđanović wrote:Marcus,

Can you launch the Python interpreter and try these statements:

Code: Select all
import imp

imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')


What happens after you run the second line above?


Code: Select all
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
>>> imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')
<module 'fusionscript' from 'C:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll'>
>>> import DaVinciResolveScript as bmd
>>> resolve = bmd.scriptapp("Resolve")
>>> projectManager = resolve.GetProjectManager()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'GetProjectManager'
>>>
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 7:15 pm

That's all good. You're able to import the library. But something is wrong with the 'resolve' instance. You should try bypassing the DaVinciResolveScript.py altogether for troubleshooting. I'm not near a v15 to test this, but try something like this in the interpreter with Resolve running:

Code: Select all
import imp
smodule = imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')
resolve = smodule.scriptapp('Resolve')
...
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 7:27 pm

Same result with imp.load_dynamic.
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 7:35 pm

Do you have 64-bit Python? And you have Resole 15 running when you call GetProjectManager()?
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 7:55 pm

Igor Riđanović wrote:Do you have 64-bit Python? And you have Resole 15 running when you call GetProjectManager()?


Python 2.7.13 (64 Bit)

Yes, Resolve 15 is running and has a project open.
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 8:00 pm

As long as that's Resolve Studio, not the free version, I'm out of ideas.
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Sep 06, 2018 8:02 pm

Igor Riđanović wrote:As long as that's Resolve Studio, not the free version, I'm out of ideas.


Well, yes, it's Studio, the menu is there and the dongle is present. :(
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostSun Sep 09, 2018 7:06 pm

MarcusWolschon wrote:5_get_project_information.py
and
4_display_project_and_folder_tree.py


I just tested both. They work.

NoneType object is basically None, Nil. Something's not right with your resolve object. But I can't tell what's causing it. For example, if Resolve were not running you'd get the same exception. But you are running Resolve Studio, so that's not it.
www.metafide.com - DaVinci Resolve™ Apps
Online

Shrinivas Ramani

Blackmagic Design

  • Posts: 2714
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Resolve Scripting Documentation

PostMon Sep 10, 2018 2:45 am

Could I check:
a. if your setting for External Scripting (under Preferences > System Configuration) is set to None?
b. if you get None when using your code inside the Console (excluding the library loading bits)?
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostWed Sep 12, 2018 3:43 pm

Marcus,

How did you install your Python 2.7? Where did you get it from?
www.metafide.com - DaVinci Resolve™ Apps
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostWed Sep 12, 2018 4:01 pm

Igor Riđanović wrote:Marcus,

How did you install your Python 2.7? Where did you get it from?


I don't know.
If the Resolve installer didn't ask me if I wanted it installed, it was on this system a while.
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostWed Sep 12, 2018 6:45 pm

Shrinivas Ramani wrote:Could I check:
a. if your setting for External Scripting (under Preferences > System Configuration) is set to None?
b. if you get None when using your code inside the Console (excluding the library loading bits)?


a) it is set to "Local"
Offline

tacman1123

  • Posts: 36
  • Joined: Tue Sep 25, 2018 4:18 pm
  • Real Name: Tac Tacelosky

Re: Resolve Scripting Documentation

PostSun Oct 07, 2018 12:38 pm

Hi, joining this thread because I'm going through the same sequence of frustrating experiments trying to get scripting configured and any of the sample scripts to work.

I've read (and heard in Igor's video) that the environment variables are wrong in the documentation. I'm just back to Windows after 6 years of Ubuntu, and am not enjoying being back. Maddening, the quotes and double-backlash and spaces in filenames for defaults.

So it's likely I haven't set the environment variables correctly.

When I open a Command Prompt, these are the env var:

Code: Select all
PYTHONPATH=C:\Python27;%RESOLVE_SCRIPT_API%\\Modules\\;
RESOLVE_SCRIPT_API="C:\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting"
RESOLVE_SCRIPT_LIB="C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll"


Another indication that something is wrong is that when I open the console (Workspace | Console), the info icon and the gear icon don't do anything. I'm supposing that the gear (Console Settings?) icon would let me see things like that path to the interpretters, but nothing. Also, I tried changing the scripting location from "None" to "Local" but it doesn't stick, it goes back to None. Not sure what that setting does anyway.

When I try to run the python script from the command like (or from PyCharm), I can't load the Resolve module.

Although I have a lot of programming experience, the combination of not knowing Python and not know Windows env / modules is killing me. I've already spent a few hours on this, bought this computer specifically to run Resolve, bought Resolve Studio specifically to run scripts, and am now stuck.

Any help would be greatly appreciated.

Thanks,

Tac
Attachments
Capture1.PNG
Capture1.PNG (40.93 KiB) Viewed 18825 times
Offline

tacman1123

  • Posts: 36
  • Joined: Tue Sep 25, 2018 4:18 pm
  • Real Name: Tac Tacelosky

Re: Resolve Scripting Documentation

PostSun Oct 07, 2018 1:12 pm

FWIW, here's my environment variables from within the Python 2.7 Terminal on Windows 10.

I'm confused about the \\, and why the RESOLVE_ variables use them but most of the others don't.



Code: Select all
>>> for param in os.environ.keys():
...     print "%20s %s" % (param, os.environ[param])
...
                 TMP C:\Users\tacma\AppData\Local\Temp
  RESOLVE_SCRIPT_API "C:\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting"
        COMPUTERNAME DESKTOP-HKFMDJT
          USERDOMAIN DESKTOP-HKFMDJT
        PSMODULEPATH C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
  COMMONPROGRAMFILES C:\Program Files\Common Files
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
        PROGRAMFILES C:\Program Files
  PROCESSOR_REVISION 9e0a
          SYSTEMROOT C:\Windows
                PATH C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;c:\Python27;C:\Users\tacma\AppData\Local\Microsoft\WindowsApps;
   PROGRAMFILES(X86) C:\Program Files (x86)
             COMSPEC C:\Windows\system32\cmd.exe
          DRIVERDATA C:\Windows\System32\Drivers\DriverData
                TEMP C:\Users\tacma\AppData\Local\Temp
COMMONPROGRAMFILES(X86) C:\Program Files (x86)\Common Files
PROCESSOR_ARCHITECTURE AMD64
     ALLUSERSPROFILE C:\ProgramData
  RESOLVE_SCRIPT_LIB "C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll"
        LOCALAPPDATA C:\Users\tacma\AppData\Local
            HOMEPATH \Users\tacma
USERDOMAIN_ROAMINGPROFILE DESKTOP-HKFMDJT
        PROGRAMW6432 C:\Program Files
            USERNAME tacma
         LOGONSERVER \\DESKTOP-HKFMDJT
              PROMPT $P$G
         SESSIONNAME Console
         PROGRAMDATA C:\ProgramData
          PYTHONPATH C:\Python27;%RESOLVE_SCRIPT_API%\\Modules\\;
            ONEDRIVE C:\Users\tacma\OneDrive
             PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
              WINDIR C:\Windows
             APPDATA C:\Users\tacma\AppData\Roaming
           HOMEDRIVE C:
         SYSTEMDRIVE C:
NUMBER_OF_PROCESSORS 12
     PROCESSOR_LEVEL 6
  COMMONPROGRAMW6432 C:\Program Files\Common Files
                  OS Windows_NT
              PUBLIC C:\Users\Public
         USERPROFILE C:\Users\tacma
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostMon Oct 08, 2018 5:34 pm

The double slash is there because a single '\' is the escape character. When specifying Windows paths you need to use the double slash.

As an alternative to using slashes at all you may want to use os.path.join() instead. It's kind of cleaner anyway and OS portable, although that doesn't buy us anything here.

I abandoned using the system env variables. Scripts depending on them aren't portable. You can't expect the variables will be setup correctly or at all on another host.

Instead I just use imp to load the fusionsctript.so or fusionscript.dll directly because I know where it resides. But you don't even need that if you're testing from the command line. From the command line:
Code: Select all
cd C:\Program Files\Blackmagic Design\DaVinci Resolve\

This is where fusionscript.dll resides. Execute python. In the Python interpreter you can:
Code: Select all
import fusionscript as dvr
resolve = dvr.scriptapp('Resolve')

And there you have the Resolve instance from which you build all other objects.
www.metafide.com - DaVinci Resolve™ Apps
Offline

firegreen

  • Posts: 7
  • Joined: Thu Oct 04, 2018 2:38 pm
  • Real Name: Steeve VINCENT

Re: Resolve Scripting Documentation

PostWed Oct 17, 2018 3:28 pm

Hi guys,

I wake up a little bit this thread ;)
I see the UITimer object thanks to FusionScript Help Browser.
Did anyone know how to use it?

captureResolve2.jpg
captureResolve2.jpg (154 KiB) Viewed 18723 times


Steeve
Offline

tacman1123

  • Posts: 36
  • Joined: Tue Sep 25, 2018 4:18 pm
  • Real Name: Tac Tacelosky

Re: Resolve Scripting Documentation

PostWed Oct 17, 2018 3:57 pm

How do you open the FusionScript Help Browser?
Offline

firegreen

  • Posts: 7
  • Joined: Thu Oct 04, 2018 2:38 pm
  • Real Name: Steeve VINCENT

Re: Resolve Scripting Documentation

PostThu Oct 18, 2018 8:57 am

This is an external script made by Andrew Hazelden and Peter Loveday.
https://www.steakunderwater.com/wesuckless/viewtopic.php?p=11343#p11343
I just drag and drop it into Fusion.

Steeve
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Nov 29, 2018 6:02 pm

Since we're at Resolve 15.2 now, I'm trying again.
There are tedious and repetitive jobs ahead that I simply want to script.

Removed Python 2.7
Fresh install of Python 3.6.7 64Bit.
Set "external scripting using" to "Network" instead of "local"

Still the same issues as before.

Code: Select all
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
>>> smodule = imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')
>>> resolve = smodule.scriptapp('Resolve')
>>> projectManager = resolve.GetProjectManager()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'GetProjectManager'
>>>


Why won't this work?

Also I have Fusion->Script but the Fusion->Console menu item is gone.
Offline

Reynaud Venter

  • Posts: 4910
  • Joined: Sun May 28, 2017 9:34 am

Re: Resolve Scripting Documentation

PostThu Nov 29, 2018 6:31 pm

MarcusWolschon wrote:Also I have Fusion->Script but the Fusion->Console menu item is gone.
This has been shifted to the Workspace menu.
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Nov 29, 2018 6:47 pm

Ok, in the scripting console it's not null.
But I have no way to execute script files there. Only what I type.

I have the 5_get_project_information.py script in my scripts menu,
but executing it shows no console with any output OR error.

In python outside Resolve, I could execute scripts but I get null as as outlined above. :(
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostThu Nov 29, 2018 7:02 pm

Ok,
the following works in the console window to execute a script file in the file system:

Code: Select all
exec(open('C:/ProgramData/Blackmagic Design/DaVinci Resolve/Support/Developer/Scripting/Examples/test.py').read())


where test.py is one of the example scripts with
the import for GetResolve removed and
the call to GetResolve() replaced by

Code: Select all
import DaVinciResolveScript as dvr_script
resolve = dvr_script.scriptapp("Resolve")


This is ugly but at least it could allow people with the same problem to get any actual work done
with just a single line to copy&paste instead of typing their fingers bloody..
Offline

pravrav

  • Posts: 2
  • Joined: Mon Oct 14, 2019 8:37 pm
  • Real Name: Praveen Ravi

Re: Resolve Scripting Documentation

PostMon Oct 14, 2019 8:42 pm

Hi All,
Im new to BM Resolve scripting. Most of the paths and class paths mentioned here are for windows. Where can i find the corresponding readme that has the class path information in Mac?
Offline

Reynaud Venter

  • Posts: 4910
  • Joined: Sun May 28, 2017 9:34 am

Re: Resolve Scripting Documentation

PostWed Oct 16, 2019 9:12 am

pravrav wrote:Where can i find the corresponding readme that has the class path information in Mac?
All the developer documentation is available from the Help menu within Resolve.
Offline

MarcusWolschon

  • Posts: 801
  • Joined: Sun Apr 14, 2013 6:59 pm

Re: Resolve Scripting Documentation

PostWed Oct 16, 2019 10:29 am

Reynaud Venter wrote:
pravrav wrote:Where can i find the corresponding readme that has the class path information in Mac?
All the developer documentation is available from the Help menu within Resolve.


So all that can't be found there, simply doesn't exist.
The Scripting API is extremely limited and highly underdocumented.
Offline
User avatar

ChrisTollefson

  • Posts: 2
  • Joined: Sat Mar 07, 2020 6:58 am
  • Real Name: Chris Tollefson

Re: Resolve Scripting Documentation

PostSat Mar 07, 2020 10:27 am

For reference, the scripting API "README.txt" file and examples are in the following locations on my systems:

Windows
Windows 10 (64-bit, version 1909, build 18363.693)
DaVinci Resolve Studio 16 (version 16.1.2.026)
Code: Select all
"%ProgramData%\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting"
...which is usually...
"C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting"

macOS
macOS High Sierra (64-bit, version 10.13.6) — I know, doesn't meet the minimum system requirements.
DaVinci Resolve 16 (version 16.2)
Code: Select all
"/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting"

Linux
CentOS Linux (64-bit, version 8.1.1911)
DaVinci Resolve 16 (version 16.2)
Code: Select all
"/opt/resolve/Developer/Scripting"

And not sure if this is helpful, but here's an old Fusion 8 Scripting Guide and Reference Manual from February 2016, which seems to go into a lot more detail about scripting in Fusion with Lua and Python (but obviously, some of it might not be applicable anymore):
  • https://documents.blackmagicdesign.com/UserManuals/Fusion8_Scripting_Guide.pdf
Offline

strombergdev

  • Posts: 2
  • Joined: Wed Apr 22, 2020 9:08 am
  • Real Name: Max Strömberg

Re: Resolve Scripting Documentation

PostWed Apr 22, 2020 9:47 am

Realised after many attempts that for windows loading fusionscript only works on python 3.6. Python crashes when trying to do it with 3.7. However, on mac I got it working with Python 3.7.
Offline
User avatar

iddos-l

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

Re: Resolve Scripting Documentation

PostWed Apr 22, 2020 3:51 pm

strombergdev wrote:Realised after many attempts that for windows loading fusionscript only works on python 3.6. Python crashes when trying to do it with 3.7. However, on mac I got it working with Python 3.7.


Very interesting.
It was my understanding 3.7 is not supported at all.
Will try it out myself.
Thanks.


Sent from my iPhone using Tapatalk
Offline

oli_256

  • Posts: 7
  • Joined: Sat Feb 01, 2020 1:47 pm
  • Real Name: Olivier Lau

Re: Resolve Scripting Documentation

PostFri May 22, 2020 3:00 pm

Hey guys,

I had the issue mentioned above - DaVinciResolveScript.scriptapp("Resolve") returning None when running script from Workspace/Scripts menu (I am using Python 3.6 on Windows 10). I am using Resolve 16.2.2 Studio on Windows 10. I managed to fix the issue by setting "Preferences/General/External Scripting Using" to "Local" (default was set to None).

Other issues I had:
- Python 3.6 is required but not available to download anymore as a Windows installer at python.org. However it can be grabbed from their FTP.
- env paths set in README.txt file were not working for me so I configured the env. variables with full paths.

Other notes:
- timeline GetMarkers() is not returning keywords associated to markers.
- there is no function to convert frames to timecodes. Hopefully Igor Riđanović was kind enough to write and open source a class for this conversion, many thanks to him. However such utility function should be present in the API.

BM Team: please bring us an update to scripting, it took me hours to figure out all these problems. In particular you need to upgrade to a newer Python3 version, update the docs for all the things that are causing users difficulties, update the API to support the current feature set as most as possible.
Offline
User avatar

dev_willis

  • Posts: 118
  • Joined: Sun May 03, 2020 5:14 pm
  • Location: Lebanon, TN
  • Real Name: David Willis

Re: Resolve Scripting Documentation

PostSat Jul 18, 2020 9:26 pm

3.6 is actually available to download; you just have to scroll down the page a bit. Versions 3.6.9, 3.6.10 and 3.6.11 have no files associated with them for some reason but 3.6.8 does. Just search in the page for it.

My question is, where can I find out what version of Python the current version of Resolve supports? I've read some things that indicate that 3.7 might be supported by now but I've searched and searched and can find no documentation on this anywhere at all. The README that passes for dev docs doesn't mention anything about Python versions. The software specs on the website don't mention anything about Python versions. Forum posts from a year or two ago are all I can turn up. I don't really need to know this, 3.6 is fine with me, but it sure seems like pertinent information that should be available somewhere. Especially if the current version breaks Resolve's implementation.
  • Windows 10 Pro 22H2, Resolve Studio 18.5.1, Nvidia Studio Driver 536.4
  • Threadripper 3960X, RTX 3090 FE, 64GB RAM, 3x 980PRO SSDs
  • Threadripper 1920X, GTX 1070 Ti, 32GB RAM, 3x 960PRO SSDs
  • TrueNAS Mini XL+ 64TB media server
  • Mac Mini M1 project server
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostSun Jul 19, 2020 6:59 am

If you're executing external scripts the Python version is up to you. If you're executing internally, Resolve Fusion settings Script preference is stuck at 2.7. The internally run scripts ignore the shebang line.
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: Resolve Scripting Documentation

PostSun Jul 19, 2020 7:14 am

Igor Riđanović wrote:If you're executing external scripts the Python version is up to you. If you're executing internally, Resolve Fusion settings Script preference is stuck at 2.7. The internally run scripts ignore the shebang line.

Yes it will ignore the shebang line but you can manually choose the default python version in the fusion setting.
Also I thing the environment variables will overwrite the default 2.7 as well.

But this whole thing really needs to be documented clearly in the papers.


Sent from my iPhone using Tapatalk
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostSun Jul 19, 2020 4:05 pm

iddos-l wrote:
Igor Riđanović wrote:If you're executing external scripts the Python version is up to you. If you're executing internally, Resolve Fusion settings Script preference is stuck at 2.7. The internally run scripts ignore the shebang line.

Yes it will ignore the shebang line but you can manually choose the default python version in the fusion setting.
Also I thing the environment variables will overwrite the default 2.7 as well.

But this whole thing really needs to be documented clearly in the papers.


Sent from my iPhone using Tapatalk
My env is set to Anaconda but Resolve uses the stock Python. The Fusion preference is greyed out on MacOS. You can change yours?

Sent from my S60 using Tapatalk
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: Resolve Scripting Documentation

PostSun Jul 19, 2020 5:45 pm

Igor Riđanović wrote: My env is set to Anaconda but Resolve uses the stock Python. The Fusion preference is greyed out on MacOS. You can change yours?

Funny, mine is greyed out on Windows and on my Mac I can change to python3.
I don’t use Anaconda but my env variables on the windows system is overwriting the 2.7 and I am using 3.6 on both systems.


Sent from my iPhone using Tapatalk
Offline
User avatar

dev_willis

  • Posts: 118
  • Joined: Sun May 03, 2020 5:14 pm
  • Location: Lebanon, TN
  • Real Name: David Willis

Re: Resolve Scripting Documentation

PostFri Aug 07, 2020 4:56 pm

Igor Riđanović wrote:If you're executing external scripts the Python version is up to you. If you're executing internally, Resolve Fusion settings Script preference is stuck at 2.7. The internally run scripts ignore the shebang line.

Interesting. I found the Fusion script settings and I see what you mean about it being stuck on 2.7, however in the Resolve Console window you can still select "Py3," though there's no mention of minor version. I would assume it's 3.6 since that's the other option in the settings window but I've learned not to assume things.
  • Windows 10 Pro 22H2, Resolve Studio 18.5.1, Nvidia Studio Driver 536.4
  • Threadripper 3960X, RTX 3090 FE, 64GB RAM, 3x 980PRO SSDs
  • Threadripper 1920X, GTX 1070 Ti, 32GB RAM, 3x 960PRO SSDs
  • TrueNAS Mini XL+ 64TB media server
  • Mac Mini M1 project server
Offline
User avatar

Igor Riđanović

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

Re: Resolve Scripting Documentation

PostFri Aug 07, 2020 5:19 pm

The Resolve console selection does not determine which interpreter is used when you run a script from the dropdown menu.

In the console you can use sys.version to tell which exact interpreter you're using.
www.metafide.com - DaVinci Resolve™ Apps

Return to DaVinci Resolve

Who is online

Users browsing this forum: davidrwb, SkierEvans and 166 guests