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

Method bake

src/OpenColorIO/Baker.cpp:237–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237void Baker::bake(std::ostream & os) const
238{
239 FileFormat* fmt = FormatRegistry::GetInstance().getFileFormatByName(getImpl()->m_formatName);
240
241 if(!fmt)
242 {
243 std::ostringstream err;
244 err << "The format named '" << getImpl()->m_formatName;
245 err << "' could not be found. ";
246 throw Exception(err.str().c_str());
247 }
248
249 FormatInfoVec fmtInfoVec;
250 fmt->getFormatInfo(fmtInfoVec);
251 FormatInfo fmtInfo = fmtInfoVec[0];
252
253 const std::string & inputSpace = getImpl()->m_inputSpace;
254 const std::string & targetSpace = getImpl()->m_targetSpace;
255 const std::string & shaperSpace = getImpl()->m_shaperSpace;
256 const std::string & display = getImpl()->m_display;
257 const std::string & view = getImpl()->m_view;
258
259 const bool displayViewMode = !display.empty() && !view.empty();
260 const bool colorSpaceMode = !targetSpace.empty();
261
262 // Settings validation.
263 if(!getConfig())
264 {
265 throw Exception("No OCIO config has been set.");
266 }
267
268 if(inputSpace.empty())
269 {
270 throw Exception("No input space has been set.");
271 }
272
273 if(!displayViewMode && !colorSpaceMode)
274 {
275 throw Exception("No display / view or target colorspace has been set.");
276 }
277
278 if(displayViewMode && colorSpaceMode)
279 {
280 throw Exception("Cannot use both display / view and target colorspace.");
281 }
282
283 if(!getConfig()->getColorSpace(inputSpace.c_str()))
284 {
285 std::ostringstream os;
286 os << "Could not find input colorspace '" << inputSpace << "'.";
287 throw Exception(os.str().c_str());
288 }
289
290 if(colorSpaceMode && !getConfig()->getColorSpace(targetSpace.c_str()))
291 {
292 std::ostringstream os;
293 os << "Could not find target colorspace '" << targetSpace << "'.";
294 throw Exception(os.str().c_str());

Callers 12

test_interfaceMethod · 0.95
test_interfaceMethod · 0.95
mainFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45

Calls 14

getConfigFunction · 0.85
getFileFormatByNameMethod · 0.80
getNumDisplaysAllMethod · 0.80
getDisplayAllMethod · 0.80
getImplFunction · 0.50
getFormatInfoMethod · 0.45
emptyMethod · 0.45
getColorSpaceMethod · 0.45
getNumViewsMethod · 0.45

Tested by 11

test_interfaceMethod · 0.76
test_interfaceMethod · 0.76
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36