void ViewerNodePrivate::refreshInputChoices(bool resetChoiceIfNotFound) { // Refresh the A and B input choices KnobChoicePtr aInputKnob = aInputNodeChoiceKnob.lock(); KnobChoicePtr bInputKnob = bInputNodeChoiceKnob.lock(); ViewerCompositingOperatorEnum operation = (ViewerCompositingOperatorEnum)blendingModeChoiceKnob.lock()->getValue(); bInputKnob->setEnabled(operation != eViewerCompositingOperatorNone); std::vector<ChoiceOption> entries; entries.push_back(ChoiceOption("-", "", "")); int nInputs = _publicInterface->getMaxInputCount(); for (int i = 0; i < nInputs; ++i) { NodePtr inputNode = _publicInterface->getNode()->getRealInput(i); if (!inputNode) { continue; } std::string optionID; { std::stringstream ss; ss << i; optionID = ss.str(); } entries.push_back(ChoiceOption(optionID, inputNode->getLabel(), "")); } ChoiceOption currentAChoice = aInputKnob->getActiveEntry(); ChoiceOption currentBChoice = bInputKnob->getActiveEntry(); aInputKnob->populateChoices(entries); bInputKnob->populateChoices(entries); if (resetChoiceIfNotFound) { if (currentAChoice.id == "-" || !aInputKnob->isActiveEntryPresentInEntries(ViewIdx(0))) { aInputKnob->setValue(entries.size() > 1 ? 1 : 0); } if (currentBChoice.id == "-" || !bInputKnob->isActiveEntryPresentInEntries(ViewIdx(0))) { bInputKnob->setValue(entries.size() > 1 ? 1 : 0); } } if (uiContext) { if ( (operation == eViewerCompositingOperatorNone) || !bInputKnob->isEnabled() || bInputKnob->getActiveEntry().id.empty() ) { uiContext->setInfoBarVisible(1, false); } else if (operation != eViewerCompositingOperatorNone) { uiContext->setInfoBarVisible(1, true); } } } // refreshInputChoices
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; }
void ViewerNode::refreshViewsKnobVisibility() { KnobChoicePtr knob = _imp->activeViewKnob.lock(); if (knob) { const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames(); std::vector<ChoiceOption> entries(views.size()); for (std::size_t i = 0; i < views.size(); ++i) { entries[i] = ChoiceOption(views[i], "", ""); } knob->populateChoices(entries); knob->setInViewerContextSecret(views.size() <= 1); } }
void ViewerNodeOverlay::showRightClickMenu() { KnobChoicePtr menu = _imp->rightClickMenu.lock(); std::vector<ChoiceOption> entries, showHideEntries; std::vector<KnobButtonPtr> entriesButtons; entriesButtons.push_back(_imp->rightClickToggleWipe.lock()); entriesButtons.push_back(_imp->rightClickCenterWipe.lock()); entriesButtons.push_back(_imp->centerViewerButtonKnob.lock()); entriesButtons.push_back(_imp->zoomScaleOneAction.lock()); entriesButtons.push_back(_imp->zoomInAction.lock()); entriesButtons.push_back(_imp->zoomOutAction.lock()); entriesButtons.push_back(_imp->rightClickPreviousLayer.lock()); entriesButtons.push_back(_imp->rightClickNextLayer.lock()); entriesButtons.push_back(_imp->rightClickPreviousView.lock()); entriesButtons.push_back(_imp->rightClickNextView.lock()); entriesButtons.push_back(_imp->rightClickSwitchAB.lock()); entriesButtons.push_back(_imp->rightClickShowHideOverlays.lock()); entriesButtons.push_back(_imp->enableStatsAction.lock()); for (std::size_t i = 0; i < entriesButtons.size(); ++i) { entries.push_back(ChoiceOption(entriesButtons[i]->getName(), "", "")); } entries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHideSubMenu, "", "")); KnobChoicePtr showHideMenu = _imp->rightClickShowHideSubMenu.lock(); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuHideAll, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuHideAllTop, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuHideAllBottom, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHideTopToolbar, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHideLeftToolbar, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHidePlayer, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHideTimeline, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamRightClickMenuShowHideTabHeader, "", "")); showHideEntries.push_back(ChoiceOption(kViewerNodeParamEnableColorPicker, "", "")); { std::vector<int> separators; separators.push_back(2); showHideMenu->setSeparators(separators); } showHideMenu->populateChoices(showHideEntries); menu->populateChoices(entries); }
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; } }