Trees | Indices | Help |
|
---|
|
1 import nuke 2 import os 3 import os.path 4 import sys 57 currentPath = os.getcwd() 8 os.chdir(os.path.dirname(sys.executable)) 9 import PyOpenColorIO as OCIO 10 11 ocioEnv = os.getenv("OCIO") 12 13 # prevent OCIO exception stopping Nuke startup ... 14 if (ocioEnv != None) and (not os.path.exists(ocioEnv)): 15 print "Warning - invalid OpenColorIO config file specified by OCIO environment variable!" 16 return 17 18 if (ocioEnv == None): 19 if (configName == ""): 20 # if no environment variable was specified, look for a config in the Nuke paths 21 for p in nuke.pluginPath(): 22 if (p[len(p)-1] != '/'): 23 p += '/' 24 25 foundConfig = False 26 configPath = p + "OCIOConfigs/configs" 27 if os.path.exists(configPath) and os.path.isdir(configPath): 28 for d in os.listdir(configPath): 29 if d != 'nuke-default': 30 continue 31 d = configPath + "/" + d 32 if (os.path.isdir(d)): 33 configName = d + "/config.ocio" 34 if os.path.exists(configName): 35 config = OCIO.Config.CreateFromFile(configName) 36 OCIO.SetCurrentConfig(config) 37 foundConfig = True 38 break 39 if foundConfig: 40 break 41 else: 42 config = OCIO.Config.CreateFromFile(configName) 43 OCIO.SetCurrentConfig(config) 44 45 # make sure a default config is created if no Nuke configs were found 46 OCIO.GetCurrentConfig() 47 os.chdir(currentPath)48 50 51 # The ViewerProcess_None gizmo is a pass-through -- it has no effect on the image. 52 nuke.ViewerProcess.register("None", nuke.createNode, ("ViewerProcess_None", )) 53 54 # The ViewerProcess_1DLUT gizmo just contains a ViewerLUT node, which 55 # can apply a 1D LUT defined in the project LUTs. ViewerLUT features both 56 # software (CPU) and GPU implementations. 57 58 nuke.ViewerProcess.register("sRGB", nuke.createNode, ( "ViewerProcess_1DLUT", "current sRGB" )) 59 nuke.ViewerProcess.register("rec709", nuke.createNode, ( "ViewerProcess_1DLUT", "current rec709" )) 6062 currentPath = os.getcwd() 63 os.chdir(os.path.dirname(sys.executable)) 64 import ocionuke.viewer 65 import PyOpenColorIO as OCIO 66 67 # first unregister all OCIO LUTS 68 config = OCIO.GetCurrentConfig() 69 70 # For every display, loop over every view 71 DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" 72 for display in config.getDisplays(): 73 for view in config.getViews(display): 74 # Unregister the node 75 name = DISPLAY_UI_FORMAT % {'view': view, "display": display} 76 nuke.ViewerProcess.unregister(name) 77 78 os.chdir(currentPath)79 8082 currentPath = os.getcwd() 83 os.chdir(os.path.dirname(sys.executable)) 84 import ocionuke.viewer 85 import PyOpenColorIO as OCIO 86 87 # make sure we register the correct config before we begin 88 getDefaultOCIOConfig(configName = ocioConfigName) 89 90 if (defaultLUTS == True): 91 # register the default viewer processes 92 register_default_viewer_processes(configName = ocioConfigName) 93 else: 94 # register OCIO viewer processes 95 ocionuke.viewer.register_viewers() 96 97 os.chdir(currentPath)98
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Nov 23 08:52:29 2012 | http://epydoc.sourceforge.net |