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

Method onLayerChanged

Engine/Node.cpp:5168–5213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5166} // Node::Implementation::getSelectedLayerInternal
5167
5168void
5169Node::Implementation::onLayerChanged(int inputNb,
5170 const ChannelSelector& selector)
5171{
5172 KnobChoicePtr layerKnob = selector.layer.lock();
5173 bool outputIsAll = processAllLayersKnob.lock()->getValue();
5174
5175 if (inputNb == -1) {
5176
5177 ///Disable all input selectors as it doesn't make sense to edit them whilst output is All
5178 for (std::map<int, ChannelSelector>::iterator it = channelsSelectors.begin(); it != channelsSelectors.end(); ++it) {
5179
5180 NodePtr inp;
5181 if (it->first >= 0) {
5182 inp = _publicInterface->getInput(it->first);
5183 }
5184 bool mustBeSecret = (it->first >= 0 && !inp.get()) || outputIsAll;
5185 it->second.layer.lock()->setSecret(mustBeSecret);
5186
5187 }
5188 }
5189 if (!isRefreshingInputRelatedData) {
5190 ///Clip preferences have changed
5191 RenderScale s(1.);
5192 effect->refreshMetadata_public(true);
5193 }
5194 if ( !enabledChan[0].lock() ) {
5195 return;
5196 }
5197
5198 if (inputNb == -1) {
5199 if (outputIsAll) {
5200 for (int i = 0; i < 4; ++i) {
5201 enabledChan[i].lock()->setSecret(true);
5202 }
5203 } else {
5204 std::list<ImagePlaneDesc> availablePlanes;
5205 effect->getAvailableLayers(_publicInterface->getApp()->getTimeLine()->currentFrame(), ViewIdx(0), inputNb, &availablePlanes);
5206
5207 ImagePlaneDesc comp = getSelectedLayerInternal(inputNb, availablePlanes, selector);
5208 _publicInterface->refreshEnabledKnobsLabel(comp);
5209 }
5210
5211 _publicInterface->s_outputLayerChanged();
5212 }
5213}
5214
5215void
5216Node::refreshEnabledKnobsLabel(const ImagePlaneDesc& comp)

Callers 1

Calls 14

ViewIdxClass · 0.70
lockMethod · 0.45
getValueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getInputMethod · 0.45
getMethod · 0.45
setSecretMethod · 0.45
getAvailableLayersMethod · 0.45
currentFrameMethod · 0.45

Tested by

no test coverage detected