MCPcopy Create free account
hub / github.com/MrKepzie/Natron / addUserComponents

Method addUserComponents

Engine/Node.cpp:11526–11569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11524} // Node::refreshChannelSelectors()
11525
11526bool
11527Node::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
11571void
11572Node::getUserCreatedComponents(std::list<ImagePlaneDesc>* comps)

Callers 2

addUserPlaneMethod · 0.80
onItemNewSelectedMethod · 0.80

Calls 9

emptyMethod · 0.80
setValueFromIDMethod · 0.80
findMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected