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

Method initializeDefaultKnobs

Engine/Node.cpp:3989–4163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3987}
3988
3989void
3990Node::initializeDefaultKnobs(bool loadingSerialization)
3991{
3992 //Readers and Writers don't have default knobs since these knobs are on the ReadNode/WriteNode itself
3993#ifdef NATRON_ENABLE_IO_META_NODES
3994 NodePtr ioContainer = getIOContainer();
3995#endif
3996
3997 //Add the "Node" page
3998 boost::shared_ptr<KnobPage> settingsPage = AppManager::createKnob<KnobPage>(_imp->effect.get(), tr(NATRON_PARAMETER_PAGE_NAME_EXTRA), 1, false);
3999 _imp->nodeSettingsPage = settingsPage;
4000
4001 //Create the "Label" knob
4002 Backdrop* isBackdropNode = dynamic_cast<Backdrop*>( _imp->effect.get() );
4003 QString labelKnobLabel = isBackdropNode ? tr("Name label") : tr("Label");
4004 createLabelKnob( settingsPage, labelKnobLabel.toStdString() );
4005
4006 if (isBackdropNode) {
4007 //backdrops just have a label
4008 return;
4009 }
4010
4011
4012 ///find in all knobs a page param to set this param into
4013 const KnobsVec & knobs = _imp->effect->getKnobs();
4014
4015 findPluginFormatKnobs(knobs, loadingSerialization);
4016 findRightClickMenuKnob(knobs);
4017
4018 boost::shared_ptr<KnobPage> mainPage;
4019
4020
4021 // Scan all inputs to find masks and get inputs labels
4022 //Pair hasMaskChannelSelector, isMask
4023 int inputsCount = getMaxInputCount();
4024 std::vector<std::pair<bool, bool> > hasMaskChannelSelector(inputsCount);
4025 std::vector<std::string> inputLabels(inputsCount);
4026 for (int i = 0; i < inputsCount; ++i) {
4027 inputLabels[i] = _imp->effect->getInputLabel(i);
4028
4029 assert( i < (int)_imp->inputsComponents.size() );
4030 bool isMask = _imp->effect->isInputMask(i);
4031 bool supportsOnlyAlpha = isInputOnlyAlpha(i);
4032
4033 hasMaskChannelSelector[i].first = false;
4034 hasMaskChannelSelector[i].second = isMask;
4035
4036 if ( (isMask || supportsOnlyAlpha) &&
4037 !_imp->effect->isInputRotoBrush(i) ) {
4038 hasMaskChannelSelector[i].first = true;
4039 if (!mainPage) {
4040 mainPage = getOrCreateMainPage();
4041 }
4042 }
4043 }
4044
4045 bool requiresLayerShuffle = _imp->effect->getCreateChannelSelectorKnob();
4046

Callers

nothing calls this directly

Calls 15

toStdStringMethod · 0.80
isInputRotoBrushMethod · 0.80
getNameMethod · 0.80
isHostMixingEnabledMethod · 0.80
getParentKnobMethod · 0.80
removeKnobMethod · 0.80
getIsSecretMethod · 0.80
setAsRenderButtonMethod · 0.80
getMethod · 0.45
getInputLabelMethod · 0.45
sizeMethod · 0.45
isInputMaskMethod · 0.45

Tested by

no test coverage detected