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

Function loadClamp

src/OpenColorIO/OCIOYaml.cpp:1613–1650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1611}
1612
1613inline void loadClamp(const YAML::Node & parent, const YAML::Node & node,
1614 double & blackVal, bool & blackValLoaded,
1615 double & whiteVal, bool & whiteValLoaded)
1616{
1617 if (node.Type() == YAML::NodeType::Map)
1618 {
1619 for (Iterator iter = node.begin(); iter != node.end(); ++iter)
1620 {
1621 const std::string & key = iter->first.as<std::string>();
1622
1623 if (iter->second.IsNull() || !iter->second.IsDefined()) continue;
1624
1625 if (key == "black")
1626 {
1627 load(iter->second, blackVal);
1628 blackValLoaded = true;
1629 }
1630 else if (key == "white")
1631 {
1632 load(iter->second, whiteVal);
1633 whiteValLoaded = true;
1634 }
1635 else
1636 {
1637 LogUnknownKeyWarning(node, iter->first);
1638 }
1639 }
1640
1641 if (!blackValLoaded && !whiteValLoaded)
1642 {
1643 throwValueError(parent, "At least one of the clamp values must be provided.");
1644 }
1645 }
1646 else
1647 {
1648 throwValueError(parent, "The value needs to be a map.");
1649 }
1650}
1651
1652inline void load(const YAML::Node & node, GradingPrimaryTransformRcPtr & t)
1653{

Callers 1

loadFunction · 0.85

Calls 5

loadFunction · 0.85
LogUnknownKeyWarningFunction · 0.85
throwValueErrorFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected