Page 1 of 1

Python scripting in Resolve 15

PostPosted: Mon Apr 16, 2018 12:28 pm
by Nick Shaw
Is this the right place to look for help on Resolve scripting?

I am a bit of a noob to this, so I may well be doing something stupid.

Code: Select all
DaVinciResolveScript.scriptapp("Resolve")
returns a None object, so I can't then do anything with it.
Code: Select all
AttributeError: 'NoneType' object has no attribute 'GetProjectManager'

The example scripts fail for this same reason.

However,
Code: Select all
DaVinciResolveScript.scriptapp("Fusion")
returns a FusionUI object, so the module would appear to have loaded.

I do get a bunch of warnings when importing the module:
Code: Select all
dyld: warning, LC_RPATH @executable_path/../Libraries/Fusion in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/. in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/libluajit-5.1.2.dylib being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/../Libraries/Fusion in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/libluajit-5.1.2.dylib being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/. in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/libluajit-5.1.2.dylib being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/../Libraries/Fusion in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/. in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/../Libraries/Fusion in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path
dyld: warning, LC_RPATH @executable_path/. in /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so being ignored in restricted program because of @executable_path

Re: Python scripting in Resolve 15

PostPosted: Tue Apr 17, 2018 11:06 am
by Nick Shaw
Update, I got the errors mentioned above when trying to use scripting through a standard Terminal Python shell (under OS X) but when I run fuscript in interactive mode I have more success (/Applications/DaVinci\ Resolve/DaVinci\ Resolve.app/Contents/Libraries/Fusion/fuscript -l py2 -i). I discovered this via a post on steakunderwater.com although I can't see any mention of fuscript in the Resolve scripting README.

I'm sure yesterday I had the same problems using the console within Resolve, but today it seems to work! So maybe I missed something yesterday.

I am able to work through the steps from the 1_sorted_timeline_from_folder.py example script, and it seems mainly to work. I can create a project and add the clips to a timeline. There are a few things I am still unsure of, but I am feeling my way, and it may well be user error.

project.SetResolution(2048, 1152) sets the Timeline Resolution (as shown in the Project Settings panel) to 2048x1152, but then running timeline = mediapool.CreateEmptyTimeline("Test Timeline 1") creates a new timeline which is still 1920x1080, per defaults. But if the resolution is set via scripting, creating a new timeline by pressing CMD-N also produces a 1080p timeline, so maybe there is somewhere else that I need to set it to 2k as well.

project.SetFrameRate(25) sets the timeline framerate to 25, but the Playback Framerate stays at the default 24, and I can't find a way of setting that via scripting.

If this is a bug, I was just luck that a chose a folder of 2kp25 clips to test with. If they had been 1080p24, I would not have noticed.

Re: Python scripting in Resolve 15

PostPosted: Tue Apr 17, 2018 11:50 am
by Nick Shaw
…and now it works in a standard Python shell in Terminal as well!

Maybe it's because I restarted the machine. Maybe it's because I ran fuscript first. Who knows, but it works!

I can still only create a 1080p timeline that plays back at 24fps, but it's a good start.

Onwards and upwards!

Re: Python scripting in Resolve 15

PostPosted: Mon Apr 23, 2018 3:25 pm
by Nick Shaw
Has anybody found out if there are any methods enabled in Resolve scripting which are not listed in the ReadMe? Particularly ones for rendering.