当前位置: 首页>>代码示例>>C++>>正文


C++ KnobChoicePtr::getActiveEntry方法代码示例

本文整理汇总了C++中KnobChoicePtr::getActiveEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobChoicePtr::getActiveEntry方法的具体用法?C++ KnobChoicePtr::getActiveEntry怎么用?C++ KnobChoicePtr::getActiveEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KnobChoicePtr的用法示例。


在下文中一共展示了KnobChoicePtr::getActiveEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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 (...) {

    }
}
开发者ID:kcotugno,项目名称:Natron,代码行数:28,代码来源:ViewerNodePrivate.cpp

示例2: if

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
开发者ID:kcotugno,项目名称:Natron,代码行数:54,代码来源:ViewerNodePrivate.cpp


注:本文中的KnobChoicePtr::getActiveEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。