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


C++ KnobGuiPtr::getKnob方法代码示例

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


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

示例1: ss

PasteUndoCommand::PasteUndoCommand(const KnobGuiPtr& knob,
                                   KnobClipBoardType type,
                                   int fromDimension,
                                   int targetDimension,
                                   const KnobPtr& fromKnob)
    : QUndoCommand(0)
    , _imp( new PasteUndoCommandPrivate() )
{
    _imp->knob = knob;
    _imp->type = type;
    _imp->fromDimension = fromDimension;
    _imp->targetDimension = targetDimension;
    _imp->fromKnob = fromKnob;

    {
        std::ostringstream ss;
        {
            try {
                boost::archive::xml_oarchive oArchive(ss);
                _imp->originalSerialization->initialize( knob->getKnob() );
                oArchive << boost::serialization::make_nvp("KnobClipboard", *_imp->originalSerialization);
            } catch (...) {
                assert(false);
            }
        }
        _imp->originalSerialization.reset(new KnobSerialization);
        std::string str = ss.str();
        {
            try {
                std::stringstream ss(str);
                boost::archive::xml_iarchive iArchive(ss);
                iArchive >> boost::serialization::make_nvp("KnobClipboard", *_imp->originalSerialization);
            } catch (...) {
                assert(false);
            }
        }
    }
    assert( _imp->originalSerialization->getKnob() );

    assert(knob);
    assert( _imp->targetDimension >= -1 && _imp->targetDimension < _imp->knob.lock()->getKnob()->getDimension() );
    assert( _imp->fromDimension >= -1 && _imp->fromDimension < _imp->fromKnob->getDimension() );
    QString text;
    switch (type) {
    case eKnobClipBoardTypeCopyAnim:
        text = tr("Paste Animation to %1");
        break;
    case eKnobClipBoardTypeCopyValue:
        text = tr("Paste Value to %1");
        break;
    case eKnobClipBoardTypeCopyLink:
        text = tr("Paste Link to %1");
        break;
    }
    setText( text.arg( QString::fromUtf8( knob->getKnob()->getLabel().c_str() ) ) );
}
开发者ID:jessezwd,项目名称:Natron,代码行数:56,代码来源:KnobUndoCommand.cpp

示例2: QUndoCommand

MultipleKnobEditsUndoCommand::MultipleKnobEditsUndoCommand(const KnobGuiPtr& knob,
                                                           ValueChangedReasonEnum reason,
                                                           bool createNew,
                                                           bool setKeyFrame,
                                                           const Variant & value,
                                                           int dimension,
                                                           double time)
    : QUndoCommand()
    , knobs()
    , createNew(createNew)
    , firstRedoCalled(false)
    , _reason(reason)
{
    assert(knob);
    std::list<ValueToSet>& vlist = knobs[knob];
    ValueToSet v;
    v.newValue = value;
    v.dimension = dimension;
    assert(dimension != -1);
    v.time = time;
    v.setKeyFrame = setKeyFrame;
    v.setValueRetCode = -1;
    vlist.push_back(v);

    KnobHolder* holder = knob->getKnob()->getHolder();
    EffectInstance* effect = dynamic_cast<EffectInstance*>(holder);
    QString holderName;
    if (effect) {
        holderName = QString::fromUtf8( effect->getNode()->getLabel().c_str() );
    }

    setText( tr("Multiple edits for %1").arg(holderName) );
}
开发者ID:jessezwd,项目名称:Natron,代码行数:33,代码来源:KnobUndoCommand.cpp

示例3: if

void
KnobGuiGroup::setCheckedInternal(bool checked,
                                 bool userRequested)
{
    if (checked == _checked) {
        return;
    }
    _checked = checked;

    if (userRequested) {
        KnobGroupPtr knob = _knob.lock();
        if (knob) {
            knob->setValue(checked);
        }
    }

    //getGui()->getPropertiesBin()->setUpdatesEnabled(false);
    for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
        KnobGuiPtr knob = it->lock();
        if (!knob) {
            continue;
        }
        if (!checked) {
            knob->hide();
        } else if ( !knob->getKnob()->getIsSecret() ) {
            knob->show();
        }
    }
    //getGui()->getPropertiesBin()->setUpdatesEnabled(true);
}
开发者ID:azerupi,项目名称:Natron,代码行数:30,代码来源:KnobGuiGroup.cpp

示例4: assert

void
DSRemoveKeysCommand::addOrRemoveKeyframe(bool add)
{
    std::set<KnobGuiPtr> knobsSet;
    for (std::vector<DopeSheetKey>::iterator it = _keys.begin(); it != _keys.end(); ++it) {
        DopeSheetKey selected = (*it);
        DSKnobPtr knobContext = selected.context.lock();
        if (!knobContext) {
            continue;
        }

        KnobGuiPtr knobGui = knobContext->getKnobGui();
        assert(knobGui);

        std::pair<std::set<KnobGuiPtr>::iterator,bool> ok = knobsSet.insert(knobGui);
        if (ok.second) {
            knobGui->getKnob()->beginChanges();
        }
        if (add) {
            knobGui->setKeyframe( selected.key.getTime(), selected.key, knobContext->getDimension(), ViewIdx(0) );
        } else {
            knobGui->removeKeyFrame( selected.key.getTime(), knobContext->getDimension(), ViewIdx(0) );
            knobContext->getTreeItem()->setSelected(false);
        }
    }

    for (std::set<KnobGuiPtr>::iterator it = knobsSet.begin(); it != knobsSet.end(); ++it) {
        (*it)->getKnob()->endChanges();
    }

    _model->refreshSelectionBboxAndRedrawView();
}
开发者ID:Kthulhu,项目名称:Natron,代码行数:32,代码来源:DopeSheetEditorUndoRedo.cpp

