Exemplo n.º 1
0
void
KnobGuiChoice::setEnabled()
{
    KnobChoicePtr knob = _knob.lock();
    bool b = knob->isEnabled(0) && knob->getExpression(0).empty();

    _comboBox->setEnabled_natron(b);
}
Exemplo n.º 2
0
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
Exemplo n.º 3
0
void
KnobGuiChoice::reflectAnimationLevel(DimIdx /*dimension*/,
                                     AnimationLevelEnum level)
{
    KnobChoicePtr knob = _knob.lock();
    if (!knob) {
        return;
    }
    bool isEnabled = knob->isEnabled();
    _comboBox->setEnabled_natron(level != eAnimationLevelExpression && isEnabled);

    if ( level != (AnimationLevelEnum)_comboBox->getAnimation() ) {
        _comboBox->setAnimation((int)level);
    }
}