本文整理汇总了C++中KnobGuiPtr::removeKeyFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobGuiPtr::removeKeyFrame方法的具体用法?C++ KnobGuiPtr::removeKeyFrame怎么用?C++ KnobGuiPtr::removeKeyFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobGuiPtr
的用法示例。
在下文中一共展示了KnobGuiPtr::removeKeyFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: assert
void
MultipleKnobEditsUndoCommand::undo()
{
assert( !knobs.empty() );
KnobHolder* holder = knobs.begin()->first.lock()->getKnob()->getHolder();
if (holder) {
holder->beginChanges();
}
for (ParamsMap::iterator it = knobs.begin(); it != knobs.end(); ++it) {
KnobGuiPtr knobUI = it->first.lock();
if (!knobUI) {
continue;
}
KnobPtr knob = knobUI->getKnob();
if (!knob) {
continue;
}
knob->beginChanges();
Knob<int>* isInt = dynamic_cast<Knob<int>*>( knob.get() );
Knob<bool>* isBool = dynamic_cast<Knob<bool>*>( knob.get() );
Knob<double>* isDouble = dynamic_cast<Knob<double>*>( knob.get() );
Knob<std::string>* isString = dynamic_cast<Knob<std::string>*>( knob.get() );
KeyFrame k;
for (std::list<ValueToSet>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
KnobHelper::ValueChangedReturnCodeEnum retCode = (KnobHelper::ValueChangedReturnCodeEnum)it2->setValueRetCode;
if (retCode == KnobHelper::eValueChangedReturnCodeKeyframeAdded) {
knobUI->removeKeyFrame( it2->time, it2->dimension, ViewIdx(0) );
} else {
if (it2->setKeyFrame) {
bool refreshGui = it2->time == knob->getHolder()->getApp()->getTimeLine()->currentFrame();
if (isInt) {
knobUI->setValueAtTime<int>(it2->dimension, it2->oldValue.toInt(), it2->time, ViewIdx(0), &k, refreshGui, _reason);
} else if (isBool) {
knobUI->setValueAtTime<bool>(it2->dimension, it2->oldValue.toBool(), it2->time, ViewIdx(0), &k, refreshGui, _reason);
} else if (isDouble) {
knobUI->setValueAtTime<double>(it2->dimension, it2->oldValue.toDouble(), it2->time, ViewIdx(0), &k, refreshGui, _reason);
} else if (isString) {
knobUI->setValueAtTime<std::string>(it2->dimension, it2->oldValue.toString().toStdString(), it2->time, ViewIdx(0), &k, refreshGui, _reason);
} else {
assert(false);
}
} else {
if (isInt) {
knobUI->setValue<int>(it2->dimension, it2->oldValue.toInt(), &k, true, _reason);
} else if (isBool) {
knobUI->setValue<bool>(it2->dimension, it2->oldValue.toBool(), &k, true, _reason);
} else if (isDouble) {
knobUI->setValue<double>(it2->dimension, it2->oldValue.toDouble(), &k, true, _reason);
} else if (isString) {
knobUI->setValue<std::string>(it2->dimension, it2->oldValue.toString().toStdString(),
&k, true, _reason);
} else {
assert(false);
}
}
}
}
knob->endChanges();
}
if (holder) {
holder->endChanges();
}
} // MultipleKnobEditsUndoCommand::undo