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

Method addViewTransform

src/OpenColorIO/Config.cpp:4592–4631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4590}
4591
4592void Config::addViewTransform(const ConstViewTransformRcPtr & viewTransform)
4593{
4594 const std::string name = viewTransform->getName();
4595 if (name.empty())
4596 {
4597 throw Exception("Cannot add view transform with an empty name.");
4598 }
4599
4600 if (!viewTransform->getTransform(VIEWTRANSFORM_DIR_TO_REFERENCE) &&
4601 !viewTransform->getTransform(VIEWTRANSFORM_DIR_FROM_REFERENCE))
4602 {
4603 std::ostringstream os;
4604 os << "Cannot add view transform '" << name << "' with no transform.";
4605 throw Exception(os.str().c_str());
4606 }
4607
4608 const std::string namelower = StringUtils::Lower(name);
4609
4610 bool addIt = true;
4611
4612 // If the view transform exists, replace it.
4613 for (auto && vt : getImpl()->m_viewTransforms)
4614 {
4615 if (StringUtils::Lower(vt->getName()) == namelower)
4616 {
4617 vt = viewTransform->createEditableCopy();
4618 addIt = false;
4619 break;
4620 }
4621 }
4622
4623 // Otherwise, add it.
4624 if (addIt)
4625 {
4626 getImpl()->m_viewTransforms.push_back(viewTransform->createEditableCopy());
4627 }
4628
4629 AutoMutex lock(getImpl()->m_cacheidMutex);
4630 getImpl()->resetCacheIDs();
4631}
4632
4633void Config::clearViewTransforms()
4634{

Callers 12

_add_itemMethod · 0.45
_remove_itemMethod · 0.45
_new_itemMethod · 0.45
_set_valueMethod · 0.45
loadFunction · 0.45
test_virtual_displayMethod · 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 8

LowerFunction · 0.85
resetCacheIDsMethod · 0.80
getImplFunction · 0.50
getNameMethod · 0.45
emptyMethod · 0.45
getTransformMethod · 0.45
createEditableCopyMethod · 0.45
push_backMethod · 0.45

Tested by 7

test_virtual_displayMethod · 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