OCIO default config when using CreateFromEnv


Michel Lerenard <micheli...@...>
 

Hi,

I have an issue when trying to create a config from the environment, more specifically when no env variable is set.
The configuration that is returned contains one color space named "raw".

In my application, we need to have a colorspace named "linear" in the config, so I check if one already exists in the configuration returned, and add it if it doesn't.
I use the getIndexForColorSpace() function to check if my "linear" color space is there, and the weird thing is that the call returns 0, instead of -1!
I've printed the list of color spaces to be sure, I only have one item in it, "raw". I checked the source code, no role or display named "linear" appears, so I'm really wondering why the function finds something that matches.
Even the call getIndexForColorSpace("foobar") returns 0, so I did a last test:

OCIO::ConstColorSpaceRcPtr cs_ptr =config->getColorSpace("foobar");
printf("Colorspace name=%s\n", cs_ptr->getName());

The printed result was "raw".

I'm really lost here. I need to point out that if I load a configuration from an existing file that does not contains the "linear" color space, my code does work. It's not working only with the default configuration returned by CreateFromEnv.

Any help is appreciated.

Michel


PS:On a side note, I was surprised to see that the CreateFromEnv would not return a null pointer or an empty config if no env variable was set. There is not return code, no exception that can give any clue whether a config could be loaded or not after calling the function. That's quite a problem if you want to create a default config at runtime if none can be loaded.
How can I check that a configuration file was indeed loaded ?

Join ocio-dev@lists.aswf.io to automatically receive all group messages.