forked from octimot/StoryToolkitAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python_get_resolve.py
34 lines (29 loc) · 1.54 KB
/
python_get_resolve.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""
This file serves to return a DaVinci Resolve object
"""
import sys
def GetResolve():
try:
# The PYTHONPATH needs to be set correctly for this import statement to work.
# An alternative is to import the DaVinciResolveScript by specifying absolute path (see ExceptionHandler logic)
import DaVinciResolveScript as bmd
except ImportError:
if sys.platform.startswith("darwin"):
expectedPath="/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules/"
elif sys.platform.startswith("win") or sys.platform.startswith("cygwin"):
import os
expectedPath=os.getenv('PROGRAMDATA') + "\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting\\Modules\\"
elif sys.platform.startswith("linux"):
expectedPath="/opt/resolve/libs/Fusion/Modules/"
# check if the default path has it...
print("Unable to find module DaVinciResolveScript from $PYTHONPATH - trying default locations")
try:
import imp
bmd = imp.load_source('DaVinciResolveScript', expectedPath+"DaVinciResolveScript.py")
except ImportError:
# No fallbacks ... report error:
print("Unable to find module DaVinciResolveScript - please ensure that the module DaVinciResolveScript is discoverable by python")
print("For a default DaVinci Resolve installation, the module is expected to be located in: "+expectedPath)
sys.exit()
return bmd.scriptapp("Resolve")