示例5: KnobGuiValue

KnobGuiColor::KnobGuiColor(const KnobGuiPtr& knobUI, ViewIdx view)
    : KnobGuiValue(knobUI, view)
    , _knob( toKnobColor(knobUI->getKnob()) )
    , _colorLabel(0)
    , _colorDialogButton(0)
    , _useSimplifiedUI(false)
    , _uiColorspaceLut(0)
    , _internalColorspaceLut(0)
{
    KnobColorPtr knob = _knob.lock();
    if (!knob) {
        return;
    }
    _useSimplifiedUI = knob && knob->isSimplified();
    if (!_useSimplifiedUI) {
        DimIdx singleDim;
        bool singleDimEnabled = knobUI->isSingleDimensionalEnabled(&singleDim);
        if (knobUI->getLayoutType() == KnobGui::eKnobLayoutTypeViewerUI && !singleDimEnabled) {
            _useSimplifiedUI = true;
        }
    }
    const std::string& uiName = knob->getUIColorspaceName();
    const std::string& internalName = knob->getInternalColorspaceName();
    _uiColorspaceLut = Color::LutManager::findLut(uiName);
    _internalColorspaceLut = Color::LutManager::findLut(internalName);
}
开发者ID:MrKepzie,项目名称:Natron,代码行数:26,代码来源:KnobGuiColor.cpp

示例6: KnobGuiWidgets

KnobGuiGroup::KnobGuiGroup(const KnobGuiPtr& knob, ViewIdx view)
    : KnobGuiWidgets(knob, view)
    , _checked(false)
    , _button(0)
    , _children()
    , _knob( toKnobGroup(knob->getKnob()) )
{
}
开发者ID:azerupi,项目名称:Natron,代码行数:8,代码来源:KnobGuiGroup.cpp

示例7: ComboBox

KnobComboBox::KnobComboBox(const KnobGuiPtr& knob,
                           DimSpec dimension,
                           ViewIdx view,
                           QWidget* parent)
    : ComboBox(parent)
    , _knob(toKnobChoice(knob->getKnob()))
    , _dnd( KnobWidgetDnD::create(knob, dimension, view, this) )
    , _drawLinkedFrame(false)
{
}
开发者ID:MrKepzie,项目名称:Natron,代码行数:10,代码来源:KnobGuiChoice.cpp

示例8: logic_error

LinkToKnobDialog::LinkToKnobDialog(const KnobGuiPtr& from,
                                   QWidget* parent)
    : QDialog(parent)
    , _imp( new LinkToKnobDialogPrivate(from) )
{
    _imp->mainLayout = new QVBoxLayout(this);

    _imp->firstLine = new QWidget(this);
    _imp->firstLineLayout = new QHBoxLayout(_imp->firstLine);

    _imp->mainLayout->addWidget(_imp->firstLine);

    _imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
                                         Qt::Horizontal, this);
    QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
    QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
    _imp->mainLayout->addWidget(_imp->buttons);

    _imp->selectNodeLabel = new Label(tr("Parent:"), _imp->firstLine);
    _imp->firstLineLayout->addWidget(_imp->selectNodeLabel);


    EffectInstance* isEffect = dynamic_cast<EffectInstance*>( from->getKnob()->getHolder() );
    assert(isEffect);
    if (!isEffect) {
        throw std::logic_error("");
    }
    boost::shared_ptr<NodeCollection> group = isEffect->getNode()->getGroup();
    group->getActiveNodes(&_imp->allNodes);
    NodeGroup* isGroup = dynamic_cast<NodeGroup*>( group.get() );
    if (isGroup) {
        _imp->allNodes.push_back( isGroup->getNode() );
    }
    QStringList nodeNames;
    for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
        QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
        nodeNames.push_back(name);
        //_imp->nodeSelectionCombo->addItem(name);
    }
    nodeNames.sort();
    _imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
    _imp->nodeSelectionCombo->setToolTip( GuiUtils::convertFromPlainText(tr("Input the name of a node in the current project."), Qt::WhiteSpaceNormal) );
    _imp->firstLineLayout->addWidget(_imp->nodeSelectionCombo);


    _imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
    QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) );

    _imp->knobSelectionCombo = new ComboBox(_imp->firstLine);
    _imp->firstLineLayout->addWidget(_imp->knobSelectionCombo);

    QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );

    _imp->firstLineLayout->addStretch();
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:55,代码来源:LinkToKnobDialog.cpp

