I am trying to find out how to get Python scripts to work with fuscript.exe to use in DaVinci Resolve 16 Fusion page and found some pieces of information on the internet here and there.
What I did: Python 3.6.8 is installed (64 bits, Window 10), I changed the windows PATH environment variable to always find fuscript.exe, and added the environment variables like this:
I try to run this basic script:
Code: Select all
import imp lib = 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll' dvr_script = imp.load_dynamic('fusionscript', lib) # Create the instances you need... resolve = dvr_script.scriptapp('Resolve') fusion = dvr_script.scriptapp('Fusion') projectManager = resolve.GetProjectManager() projectManager.CreateProject("Hello World")
I understand I got to have DaVinci Resolve running while executing the script, and so it's always open. I also have an active project open in the software which is saved. But it doesn't work when running the script with fuscript instead of the internal console.
I am using DaVinci Resolve STUDIO 16.2, so not the free version. So that is not the issue. What I don't understand though is that I've seen some people here and on the Blackmagic forum telling there is some setting that can be set to 'Local' or other (remote?), but wherever I look in my settings, I can't find any setting like this, so I'm not sure if this could be the issue. Also that setting should also be the one, according to what I find on forums, where we can enable or disable (external?) script execution. So I think it's hard to believe this setting is gone in v16 and wonder where it is now?
Also, eventhough Python 3.6.8 is installed and python 3 scripts run fine in the console, the Fusion settings have both Python version option buttons grayed out and python 2 selected, eventhough I only have python 3 installed, not version 2. I don't understand why they are grayed out, especially because the wrong version is selected (and what's the use of this selection anyway, as we can switch the version in the console?)
Also I understand by what I found on forums that the connection between fuscript and Resolve/Fusion goes by internal network (127.0.0.1 / localhost). So I switched off my firewall and security for a while to test. But that didn't help either. Also example scripts I found don't work with fuscript, but do with the internal console.
I'm having a lot of programming experience, but little on the Python system and never scripted for Resolve/Fusion as you can tell, so I have to take this hurdle now to start. I do want to use Python though, as I am familiar with the language, also use it with Blender and don't want to switch to another language like lua.
So the questions I have right now:
1) If the scripts run fine in the internal console, does it mean I can be sure the environment variables are set right? Or does the internal interpreter ignore these? Are the environment variables as set now right?
2) Where in v16.2 is the setting to turn on/off scripting and/or put it to local/external?
3) Why are the python option-buttons grayed out in the Fusion settings? And is the wrong version selected?
4) But the main question: Why is the same script working with the internal console, but not with fuscript.exe? What do I need to do to make this work?
Hope anybody here could help me with this step, as there doesn't seem to be much information out there for Python users.
Thanks in advance!!
BTW it's crazy there is so little information on this from Blackmagic Design. Thank god you guys have all these amazing information on this forum. At least 90% of what I needed to know came from this forum. Thanks for that!