1 import nuke
2 import ocionuke
3 import os
4
5
7 '''
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
17 canChangeConfig = ocioConfigKnob.enabled()
18 if canChangeConfig:
19
20
21
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
37
38
40
41
42 nuke.ViewerProcess.register("None", nuke.createNode, ("ViewerProcess_None", ))
43
44
45
46
47 nuke.ViewerProcess.register("sRGB", nuke.createNode, ( "ViewerProcess_1DLUT", "current sRGB" ))
48 nuke.ViewerProcess.register("rec709", nuke.createNode, ( "ViewerProcess_1DLUT", "current rec709" ))
49
50 nuke.ViewerProcess.register("rec1886", nuke.createNode, ( "ViewerProcess_1DLUT", "current Gamma2.4" ))
51 if os.environ.get("FN_EDR_DISPLAY", "0") != "0":
52 nuke.ViewerProcess.register("Extended sRGB", nuke.createNode, ( "ViewerLUTExtendedSRGB", ))
53
54
66
67
75
76
78
79 ocioConfigName = os.path.normpath(ocioConfigName).replace("\\", "/")
80
81
82 _setOCIOConfig(ocioConfigName)
83
86