void DiskCacheNode::initializeKnobs() { KnobPagePtr page = AppManager::createKnob<KnobPage>( shared_from_this(), tr("Controls") ); KnobChoicePtr frameRange = AppManager::createKnob<KnobChoice>( shared_from_this(), tr("Frame range") ); frameRange->setName("frameRange"); frameRange->setAnimationEnabled(false); std::vector<std::string> choices; choices.push_back("Input frame range"); choices.push_back("Project frame range"); choices.push_back("Manual"); frameRange->populateChoices(choices); frameRange->setEvaluateOnChange(false); frameRange->setDefaultValue(0); page->addKnob(frameRange); _imp->frameRange = frameRange; KnobIntPtr firstFrame = AppManager::createKnob<KnobInt>( shared_from_this(), tr("First Frame") ); firstFrame->setAnimationEnabled(false); firstFrame->setName("firstFrame"); firstFrame->disableSlider(); firstFrame->setEvaluateOnChange(false); firstFrame->setAddNewLine(false); firstFrame->setDefaultValue(1); firstFrame->setSecret(true); page->addKnob(firstFrame); _imp->firstFrame = firstFrame; KnobIntPtr lastFrame = AppManager::createKnob<KnobInt>( shared_from_this(), tr("Last Frame") ); lastFrame->setAnimationEnabled(false); lastFrame->setName("LastFrame"); lastFrame->disableSlider(); lastFrame->setEvaluateOnChange(false); lastFrame->setDefaultValue(100); lastFrame->setSecret(true); page->addKnob(lastFrame); _imp->lastFrame = lastFrame; KnobButtonPtr preRender = AppManager::createKnob<KnobButton>( shared_from_this(), tr("Pre-cache") ); preRender->setName("preRender"); preRender->setEvaluateOnChange(false); preRender->setHintToolTip( tr("Cache the frame range specified by rendering images at zoom-level 100% only.") ); page->addKnob(preRender); _imp->preRender = preRender; }
void OneViewNode::initializeKnobs() { KnobPagePtr page = AppManager::createKnob<KnobPage>( shared_from_this(), tr("Controls") ); page->setName("controls"); KnobChoicePtr viewKnob = AppManager::createKnob<KnobChoice>( shared_from_this(), tr("View") ); viewKnob->setName("view"); viewKnob->setHintToolTip( tr("View to take from the input") ); page->addKnob(viewKnob); const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames(); std::string currentView = viewKnob->getActiveEntryText_mt_safe(); viewKnob->populateChoices(views); _imp->viewKnob = viewKnob; }
void DiskCacheNode::initializeKnobs() { KnobPagePtr page = createKnob<KnobPage>("controlsPage"); page->setLabel(tr("Controls") ); KnobChoicePtr frameRange = createKnob<KnobChoice>(kDiskCacheNodeFrameRange); frameRange->setLabel(tr(kDiskCacheNodeFrameRangeLabel) ); frameRange->setHintToolTip(tr(kDiskCacheNodeFrameRangeHint)); frameRange->setAnimationEnabled(false); { std::vector<ChoiceOption> choices; choices.push_back(ChoiceOption("Input frame range", "", "")); choices.push_back(ChoiceOption("Project frame range", "", "")); choices.push_back(ChoiceOption("Manual","", "")); frameRange->populateChoices(choices); } frameRange->setEvaluateOnChange(false); frameRange->setDefaultValue(0); page->addKnob(frameRange); _imp->frameRange = frameRange; KnobIntPtr firstFrame = createKnob<KnobInt>(kDiskCacheNodeFirstFrame); firstFrame->setLabel(tr(kDiskCacheNodeFirstFrameLabel) ); firstFrame->setHintToolTip(tr(kDiskCacheNodeFirstFrameHint)); firstFrame->setAnimationEnabled(false); firstFrame->disableSlider(); firstFrame->setEvaluateOnChange(false); firstFrame->setAddNewLine(false); firstFrame->setDefaultValue(1); firstFrame->setSecret(true); page->addKnob(firstFrame); _imp->firstFrame = firstFrame; KnobIntPtr lastFrame = createKnob<KnobInt>(kDiskCacheNodeLastFrame); lastFrame->setAnimationEnabled(false); lastFrame->setLabel(tr(kDiskCacheNodeLastFrameLabel)); lastFrame->setHintToolTip(tr(kDiskCacheNodeLastFrameHint)); lastFrame->disableSlider(); lastFrame->setEvaluateOnChange(false); lastFrame->setDefaultValue(100); lastFrame->setSecret(true); page->addKnob(lastFrame); _imp->lastFrame = lastFrame; KnobButtonPtr preRender = createKnob<KnobButton>("preRender"); preRender->setLabel(tr("Pre-cache")); preRender->setEvaluateOnChange(false); preRender->setHintToolTip( tr("Cache the frame range specified by rendering images at zoom-level 100% only.") ); page->addKnob(preRender); _imp->preRender = preRender; }
PickKnobDialog::PickKnobDialog(DockablePanel* panel, QWidget* parent) : QDialog(parent) , _imp( new PickKnobDialogPrivate(panel) ) { NodeSettingsPanel* nodePanel = dynamic_cast<NodeSettingsPanel*>(panel); assert(nodePanel); if (!nodePanel) { throw std::logic_error("PickKnobDialog::PickKnobDialog()"); } NodeGuiPtr nodeGui = nodePanel->getNodeGui(); NodePtr node = nodeGui->getNode(); NodeGroupPtr isGroup = node->isEffectNodeGroup(); NodeCollectionPtr collec = node->getGroup(); NodeGroupPtr isCollecGroup = toNodeGroup(collec); NodesList collectNodes = collec->getNodes(); for (NodesList::iterator it = collectNodes.begin(); it != collectNodes.end(); ++it) { if ((*it)->isActivated() && (*it)->getNodeGui() && ( (*it)->getKnobs().size() > 0 ) ) { _imp->allNodes.push_back(*it); } } if (isCollecGroup) { _imp->allNodes.push_back( isCollecGroup->getNode() ); } if (isGroup) { NodesList groupnodes = isGroup->getNodes(); for (NodesList::iterator it = groupnodes.begin(); it != groupnodes.end(); ++it) { if ( (*it)->getNodeGui() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) { _imp->allNodes.push_back(*it); } } } QStringList nodeNames; for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) { QString name = QString::fromUtf8( (*it)->getLabel().c_str() ); nodeNames.push_back(name); } nodeNames.sort(); _imp->mainLayout = new QGridLayout(this); _imp->selectNodeLabel = new Label( tr("Node:") ); _imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this); _imp->nodeSelectionCombo->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Input the name of a node in the current project."), NATRON_NAMESPACE::WhiteSpaceNormal) ); _imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason); _imp->knobSelectionCombo = new ComboBox(this); QObject::connect( _imp->knobSelectionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onKnobComboIndexChanged(int)) ); QString useAliasTt = NATRON_NAMESPACE::convertFromPlainText(tr("If checked, an alias of the selected parameter will be created, coyping entirely its state. " "Only the script-name, label and tooltip will be editable.\n" "For choice parameters this will also " "dynamically refresh the menu entries when the original parameter's menu is changed.\n" "When unchecked, a simple expression will be set linking the two parameters, but things such as dynamic menus " "will be disabled."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->useAliasLabel = new Label(tr("Make Alias:"), this); _imp->useAliasLabel->setToolTip(useAliasTt); _imp->useAliasCheckBox = new QCheckBox(this); _imp->useAliasCheckBox->setToolTip(useAliasTt); _imp->useAliasCheckBox->setChecked(true); QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) ); _imp->destPageLabel = new Label(tr("Page:"), this); QString pagett = NATRON_NAMESPACE::convertFromPlainText(tr("Select the page into which the parameter will be created."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->destPageLabel->setToolTip(pagett); _imp->destPageCombo = new ComboBox(this); _imp->destPageCombo->setToolTip(pagett); QObject::connect( _imp->destPageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPageComboIndexChanged(int)) ); const KnobsVec& knobs = node->getKnobs(); for (std::size_t i = 0; i < knobs.size(); ++i) { if ( knobs[i]->isUserKnob() ) { KnobPagePtr isPage = toKnobPage(knobs[i]); if (isPage) { _imp->pages.push_back(isPage); _imp->destPageCombo->addItem( QString::fromUtf8( isPage->getName().c_str() ) ); } else { KnobGroupPtr isGrp = toKnobGroup(knobs[i]); if (isGrp) { _imp->groups.push_back(isGrp); } } } } if (_imp->destPageCombo->count() == 0) { _imp->destPageLabel->hide(); _imp->destPageCombo->hide(); } _imp->groupLabel = new Label(tr("Group:"), this); QString grouptt = NATRON_NAMESPACE::convertFromPlainText(tr("Select the group into which the parameter will be created."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->groupCombo = new ComboBox(this); _imp->groupLabel->setToolTip(grouptt); _imp->groupCombo->setToolTip(grouptt); onPageComboIndexChanged(0); _imp->buttons = new DialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel), Qt::Horizontal, this); QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) ); QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) ); _imp->mainLayout->addWidget(_imp->selectNodeLabel, 0, 0, 1, 1); _imp->mainLayout->addWidget(_imp->nodeSelectionCombo, 0, 1, 1, 1); _imp->mainLayout->addWidget(_imp->knobSelectionCombo, 0, 2, 1, 1); _imp->mainLayout->addWidget(_imp->useAliasLabel, 1, 0, 1, 1); _imp->mainLayout->addWidget(_imp->useAliasCheckBox, 1, 1, 1, 1); _imp->mainLayout->addWidget(_imp->destPageLabel, 2, 0, 1, 1); _imp->mainLayout->addWidget(_imp->destPageCombo, 2, 1, 1, 1); _imp->mainLayout->addWidget(_imp->groupLabel, 2, 2, 1, 1); _imp->mainLayout->addWidget(_imp->groupCombo, 2, 3, 1, 1); _imp->mainLayout->addWidget(_imp->buttons, 3, 0, 1, 3); QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) ); }
void RotoShapeRenderNode::initializeKnobs() { assert(!isRenderClone()); KnobPagePtr page = createKnob<KnobPage>("controlsPage"); page->setLabel(tr("Controls")); { KnobChoicePtr param = createKnob<KnobChoice>(kRotoShapeRenderNodeParamType); param->setLabel(tr(kRotoShapeRenderNodeParamTypeLabel)); { std::vector<ChoiceOption> options; options.push_back(ChoiceOption(kRotoShapeRenderNodeParamTypeSolid, "", "")); options.push_back(ChoiceOption(kRotoShapeRenderNodeParamTypeSmear, "", "")); param->populateChoices(options); } param->setIsMetadataSlave(true); page->addKnob(param); _imp->renderType = param; } { KnobChoicePtr param = createKnob<KnobChoice>(kRotoOutputRodType); param->setLabel(tr(kRotoOutputRodTypeLabel)); param->setHintToolTip(tr(kRotoOutputRodTypeHint)); std::vector<ChoiceOption> options; options.push_back(ChoiceOption(kRotoOutputRodTypeDefaultID, kRotoOutputRodTypeDefaultLabel, tr(kRotoOutputRodTypeDefaultHint).toStdString())); options.push_back(ChoiceOption(kRotoOutputRodTypeFormatID, kRotoOutputRodTypeFormatLabel, tr(kRotoOutputRodTypeFormatHint).toStdString())); options.push_back(ChoiceOption(kRotoOutputRodTypeProjectID, kRotoOutputRodTypeProjectLabel, tr(kRotoOutputRodTypeProjectHint).toStdString())); param->populateChoices(options); param->setAddNewLine(false); param->setIsPersistent(false); page->addKnob(param); _imp->outputRoDTypeKnob = param; } { KnobChoicePtr param = createKnob<KnobChoice>(kRotoFormatParam); param->setLabel(tr(kRotoFormatParamLabel)); param->setHintToolTip(tr(kRotoFormatParamHint)); page->addKnob(param); param->setIsPersistent(false); _imp->outputFormatKnob = param; } { KnobIntPtr param = createKnob<KnobInt>(kRotoFormatSize, 2); param->setSecret(true); page->addKnob(param); param->setIsPersistent(false); _imp->outputFormatSizeKnob = param; } { KnobDoublePtr param = createKnob<KnobDouble>(kRotoFormatPar); param->setSecret(true); page->addKnob(param); param->setIsPersistent(false); _imp->outputFormatParKnob = param; } { KnobBoolPtr param = createKnob<KnobBool>(kRotoClipToFormatParam); param->setLabel(tr(kRotoClipToFormatParamLabel)); param->setHintToolTip(tr(kRotoClipToFormatParamHint)); param->setDefaultValue(false); page->addKnob(param); _imp->clipToFormatKnob = param; } }