本文整理汇总了C++中KnobIPtr::cloneCurve方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobIPtr::cloneCurve方法的具体用法?C++ KnobIPtr::cloneCurve怎么用?C++ KnobIPtr::cloneCurve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobIPtr
的用法示例。
在下文中一共展示了KnobIPtr::cloneCurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromCurve
void
PasteKnobClipBoardUndoCommand::copyFrom(const SERIALIZATION_NAMESPACE::KnobSerializationPtr& serializedKnob,
const KnobIPtr& fromKnob,
bool isRedo)
{
KnobIPtr internalKnob = _imp->knob.lock();
if (!internalKnob) {
return;
}
// Get the target type
KnobIntBasePtr isInt = toKnobIntBase( internalKnob );
KnobBoolBasePtr isBool = toKnobBoolBase( internalKnob );
KnobDoubleBasePtr isDouble = toKnobDoubleBase( internalKnob );
KnobStringBasePtr isString = toKnobStringBase( internalKnob );
// Get view names
std::vector<std::string> projectViewNames;
if (internalKnob->getHolder() && internalKnob->getHolder()->getApp()) {
projectViewNames = internalKnob->getHolder()->getApp()->getProject()->getProjectViewNames();
}
// group changes under the same evaluation
internalKnob->beginChanges();
std::list<ViewIdx> targetKnobViews = internalKnob->getViewsList();
StringAnimationManagerPtr fromAnimString;
if (fromKnob) {
fromAnimString = fromKnob->getStringAnimation();
}
for (std::list<ViewIdx>::const_iterator it = targetKnobViews.begin(); it != targetKnobViews.end(); ++it) {
if ( ( !_imp->targetView.isAll()) && ( *it != _imp->targetView) ) {
continue;
}
// If dimensions are folded, expand them when linking
if (_imp->targetDimension.isAll() && !internalKnob->getAllDimensionsVisible(*it)) {
internalKnob->setAllDimensionsVisible(*it, true);
}
for (int i = 0; i < internalKnob->getNDimensions(); ++i) {
if ( ( !_imp->targetDimension.isAll()) && ( i != _imp->targetDimension) ) {
continue;
}
ViewIdx fromView;
DimIdx fromDim;
if ( !_imp->targetDimension.all() && !_imp->fromDimension.isAll() ) {
fromDim = DimIdx(_imp->fromDimension);
} else {
// If the source knob dimension is all or target dimension is all copy dimension to dimension respectively
fromDim = DimIdx(i);
}
if ( !_imp->targetView.isAll() && !_imp->fromView.isAll() ) {
fromView = ViewIdx(_imp->fromView);
} else {
// If the source knob view is all or target view is all copy view to view respectively
fromView = *it;
}
switch (_imp->type) {
case eKnobClipBoardTypeCopyAnim: {
std::string fromViewName;
if (fromView >= 0 && fromView < (int)projectViewNames.size()) {
fromViewName = projectViewNames[_imp->fromView];
} else {
fromViewName = "Main";
}
SERIALIZATION_NAMESPACE::KnobSerialization::PerViewValueSerializationMap::const_iterator foundFromView = serializedKnob->_values.find(fromViewName);
if (foundFromView == serializedKnob->_values.end()) {
continue;
}
if (fromDim < 0 || fromDim >= (int) foundFromView->second.size()) {
continue;
}
// Read the curve from the clipboard
CurvePtr fromCurve(new Curve());
if (!foundFromView->second[_imp->fromDimension]._animationCurve.keys.empty()) {
fromCurve->fromSerialization(foundFromView->second[_imp->fromDimension]._animationCurve);
}
internalKnob->cloneCurve(*it, DimIdx(i), *fromCurve, 0 /*offset*/, 0 /*range*/, fromAnimString.get());
break;
}
case eKnobClipBoardTypeCopyValue: {
std::string fromViewName;
if (fromView >= 0 && fromView < (int)projectViewNames.size()) {
fromViewName = projectViewNames[_imp->fromView];
//.........这里部分代码省略.........