Skip to content
7 changes: 1 addition & 6 deletions src/lib/ip/OCIONodes/OCIOIPNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,11 @@ namespace IPCore
{
m_state->linear = "";
}
else if (getenv("OCIO"))
else
{
OCIO::ConstColorSpaceRcPtr linearColorSpace = m_state->config->getColorSpace(OCIO::ROLE_SCENE_LINEAR);
m_state->linear = linearColorSpace ? linearColorSpace->getName() : "";
}
else
{
m_state->linear = "";
std::cerr << "ERROR: OCIO environment variable not set" << std::endl;
}

m_state->shaderID = "";

Expand Down
10 changes: 10 additions & 0 deletions src/plugins/rv-packages/ocio_source_setup/ocio_source_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def selectConfig(self, event):
self.config = OCIO.Config.CreateFromFile(config)
OCIO.SetCurrentConfig(self.config)
commands.defineModeMenu("OCIO Source Setup", self.buildOCIOMenu(), True)
commands.writeSettings("ocio_source_setup", "ocio_config", config)
except Exception as inst:
print(inst)

Expand Down Expand Up @@ -685,6 +686,8 @@ def addMenu(root, isSingle):
("Displays", None, None, lambda: commands.DisabledMenuState),
]
final += daList
final += [("_", None)]
final += [("Change Config...", self.selectConfig, None, None)]

return [("OCIO", final)]

Expand Down Expand Up @@ -716,6 +719,13 @@ def __init__(self):
except ImportError:
pass

# Restore saved OCIO config from previously loaded config
# An externally set OCIO env var takes precendence
if os.getenv("OCIO") is None:
Comment thread
bernie-laberge marked this conversation as resolved.
config = commands.readSettings("ocio_source_setup", "ocio_config", "")
if config != "" and os.path.isfile(config):
self.config = OCIO.Config.CreateFromFile(config)

self.init(
"OCIO Source Setup",
None,
Expand Down