forked from AcademySoftwareFoundation/OpenColorIO
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finds OCIO nodes with nuke.plugins() and loads them in a loop.
- Loading branch information
Showing
1 changed file
with
21 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
|
||
import nuke | ||
|
||
EBANNER = "OCIO Error: " | ||
|
||
try: | ||
import PyOpenColorIO as OCIO | ||
except Exception, e: | ||
print '%s%s' % (EBANNER, 'Loading OCIO python module') | ||
print e | ||
|
||
try: | ||
nuke.load('OCIOColorSpace') | ||
except Exception, e: | ||
print '%s%s' % (EBANNER, 'Loading OCIOColorSpace') | ||
print e | ||
|
||
try: | ||
nuke.load('OCIODisplay') | ||
except Exception, e: | ||
print '%s%s' % (EBANNER, 'Loading OCIODisplay') | ||
print e | ||
|
||
try: | ||
nuke.load('OCIOFileTransform') | ||
except Exception, e: | ||
print '%s%s' % (EBANNER, 'loading OCIOFileTransform') | ||
print e | ||
|
||
try: | ||
nuke.load('OCIOLogConvert') | ||
except Exception, e: | ||
print '%s%s' % (EBANNER, 'loading OCIOLogConvert') | ||
print e | ||
|
||
def load_ocio_plugins(): | ||
"""Loads the PyOpenColorIO module and the OCIO-prefixed nodes | ||
""" | ||
|
||
try: | ||
import PyOpenColorIO as OCIO | ||
except Exception, e: | ||
print '%s%s\n%s' % (EBANNER, 'Loading OCIO python module', e) | ||
|
||
allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib", "OCIO*.dll") | ||
|
||
for p in allplugs: | ||
try: | ||
nuke.load(p) | ||
except Exception, e: | ||
print '%sLoading OCIO node %s\n%s' % (EBANNER, p, e) | ||
|
||
|
||
if __name__ == "__main__": | ||
load_ocio_plugins() |