| 11524 | } // Node::refreshChannelSelectors() |
| 11525 | |
| 11526 | bool |
| 11527 | Node::addUserComponents(const ImagePlaneDesc& comps) |
| 11528 | { |
| 11529 | ///The node has node channel selector, don't allow adding a custom plane. |
| 11530 | KnobPtr outputLayerKnob = getKnobByName(kNatronOfxParamOutputChannels); |
| 11531 | |
| 11532 | if (_imp->channelsSelectors.empty() && !outputLayerKnob) { |
| 11533 | return false; |
| 11534 | } |
| 11535 | |
| 11536 | if (!outputLayerKnob) { |
| 11537 | //The effect does not have kNatronOfxParamOutputChannels but maybe the selector provided by Natron |
| 11538 | std::map<int, ChannelSelector>::iterator found = _imp->channelsSelectors.find(-1); |
| 11539 | if ( found == _imp->channelsSelectors.end() ) { |
| 11540 | return false; |
| 11541 | } |
| 11542 | outputLayerKnob = found->second.layer.lock(); |
| 11543 | } |
| 11544 | |
| 11545 | { |
| 11546 | QMutexLocker k(&_imp->createdComponentsMutex); |
| 11547 | for (std::list<ImagePlaneDesc>::iterator it = _imp->createdComponents.begin(); it != _imp->createdComponents.end(); ++it) { |
| 11548 | if ( it->getPlaneID() == comps.getPlaneID() ) { |
| 11549 | return false; |
| 11550 | } |
| 11551 | } |
| 11552 | |
| 11553 | _imp->createdComponents.push_back(comps); |
| 11554 | } |
| 11555 | if (!_imp->isRefreshingInputRelatedData) { |
| 11556 | ///Clip preferences have changed |
| 11557 | RenderScale s(1.); |
| 11558 | getEffectInstance()->refreshMetadata_public(true); |
| 11559 | } |
| 11560 | { |
| 11561 | ///Set the selector to the new channel |
| 11562 | KnobChoice* layerChoice = dynamic_cast<KnobChoice*>( outputLayerKnob.get() ); |
| 11563 | if (layerChoice) { |
| 11564 | layerChoice->setValueFromID(comps.getPlaneID(), 0); |
| 11565 | } |
| 11566 | } |
| 11567 | |
| 11568 | return true; |
| 11569 | } |
| 11570 | |
| 11571 | void |
| 11572 | Node::getUserCreatedComponents(std::list<ImagePlaneDesc>* comps) |
no test coverage detected