本文整理汇总了C++中KnobChoicePtr类的典型用法代码示例。如果您正苦于以下问题:C++ KnobChoicePtr类的具体用法?C++ KnobChoicePtr怎么用?C++ KnobChoicePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KnobChoicePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
void
KnobGuiChoice::updateGUI(int /*dimension*/)
{
///we don't use setCurrentIndex because the signal emitted by combobox will call onCurrentIndexChanged and
///change the internal value of the knob again...
///The slot connected to onCurrentIndexChanged is reserved to catch user interaction with the combobox.
///This function is called in response to an internal change.
KnobChoicePtr knob = _knob.lock();
std::string activeEntry = knob->getActiveEntryText_mt_safe();
if ( !activeEntry.empty() ) {
bool activeIndexPresent = knob->isActiveEntryPresentInEntries();
if (!activeIndexPresent) {
QString error = tr("The value set to this parameter no longer exist in the menu. Right click and press Refresh Menu to update the menu and then pick a new value.");
setWarningValue( KnobGui::eKnobWarningChoiceMenuOutOfDate, GuiUtils::convertFromPlainText(error, Qt::WhiteSpaceNormal) );
} else {
setWarningValue( KnobGui::eKnobWarningChoiceMenuOutOfDate, QString() );
}
}
if ( _comboBox->isCascading() || activeEntry.empty() ) {
_comboBox->setCurrentIndex_no_emit( knob->getValue() );
} else {
_comboBox->setCurrentText( QString::fromUtf8( activeEntry.c_str() ) );
}
}
示例2: getInputRecursive
void
ViewerNodePrivate::swapViewerProcessInputs()
{
NodePtr viewerProcessNodesInputs[2];
for (int i = 0; i < 2; ++i) {
viewerProcessNodesInputs[i] = getInputRecursive(i);
}
NodePtr input0 = viewerProcessNodesInputs[0]->getInput(0);
NodePtr input1 = viewerProcessNodesInputs[1]->getInput(0);
viewerProcessNodesInputs[0]->swapInput(input1, 0);
viewerProcessNodesInputs[1]->swapInput(input0, 0);
try {
KnobChoicePtr aChoice = aInputNodeChoiceKnob.lock();
KnobChoicePtr bChoice = bInputNodeChoiceKnob.lock();
ChoiceOption aCurChoice = aChoice->getActiveEntry();
ChoiceOption bCurChoice = bChoice->getActiveEntry();
aChoice->blockValueChanges();
aChoice->setValueFromID(bCurChoice.id);
aChoice->unblockValueChanges();
bChoice->blockValueChanges();
bChoice->setValueFromID(aCurChoice.id);
bChoice->unblockValueChanges();
} catch (...) {
}
}
示例3: assert
void
ViewerNodePrivate::refreshInputChoiceMenu(int internalIndex, int groupInputIndex)
{
KnobChoicePtr inputChoiceKnob = internalIndex == 0 ? aInputNodeChoiceKnob.lock() : bInputNodeChoiceKnob.lock();
assert(groupInputIndex >= 0 && groupInputIndex < _publicInterface->getMaxInputCount());
std::string groupInputID;
{
std::stringstream ss;
ss << groupInputIndex;
groupInputID = ss.str();
}
std::vector<ChoiceOption> entries = inputChoiceKnob->getEntries();
for (std::size_t i = 0; i < entries.size(); ++i) {
if (entries[i].id == groupInputID) {
inputChoiceKnob->setValue(i);
return;
}
}
// Input is no longer connected fallback on first input in the list if any, otherwise on None ("-")
inputChoiceKnob->setValue(entries.size() > 1 ? 1 : 0, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonPluginEdited);
}
示例4: getKnobGui
void
KnobGuiChoice::createWidget(QHBoxLayout* layout)
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
KnobGuiPtr knobUI = getKnobGui();
_comboBox = new KnobComboBox( knobUI, DimIdx(0), getView(), layout->parentWidget() );
_comboBox->setCascading( knob->isCascading() );
onEntriesPopulated();
std::string textToFitHorizontally = knob->getTextToFitHorizontally();
if (!textToFitHorizontally.empty()) {
QFontMetrics fm = _comboBox->fontMetrics();
_comboBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
_comboBox->setFixedWidth(fm.width(QString::fromUtf8(textToFitHorizontally.c_str())) + 3 * TO_DPIX(DROP_DOWN_ICON_SIZE));
}
QObject::connect( _comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)) );
QObject::connect( _comboBox, SIGNAL(itemNewSelected()), this, SLOT(onItemNewSelected()) );
///set the copy/link actions in the right click menu
KnobGuiWidgets::enableRightClickMenu(knobUI, _comboBox, DimIdx(0), getView());
layout->addWidget(_comboBox);
}
示例5:
void
KnobGuiChoice::setEnabled()
{
KnobChoicePtr knob = _knob.lock();
bool b = knob->isEnabled(0) && knob->getExpression(0).empty();
_comboBox->setEnabled_natron(b);
}
示例6: getUseFromPoints
bool getUseFromPoints(TimeValue time) const
{
KnobChoicePtr knob = overlayPoints.lock();
assert(knob);
return knob->getValueAtTime(time) == 1;
}
示例7: QString
QString
KnobGuiChoice::getPixmapPathFromFilePath(const QString &filePath) const
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return QString();
}
return getPixmapPathFromFilePath(knob->getHolder(),filePath);
}
示例8:
void
KnobGuiChoice::reflectModificationsState()
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
bool hasModif = knob->hasModifications();
_comboBox->setIsModified(hasModif);
}
示例9: KnobGuiWidgets
KnobGuiChoice::KnobGuiChoice(const KnobGuiPtr& knob, ViewIdx view)
: KnobGuiWidgets(knob, view)
, _comboBox(0)
{
KnobChoicePtr k = toKnobChoice(knob->getKnob());
QObject::connect( k.get(), SIGNAL(populated()), this, SLOT(onEntriesPopulated()) );
QObject::connect( k.get(), SIGNAL(entryAppended()), this, SLOT(onEntryAppended()) );
QObject::connect( k.get(), SIGNAL(entriesReset()), this, SLOT(onEntriesReset()) );
_knob = k;
}
示例10: KnobGui
KnobGuiChoice::KnobGuiChoice(KnobIPtr knob,
KnobGuiContainerI *container)
: KnobGui(knob, container)
, _comboBox(0)
{
KnobChoicePtr k = toKnobChoice(knob);
QObject::connect( k.get(), SIGNAL(populated()), this, SLOT(onEntriesPopulated()) );
QObject::connect( k.get(), SIGNAL(entryAppended(QString,QString)), this, SLOT(onEntryAppended(QString,QString)) );
QObject::connect( k.get(), SIGNAL(entriesReset()), this, SLOT(onEntriesReset()) );
_knob = k;
}
示例11:
void
ViewerNodePrivate::setDisplayChannels(int index, bool setBoth)
{
for (int i = 0; i < 2; ++i) {
if (i == 1 && !setBoth) {
break;
}
KnobChoicePtr displayChoice = displayChannelsKnob[i].lock();
displayChoice->setValue(index);
}
}
示例12: callback
void
KnobGuiChoice::onItemNewSelected()
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
ChoiceKnobDimView::KnobChoiceNewItemCallback callback = knob->getNewOptionCallback();
if (!callback) {
return;
}
callback(knob);
}
示例13: getApp
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);
}
}
示例14:
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);
}
示例15:
FramesNeededMap
OneViewNode::getFramesNeeded(double time,
ViewIdx /*view*/)
{
FramesNeededMap ret;
FrameRangesMap& rangeMap = ret[0];
KnobChoicePtr viewKnob = _imp->viewKnob.lock();
int view_i = viewKnob->getValue();
std::vector<RangeD>& ranges = rangeMap[ViewIdx(view_i)];
ranges.resize(1);
ranges[0].min = ranges[0].max = time;
return ret;
}