MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / getRefSpaceName

Function getRefSpaceName

src/OpenColorIO/ConfigUtils.cpp:196–227  ·  view source on GitHub ↗

Find a color space where isData is false and it has neither a to_ref or from_ref transform. Currently only selecting scene-referred spaces. Note: this returns the first reference space found, even if it is inactive. Returns empty if none are found.

Source from the content-addressed store, hash-verified

194// are found.
195//
196const char * getRefSpaceName(const ConstConfigRcPtr & cfg)
197{
198 // It's important to support inactive spaces since sometimes the only reference space
199 // may be inactive, e.g. the display-referred reference in the built-in configs.
200 int nbCs = cfg->getNumColorSpaces(SEARCH_REFERENCE_SPACE_SCENE, COLORSPACE_ALL);
201
202 for (int i = 0; i < nbCs; i++)
203 {
204 const char * csname = cfg->getColorSpaceNameByIndex(SEARCH_REFERENCE_SPACE_SCENE,
205 COLORSPACE_ALL,
206 i);
207 ConstColorSpaceRcPtr cs = cfg->getColorSpace(csname);
208
209 if (cs->isData())
210 {
211 continue;
212 }
213 ConstTransformRcPtr t = cs->getTransform(COLORSPACE_DIR_TO_REFERENCE);
214 if (t != nullptr)
215 {
216 continue;
217 }
218 t = cs->getTransform(COLORSPACE_DIR_FROM_REFERENCE);
219 if (t != nullptr)
220 {
221 continue;
222 }
223
224 return csname;
225 }
226 return "";
227}
228
229// Find the first scene-referred color space with isdata: true.
230//

Callers 1

IdentifyInterchangeSpaceFunction · 0.85

Calls 5

getNumColorSpacesMethod · 0.45
getColorSpaceMethod · 0.45
isDataMethod · 0.45
getTransformMethod · 0.45

Tested by

no test coverage detected