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

Method getSelectedLayer

Engine/Node.cpp:5323–5379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5321}
5322
5323bool
5324Node::getSelectedLayer(int inputNb,
5325 const std::list<ImagePlaneDesc>& availableLayers,
5326 std::bitset<4> *processChannels,
5327 bool* isAll,
5328 ImagePlaneDesc* layer) const
5329{
5330 // If there's a mask channel selector, fetch the mask layer
5331 int chanIndex = getMaskChannel(inputNb, availableLayers, layer);
5332 if (chanIndex != -1) {
5333 *isAll = false;
5334 Q_UNUSED(chanIndex);
5335 if (processChannels) {
5336 (*processChannels)[0] = true;
5337 (*processChannels)[1] = true;
5338 (*processChannels)[2] = true;
5339 (*processChannels)[3] = true;
5340 }
5341
5342 return true;
5343 }
5344
5345
5346 std::map<int, ChannelSelector>::const_iterator foundSelector = _imp->channelsSelectors.find(inputNb);
5347
5348 if ( foundSelector == _imp->channelsSelectors.end() ) {
5349 // Fetch in input what the user has set for the output
5350 foundSelector = _imp->channelsSelectors.find(-1);
5351 }
5352
5353
5354 // Check if the checkbox "All layers" is checked or not
5355 KnobBoolPtr processAllKnob = _imp->processAllLayersKnob.lock();
5356 *isAll = false;
5357 if (processAllKnob) {
5358 *isAll = processAllKnob->getValue();
5359 }
5360
5361 if (!*isAll && foundSelector != _imp->channelsSelectors.end()) {
5362 *layer = _imp->getSelectedLayerInternal(inputNb, availableLayers, foundSelector->second);
5363 }
5364
5365 if (processChannels) {
5366 if (_imp->hostChannelSelectorEnabled && _imp->enabledChan[0].lock() ) {
5367 (*processChannels)[0] = _imp->enabledChan[0].lock()->getValue();
5368 (*processChannels)[1] = _imp->enabledChan[1].lock()->getValue();
5369 (*processChannels)[2] = _imp->enabledChan[2].lock()->getValue();
5370 (*processChannels)[3] = _imp->enabledChan[3].lock()->getValue();
5371 } else {
5372 (*processChannels)[0] = true;
5373 (*processChannels)[1] = true;
5374 (*processChannels)[2] = true;
5375 (*processChannels)[3] = true;
5376 }
5377 }
5378 return foundSelector != _imp->channelsSelectors.end();
5379}
5380

Callers 3

getInputImageInternalMethod · 0.80
onOutputLayerChangedMethod · 0.80

Calls 5

findMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected