本文整理汇总了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
示例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