本文整理汇总了C++中KnobIPtr::blockValueChanges方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobIPtr::blockValueChanges方法的具体用法?C++ KnobIPtr::blockValueChanges怎么用?C++ KnobIPtr::blockValueChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobIPtr
的用法示例。
在下文中一共展示了KnobIPtr::blockValueChanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
MultipleKnobEditsUndoCommand::redo()
{
// The first time, everything is handled within setValue/setValueAtTime already
if (!firstRedoCalled) {
firstRedoCalled = true;
return;
}
assert( !knobs.empty() );
KnobHolderPtr holder = knobs.begin()->first.lock()->getHolder();
// Make sure we get a single evaluation
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>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
if (next == it->second.end() && it->second.size() > 1) {
// Re-enable knobChanged for the last change on this knob
knob->unblockValueChanges();
}
if (it2->setKeyFrame) {
if (isInt) {
it2->setValueRetCode = isInt->setValueAtTime(it2->time, it2->newValue.toInt(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isBool) {
it2->setValueRetCode = isBool->setValueAtTime(it2->time, it2->newValue.toBool(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isDouble) {
it2->setValueRetCode = isDouble->setValueAtTime(it2->time, it2->newValue.toDouble(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isString) {
it2->setValueRetCode = isString->setValueAtTime(it2->time, it2->newValue.toString().toStdString(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else {
assert(false);
}
} else {
if (isInt) {
it2->setValueRetCode = isInt->setValue(it2->newValue.toInt(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isBool) {
it2->setValueRetCode = isBool->setValue(it2->newValue.toBool(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isDouble) {
it2->setValueRetCode = isDouble->setValue(it2->newValue.toDouble(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else if (isString) {
it2->setValueRetCode = isString->setValue(it2->newValue.toString().toStdString(), it2->view, it2->dimension, it2->reason, 0, hasChanged);
} else {
assert(false);
}
}
hasChanged |= it2->setValueRetCode != eValueChangedReturnCodeNothingChanged;
if (next != it->second.end()) {
++next;
}
}
}
if (holder) {
holder->endChanges();
}
} // redo