| 7253 | } // Node::refreshChannelSelectors() |
| 7254 | |
| 7255 | bool |
| 7256 | Node::addUserComponents(const ImagePlaneDesc& comps) |
| 7257 | { |
| 7258 | ///The node has node channel selector, don't allow adding a custom plane. |
| 7259 | KnobIPtr outputLayerKnob = getKnobByName(kNatronOfxParamOutputChannels); |
| 7260 | |
| 7261 | if (_imp->channelsSelectors.empty() && !outputLayerKnob) { |
| 7262 | return false; |
| 7263 | } |
| 7264 | |
| 7265 | if (!outputLayerKnob) { |
| 7266 | //The effect does not have kNatronOfxParamOutputChannels but maybe the selector provided by Natron |
| 7267 | std::map<int, ChannelSelector>::iterator found = _imp->channelsSelectors.find(-1); |
| 7268 | if ( found == _imp->channelsSelectors.end() ) { |
| 7269 | return false; |
| 7270 | } |
| 7271 | outputLayerKnob = found->second.layer.lock(); |
| 7272 | } |
| 7273 | |
| 7274 | { |
| 7275 | QMutexLocker k(&_imp->createdComponentsMutex); |
| 7276 | for (std::list<ImagePlaneDesc>::iterator it = _imp->createdComponents.begin(); it != _imp->createdComponents.end(); ++it) { |
| 7277 | if ( it->getPlaneID() == comps.getPlaneID() ) { |
| 7278 | return false; |
| 7279 | } |
| 7280 | } |
| 7281 | |
| 7282 | _imp->createdComponents.push_back(comps); |
| 7283 | } |
| 7284 | if (!_imp->isRefreshingInputRelatedData) { |
| 7285 | ///Clip preferences have changed |
| 7286 | RenderScale s(1.); |
| 7287 | getEffectInstance()->refreshMetadata_public(true); |
| 7288 | } |
| 7289 | { |
| 7290 | ///Set the selector to the new channel |
| 7291 | KnobChoice* layerChoice = dynamic_cast<KnobChoice*>( outputLayerKnob.get() ); |
| 7292 | if (layerChoice) { |
| 7293 | layerChoice->setValueFromID(comps.getPlaneID(), 0); |
| 7294 | } |
| 7295 | } |
| 7296 | |
| 7297 | return true; |
| 7298 | } |
| 7299 | |
| 7300 | void |
| 7301 | Node::getUserCreatedComponents(std::list<ImagePlaneDesc>* comps) |
no test coverage detected