Trees | Indices | Help |
|
---|
|
1 import nuke 2 import ocionuke 3 import os 4 57 ''' 8 Set the OCIO Config to use the specified config path, unless 9 the OCIO environment variable is defined, in which case that will 10 override configPath. Otherwise if configPath is None then the nuke 11 default config is used. If configPath doesn't exist an IOError is raised. 12 ''' 13 rootNode = nuke.root() 14 ocioConfigKnob = rootNode.knob("OCIO_config") 15 16 # When the OCIO env var is set the OCIO knobs are disabled 17 canChangeConfig = ocioConfigKnob.enabled() 18 if canChangeConfig: 19 # The root node handles checking whether the OCIO envvar needs to be used 20 # or not. This check is performed whenever the OCIO knobs are changed, so 21 # isn't needed here. 22 useDefaultNukeConfig = configPath == "" 23 if useDefaultNukeConfig: 24 ocioConfigKnob.setValue("nuke-default") 25 else: 26 if os.path.exists(configPath): 27 ocioConfigKnob.setValue("custom") 28 customOCIOConfigPathKnob = rootNode.knob("customOCIOConfigPath") 29 customOCIOConfigPathKnob.setText(configPath) 30 else: 31 raise IOError("Config '%s' doesn't exist" % configPath)32 33 34 # Maintaining this function for backwards compatability36 _setOCIOConfig(ocioConfigName)37 3840 41 # The ViewerProcess_None gizmo is a pass-through -- it has no effect on the image. 42 nuke.ViewerProcess.register("None", nuke.createNode, ("ViewerProcess_None", )) 43 # The ViewerProcess_1DLUT gizmo just contains a ViewerLUT node, which 44 # can apply a 1D LUT defined in the project LUTs. ViewerLUT features both 45 # software (CPU) and GPU implementations. 46 47 nuke.ViewerProcess.register("sRGB", nuke.createNode, ( "ViewerProcess_1DLUT", "current sRGB" )) 48 nuke.ViewerProcess.register("rec709", nuke.createNode, ( "ViewerProcess_1DLUT", "current rec709" )) 49 # NOTE: If you change this mapping you'll need to update FlipbookDialog._getBurninWriteColorspace. 50 nuke.ViewerProcess.register("rec1886", nuke.createNode, ( "ViewerProcess_1DLUT", "current Gamma2.4" ))51 5254 ocioConfig = ocionuke.config.loadConfig(ocioConfigPath) 55 56 # unregister all OCIO LUTS 57 # For every display, loop over every view 58 DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" 59 for display in ocioConfig.getDisplays(): 60 for view in ocioConfig.getViews(display): 61 # Unregister the node 62 name = DISPLAY_UI_FORMAT % {'view': view, "display": display} 63 nuke.ViewerProcess.unregister(name)64 6567 if defaultLUTS is True: 68 # register the default viewer processes 69 register_default_viewer_processes() 70 else: 71 # register OCIO viewer processes 72 ocionuke.viewer.register_viewers(ocioConfigName, also_remove, isReload)73 7476 77 ocioConfigName = os.path.normpath(ocioConfigName).replace("\\", "/") 78 79 # make sure we register the config before we begin 80 _setOCIOConfig(ocioConfigName)8183 ocionuke.viewer.storeSelectionBeforeReload()84
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Sep 25 20:04:14 2019 | http://epydoc.sourceforge.net |