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

Method addUserComponents

Engine/Node.cpp:7255–7298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7253} // Node::refreshChannelSelectors()
7254
7255bool
7256Node::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
7300void
7301Node::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