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


C++ KnobIPtr::deleteValueAtTime方法代码示例

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


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

示例1:

void
DSPasteKeysCommand::addOrRemoveKeyframe(bool add)
{
    for (std::list<boost::weak_ptr<DSKnob> >::const_iterator it = _dstKnobs.begin(); it != _dstKnobs.end(); ++it) {
        DSKnobPtr knobContext = it->lock();
        if (!knobContext) {
            continue;
        }
        for (std::size_t i = 0; i < _keys.size(); ++i) {

            int dim = knobContext->getDimension();
            KnobIPtr knob = knobContext->getInternalKnob();
            knob->beginChanges();

            double keyTime = _keys[i].key.getTime();
            double setTime = _pasteRelativeToRefTime ? keyTime - _keys[_refKeyindex].key.getTime() + _refTime : keyTime;

            if (add) {

                for (int j = 0; j < knob->getDimension(); ++j) {
                    if ( (dim == -1) || (j == dim) ) {
                        KeyFrame k = _keys[i].key;
                        k.setTime(setTime);

                        knob->setKeyFrame(k, ViewSpec::all(), j, eValueChangedReasonNatronGuiEdited);
                    }
                }
            } else {
                for (int j = 0; j < knob->getDimension(); ++j) {
                    if ( (dim == -1) || (j == dim) ) {
                        knob->deleteValueAtTime(eCurveChangeReasonDopeSheet, setTime, ViewSpec::all(), j, i == 0);
                    }
                }
            }
            
            knob->endChanges();
        }
    }


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

示例2: assert

void
MultipleKnobEditsUndoCommand::undo()
{
    assert( !knobs.empty() );
    KnobHolderPtr holder = knobs.begin()->first.lock()->getHolder();
    if (holder) {
        holder->beginChanges();
    }

    for (ParamsMap::iterator it = knobs.begin(); it != knobs.end(); ++it) {

        KnobIPtr knob = it->first.lock();
        if (!knob) {
            continue;
        }

        if (it->second.empty()) {
            continue;
        }

        // All knobs must belong to the same node!
        assert(knob->getHolder() == holder);


        KnobIntBasePtr isInt = toKnobIntBase(knob);
        KnobBoolBasePtr isBool = toKnobBoolBase(knob);
        KnobDoubleBasePtr isDouble = toKnobDoubleBase(knob);
        KnobStringBasePtr isString = toKnobStringBase(knob);

        bool hasChanged = false;

        std::list<ValueToSet>::iterator next = it->second.begin();
        ++next;

        if (it->second.size() > 1) {
            // block knobChanged handler for this knob until the last change so we don't clutter the main-thread with useless action calls
            knob->blockValueChanges();
        }

        for (std::list<ValueToSet>::reverse_iterator it2 = it->second.rbegin(); it2 != it->second.rend(); ++it2) {

            if (next == it->second.end() && it->second.size() > 1) {
                // Re-enable knobChanged for the last change on this knob
                knob->unblockValueChanges();
            }

            // If we added a keyframe (due to auto-keying or not) remove it
            if (it2->setValueRetCode == eValueChangedReturnCodeKeyframeAdded) {
                knob->deleteValueAtTime(it2->time, it2->view, it2->dimension, eValueChangedReasonUserEdited);
            }

            int nDims = knob->getNDimensions();
            std::list<ViewIdx> allViews = knob->getViewsList();
            if (it2->dimension.isAll()) {
                for (int i = 0; i < nDims; ++i) {
                    if (it2->view.isAll()) {
                        for (std::list<ViewIdx>::const_iterator it3 = allViews.begin(); it3!=allViews.end(); ++it3) {
                            hasChanged |= setOldValueForDimView(isInt, isBool, isDouble, isString, it2->reason, it2->setKeyFrame, it2->time, hasChanged,  it2->setValueRetCode, DimIdx(i), *it3, it2->oldValues) != eValueChangedReturnCodeNothingChanged;
                        }
                    } else {
                        ViewIdx view_i = knob->getViewIdxFromGetSpec(ViewGetSpec(it2->view));
                        hasChanged |= setOldValueForDimView(isInt, isBool, isDouble, isString, it2->reason, it2->setKeyFrame, it2->time, hasChanged,  it2->setValueRetCode, DimIdx(i), view_i, it2->oldValues) != eValueChangedReturnCodeNothingChanged;
                    }
                }

            } else {
                if (it2->view.isAll()) {
                    for (std::list<ViewIdx>::const_iterator it3 = allViews.begin(); it3!=allViews.end(); ++it3) {
                        hasChanged |= setOldValueForDimView(isInt, isBool, isDouble, isString, it2->reason, it2->setKeyFrame, it2->time, hasChanged,  it2->setValueRetCode, DimIdx(it2->dimension), *it3, it2->oldValues) != eValueChangedReturnCodeNothingChanged;
                    }
                } else {
                    ViewIdx view_i = knob->getViewIdxFromGetSpec(ViewGetSpec(it2->view));
                    hasChanged |= setOldValueForDimView(isInt, isBool, isDouble, isString, it2->reason, it2->setKeyFrame, it2->time, hasChanged,  it2->setValueRetCode, DimIdx(it2->dimension), view_i, it2->oldValues) != eValueChangedReturnCodeNothingChanged;
                }
            }

            if (next != it->second.end()) {
                ++next;
            }

        }
    } // for all knobs


    if (holder) {
        holder->endChanges();
    }
} // MultipleKnobEditsUndoCommand::undo
开发者ID:azerupi,项目名称:Natron,代码行数:88,代码来源:KnobUndoCommand.cpp


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