Skip to content

Commit

Permalink
Tidier Nuke init.py
Browse files Browse the repository at this point in the history
Finds OCIO nodes with nuke.plugins() and loads them in a loop.
  • Loading branch information
dbr committed Jan 11, 2011
1 parent 131efac commit 0cdf665
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions share/nuke/init.py
@@ -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()

0 comments on commit 0cdf665

Please sign in to comment.