本文整理汇总了C++中KnobChoicePtr::getEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobChoicePtr::getEntries方法的具体用法?C++ KnobChoicePtr::getEntries怎么用?C++ KnobChoicePtr::getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobChoicePtr
的用法示例。
在下文中一共展示了KnobChoicePtr::getEntries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: QIcon
void
KnobGuiChoice::onEntryAppended()
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
std::vector<ChoiceOption> options = knob->getEntries();
for (int i = _comboBox->count(); i < (int)options.size(); ++i) {
if ( knob->getNewOptionCallback()) {
_comboBox->insertItem(_comboBox->count() - 1, QString::fromUtf8(options[i].label.c_str()), QIcon(), QKeySequence(), QString::fromUtf8(options[i].tooltip.c_str()));
} else {
_comboBox->addItem(QString::fromUtf8(options[i].label.c_str()), QIcon(), QKeySequence(), QString::fromUtf8(options[i].tooltip.c_str()));
}
}
updateGUI();
}
示例3:
void
ViewerNodePrivate::setAlphaChannelFromLayerIfRGBA()
{
ImagePlaneDesc selectedLayer, selectedAlphaLayer, selectedDisplayLayer;
int alphaChannelIndex;
ViewerInstancePtr internalViewer = internalViewerProcessNode[0].lock()->isEffectViewerInstance();
internalViewer->getChannelOptions(_publicInterface->getTimelineCurrentTime(), &selectedLayer, &selectedAlphaLayer, &alphaChannelIndex, &selectedDisplayLayer);
// Set the alpha channel to the selected layer's alpha channel if it is not pointing to anything
if (selectedLayer.getNumComponents() == 4 && selectedAlphaLayer.getNumComponents() == 0) {
ChoiceOption newOption = selectedLayer.getChannelOption(3);
KnobChoicePtr alphaChoice = alphaChannelKnob.lock();
std::vector<ChoiceOption> options = alphaChoice->getEntries();
for (std::size_t i = 0; i < options.size(); ++i) {
if (options[i].id == newOption.id) {
alphaChoice->setValue(i);
break;
}
}
}
}
示例4: ts
//.........这里部分代码省略.........
} else {
knobType = tr("N/A");
}
if (!isGroup && !isPage) {
for (int i = 0; i < (*it)->getNDimensions(); ++i) {
QString valueStr;
if (!isBtn && !isSep && !isParametric) {
// If this is a ChoiceParam and we are not generating live HTML doc,
// only add the list of entries and their halp if this node should not be
// ignored (eg. OCIO colorspace knobs).
if ( isChoice &&
(genHTML || !( knobScriptName == QString::fromUtf8(kOCIOParamInputSpaceChoice) ||
knobScriptName == QString::fromUtf8(kOCIOParamOutputSpaceChoice) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamDisplayChoice) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamViewChoice) ) ) ||
//( ( pluginID == QString::fromUtf8(kOCIOCDLTransformPluginIdentifier) ) &&
// ( knobScriptName == QString::fromUtf8(kOCIOCDLTransformParamCCCIDChoice) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIOFileTransformPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIOFileTransformParamCCCIDChoice) ) ) ||
( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Text") ) &&
( knobScriptName == QString::fromUtf8("name") ) ) || // font family from Text plugin
( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Polaroid") ) &&
( knobScriptName == QString::fromUtf8("font") ) ) || // font family from Polaroid plugin
( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_PRECOMP) ) &&
( knobScriptName == QString::fromUtf8("writeNode") ) ) ||
( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_ONEVIEW) ) &&
( knobScriptName == QString::fromUtf8("view") ) ) ) ) ) {
// see also KnobChoice::getHintToolTipFull()
int index = isChoice->getDefaultValue(DimIdx(i));
std::vector<ChoiceOption> entries = isChoice->getEntries();
if ( (index >= 0) && ( index < (int)entries.size() ) ) {
valueStr = QString::fromUtf8( entries[index].id.c_str() );
}
bool first = true;
for (size_t i = 0; i < entries.size(); i++) {
QString entryHelp = QString::fromUtf8( entries[i].tooltip.c_str() );
QString entry;
if (entries[i].id != entries[i].label) {
entry = QString::fromUtf8( "%1 (%2)" ).arg(QString::fromUtf8( entries[i].label.c_str() )).arg(QString::fromUtf8( entries[i].id.c_str() ));
} else {
entry = QString::fromUtf8( entries[i].label.c_str() );
}
if (!entry.isEmpty()) {
if (first) {
// empty line before the option descriptions
if (genHTML) {
if ( !knobHint.isEmpty() ) {
knobHint.append( QString::fromUtf8("<br />") );
}
knobHint.append( tr("Possible values:") + QString::fromUtf8("<br />") );
} else {
// we do a hack for multiline elements, because the markdown->rst conversion by pandoc doesn't use the line block syntax.
// what we do here is put a supplementary dot at the beginning of each line, which is then converted to a pipe '|' in the
// genStaticDocs.sh script by a simple sed command after converting to RsT
if ( !knobHint.isEmpty() ) {
if (!knobHint.startsWith( QString::fromUtf8(". ") )) {
knobHint.prepend( QString::fromUtf8(". ") );
}
knobHint.append( QString::fromUtf8("\\\n") );
}
knobHint.append( QString::fromUtf8(". ") + tr("Possible values:") + QString::fromUtf8("\\\n") );
}
示例5: pix
void
KnobGuiChoice::onEntriesPopulated()
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
_comboBox->clear();
std::vector<ChoiceOption> entries = knob->getEntries();
std::string pluginShortcutGroup;
EffectInstancePtr isEffect = toEffectInstance(knob->getHolder());
if (isEffect) {
PluginPtr plugin = isEffect->getNode()->getOriginalPlugin();
if (plugin) {
pluginShortcutGroup = plugin->getPluginShortcutGroup();
}
}
const std::map<int, std::string>& shortcutsMap = knob->getShortcuts();
const std::map<int, std::string>& iconsMap = knob->getIcons();
for (U32 i = 0; i < entries.size(); ++i) {
std::string shortcutID;
std::string iconFilePath;
if (!pluginShortcutGroup.empty()) {
std::map<int, std::string>::const_iterator foundShortcut = shortcutsMap.find(i);
if (foundShortcut != shortcutsMap.end()) {
shortcutID = foundShortcut->second;
}
}
std::map<int, std::string>::const_iterator foundIcon = iconsMap.find(i);
if (foundIcon != iconsMap.end()) {
iconFilePath = foundIcon->second;
}
QIcon icon;
if (!iconFilePath.empty()) {
QPixmap pix( getPixmapPathFromFilePath( QString::fromUtf8( iconFilePath.c_str() ) ) );
if (!pix.isNull()) {
pix = pix.scaled(TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE));
icon.addPixmap(pix);
}
}
if (!shortcutID.empty() && !pluginShortcutGroup.empty() && !_comboBox->isCascading()) {
QAction* action = new ActionWithShortcut(pluginShortcutGroup,
shortcutID,
entries[i].label,
_comboBox);
if (!icon.isNull()) {
action->setIcon(icon);
}
_comboBox->addAction(action);
} else {
_comboBox->addItem( QString::fromUtf8( entries[i].label.c_str() ), icon, QKeySequence(), QString::fromUtf8( entries[i].tooltip.c_str() ) );
}
} // for all entries
const std::vector<int>& separators = knob->getSeparators();
for (std::size_t i = 0; i < separators.size(); ++i) {
_comboBox->insertSeparator(separators[i]);
}
// the "New" menu is only added to known parameters (e.g. the choice of output channels)
if (knob->getNewOptionCallback()) {
_comboBox->addItemNew();
}
updateGUI();
} // onEntriesPopulated