本文整理汇总了C++中KnobBoolPtr::slaveTo方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobBoolPtr::slaveTo方法的具体用法?C++ KnobBoolPtr::slaveTo怎么用?C++ KnobBoolPtr::slaveTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobBoolPtr
的用法示例。
在下文中一共展示了KnobBoolPtr::slaveTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getContext
void
TrackMarker::setEnabledFromGui(double /*time*/,
bool enabled)
{
KnobBoolPtr knob = _imp->enabled.lock();
if (!knob) {
return;
}
KeyFrame k;
std::pair<int, KnobIPtr> master = knob->getMaster(0);
if (master.second) {
knob->unSlave(0, true);
}
knob->onValueChanged(enabled, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited, &k);
if (master.second) {
master.second->cloneAndUpdateGui(knob);
knob->slaveTo(0, master.second, master.first);
}
getContext()->solveTransformParamsIfAutomatic();
}
示例2: args
void
TrackerNodePrivate::exportTrackDataFromExportOptions()
{
//bool transformLink = _imp->exportLink.lock()->getValue();
KnobChoicePtr transformTypeKnob = transformType.lock();
assert(transformTypeKnob);
int transformType_i = transformTypeKnob->getValue();
TrackerTransformNodeEnum transformType = (TrackerTransformNodeEnum)transformType_i;
KnobChoicePtr motionTypeKnob = motionType.lock();
if (!motionTypeKnob) {
return;
}
int motionType_i = motionTypeKnob->getValue();
TrackerMotionTypeEnum mt = (TrackerMotionTypeEnum)motionType_i;
if (mt == eTrackerMotionTypeNone) {
Dialogs::errorDialog( tr("Tracker Export").toStdString(), tr("Please select the export mode with the Motion Type parameter").toStdString() );
return;
}
bool linked = exportLink.lock()->getValue();
QString pluginID;
switch (transformType) {
case eTrackerTransformNodeCornerPin:
pluginID = QString::fromUtf8(PLUGINID_OFX_CORNERPIN);
break;
case eTrackerTransformNodeTransform:
pluginID = QString::fromUtf8(PLUGINID_OFX_TRANSFORM);
break;
}
NodePtr thisNode = publicInterface->getNode();
AppInstancePtr app = thisNode->getApp();
CreateNodeArgsPtr args(CreateNodeArgs::create( pluginID.toStdString(), thisNode->getGroup() ));
args->setProperty<bool>(kCreateNodeArgsPropAutoConnect, false);
args->setProperty<bool>(kCreateNodeArgsPropSettingsOpened, false);
NodePtr createdNode = app->createNode(args);
if (!createdNode) {
return;
}
// Move the new node
double thisNodePos[2];
double thisNodeSize[2];
thisNode->getPosition(&thisNodePos[0], &thisNodePos[1]);
thisNode->getSize(&thisNodeSize[0], &thisNodeSize[1]);
createdNode->setPosition(thisNodePos[0] + thisNodeSize[0] * 2., thisNodePos[1]);
int timeForFromPoints = referenceFrame.lock()->getValue();
switch (transformType) {
case eTrackerTransformNodeCornerPin: {
KnobDoublePtr cornerPinToPoints[4];
KnobDoublePtr cornerPinFromPoints[4];
for (unsigned int i = 0; i < 4; ++i) {
cornerPinFromPoints[i] = getCornerPinPoint(createdNode, true, i);
assert(cornerPinFromPoints[i]);
for (int j = 0; j < cornerPinFromPoints[i]->getNDimensions(); ++j) {
cornerPinFromPoints[i]->setValue(fromPoints[i].lock()->getValueAtTime(timeForFromPoints, DimIdx(j)), ViewSetSpec::all(), DimIdx(j));
}
cornerPinToPoints[i] = getCornerPinPoint(createdNode, false, i);
assert(cornerPinToPoints[i]);
if (!linked) {
cornerPinToPoints[i]->copyKnob( toPoints[i].lock() );
} else {
bool ok = cornerPinToPoints[i]->slaveTo(toPoints[i].lock());
(void)ok;
assert(ok);
}
}
{
KnobIPtr knob = createdNode->getKnobByName(kCornerPinParamMatrix);
if (knob) {
KnobDoublePtr isType = toKnobDouble(knob);
if (isType) {
isType->copyKnob(cornerPinMatrix.lock() );
}
}
}
break;
}
case eTrackerTransformNodeTransform: {
KnobIPtr translateKnob = createdNode->getKnobByName(kTransformParamTranslate);
if (translateKnob) {
KnobDoublePtr isDbl = toKnobDouble(translateKnob);
if (isDbl) {
if (!linked) {
isDbl->copyKnob(translate.lock() );
} else {
isDbl->slaveTo(translate.lock());
}
}
}
//.........这里部分代码省略.........