示例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;
}
开发者ID:MrKepzie,项目名称:Natron,代码行数:11,代码来源:KnobGuiChoice.cpp

示例10: onSelectedKnobChanged

 void onSelectedKnobChanged()
 {
     if (!selectedKnob) {
         return;
     }
     KnobParametricPtr isParametric = toKnobParametric( selectedKnob->getKnob() );
     if (isParametric) {
         useAliasCheckBox->setChecked(true);
     }
     useAliasLabel->setEnabled(!isParametric);
     useAliasCheckBox->setEnabled(!isParametric);
 }
开发者ID:kcotugno,项目名称:Natron,代码行数:12,代码来源:PickKnobDialog.cpp

示例11: onSelectedKnobChanged

 void onSelectedKnobChanged()
 {
     if (!selectedKnob) {
         return;
     }
     KnobParametric* isParametric = dynamic_cast<KnobParametric*>( selectedKnob->getKnob().get() );
     if (isParametric) {
         useAliasCheckBox->setChecked(true);
     }
     useAliasLabel->setEnabled(!isParametric);
     useAliasCheckBox->setEnabled(!isParametric);
 }
开发者ID:jessezwd,项目名称:Natron,代码行数:12,代码来源:PickKnobDialog.cpp

示例12: setEnabled

void
ColorPickerLabel::setEnabledMode(bool enabled)
{
    setEnabled(enabled);
    if (!enabled && _pickingEnabled) {
        _pickingEnabled = false;
        setColor(_currentColor);
        if (_knob) {
            ViewIdx view = _knob->getView();
            KnobGuiPtr knobUI = _knob->getKnobGui();
            knobUI->getGui()->removeColorPicker( toKnobColor( knobUI->getKnob() ), view );
        }
    }
}
开发者ID:MrKepzie,项目名称:Natron,代码行数:14,代码来源:KnobGuiColor.cpp

示例13: KnobGuiWidgets

KnobGuiFile::KnobGuiFile(const KnobGuiPtr& knob, ViewIdx view)
    : KnobGuiWidgets(knob, view)
    , _lineEdit(0)
    , _openFileButton(0)
    , _reloadButton(0)
    , _lastOpened()
    , _lastModificationDates()
{
    KnobFilePtr k = toKnobFile(knob->getKnob());

    assert(k);
    QObject::connect( k.get(), SIGNAL(openFile()), this, SLOT(open_file()) );
    _knob = k;
}
开发者ID:azerupi,项目名称:Natron,代码行数:14,代码来源:KnobGuiFile.cpp

示例14:

void
KnobGuiGroup::setEnabled()
{
    boost::shared_ptr<KnobGroup> knob = _knob.lock();
    bool enabled = knob->isEnabled(0)  && !knob->isSlave(0) && knob->getExpression(0).empty();

    if (_button) {
        _button->setEnabled(enabled);
    }
    if (enabled) {
        for (U32 i = 0; i < _childrenToEnable.size(); ++i) {
            for (U32 j = 0; j < _childrenToEnable[i].second.size(); ++j) {
                KnobGuiPtr k = _childrenToEnable[i].first.lock();
                if (!k) {
                    continue;
                }
                k->getKnob()->setEnabled(_childrenToEnable[i].second[j], true);
            }
        }
    } else {
        _childrenToEnable.clear();
        for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
            KnobGuiPtr k = it->lock();
            if (!k) {
                continue;
            }
            std::vector<int> dimensions;
            for (int j = 0; j < k->getKnob()->getDimension(); ++j) {
                if ( k->getKnob()->isEnabled(j) ) {
                    k->getKnob()->setEnabled(j, false);
                    dimensions.push_back(j);
                }
            }
            _childrenToEnable.push_back( std::make_pair(*it, dimensions) );
        }
    }
}
开发者ID:JamesLinus,项目名称:Natron,代码行数:37,代码来源:KnobGuiGroup.cpp

示例15: getActualIndexInLayout

void
KnobGuiGroup::setCheckedInternal(bool checked, bool userRequested)
{
    if (checked == _checked) {
        return;
    }
    _checked = checked;
    
    if (userRequested) {
        boost::shared_ptr<KnobGroup> knob = _knob.lock();
        if (knob) {
            knob->setValue(checked, ViewSpec::all(), 0, eValueChangedReasonUserEdited, 0);
        }
    }
    
    ///get the current index of the group knob in the layout, and reinsert
    ///the children back with an offset relative to the group.
    int realIndexInLayout = getActualIndexInLayout();
    int startChildIndex = realIndexInLayout + 1;
    //getGui()->getPropertiesBin()->setUpdatesEnabled(false);
    for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
        KnobGuiPtr knob = it->lock();
        if (!knob) {
            continue;
        }
        if (!checked) {
            knob->hide();
        } else if ( !knob->getKnob()->getIsSecret() ) {
            knob->show(startChildIndex);
            if ( knob->getKnob()->isNewLineActivated() ) {
                ++startChildIndex;
            }
        }
    }
    //getGui()->getPropertiesBin()->setUpdatesEnabled(true);
}
开发者ID:JamesLinus,项目名称:Natron,代码行数:36,代码来源:KnobGuiGroup.cpp


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