MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / getMaskChannel

Method getMaskChannel

Engine/Node.cpp:7152–7176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7150} // Node::checkForPremultWarningAndCheckboxes
7151
7152int
7153Node::getMaskChannel(int inputNb, const std::list<ImagePlaneDesc>& availableLayers, ImagePlaneDesc* comps) const
7154{
7155 *comps = ImagePlaneDesc::getNoneComponents();
7156
7157 std::map<int, MaskSelector >::const_iterator it = _imp->maskSelectors.find(inputNb);
7158
7159 if ( it == _imp->maskSelectors.end() ) {
7160 return -1;
7161 }
7162 ChoiceOption maskChannelID = it->second.channel.lock()->getActiveEntry();
7163
7164 for (std::list<ImagePlaneDesc>::const_iterator it2 = availableLayers.begin(); it2 != availableLayers.end(); ++it2) {
7165
7166 std::size_t nChans = (std::size_t)it2->getNumComponents();
7167 for (std::size_t c = 0; c < nChans; ++c) {
7168 ChoiceOption channelOption = it2->getChannelOption(c);
7169 if (channelOption.id == maskChannelID.id) {
7170 *comps = *it2;
7171 return c;
7172 }
7173 }
7174 }
7175 return -1;
7176}
7177
7178bool
7179Node::refreshChannelSelectors()

Callers 1

treeRecurseFunctorMethod · 0.45

Calls 7

getActiveEntryMethod · 0.80
getChannelOptionMethod · 0.80
findMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
beginMethod · 0.45
getNumComponentsMethod · 0.45

Tested by

no test coverage detected