本文整理汇总了C++中MFnNumericData::setData3Double方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnNumericData::setData3Double方法的具体用法?C++ MFnNumericData::setData3Double怎么用?C++ MFnNumericData::setData3Double使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnNumericData
的用法示例。
在下文中一共展示了MFnNumericData::setData3Double方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectObjectAndConstraint
MStatus geometrySurfaceConstraintCommand::connectObjectAndConstraint( MDGModifier& modifier )
{
MObject transform = transformObject();
if ( transform.isNull() )
{
MGlobal::displayError("Failed to get transformObject()");
return MS::kFailure;
}
MStatus status;
MFnTransform transformFn( transform );
MVector translate = transformFn.getTranslation(MSpace::kTransform,&status);
if (!status) { status.perror(" transformFn.getTranslation"); return status;}
MPlug translatePlug = transformFn.findPlug( "translate", &status );
if (!status) { status.perror(" transformFn.findPlug"); return status;}
if ( MPlug::kFreeToChange == translatePlug.isFreeToChange() )
{
MFnNumericData nd;
MObject translateData = nd.create( MFnNumericData::k3Double, &status );
status = nd.setData3Double( translate.x,translate.y,translate.z);
if (!status) { status.perror("nd.setData3Double"); return status;}
status = modifier.newPlugValue( translatePlug, translateData );
if (!status) { status.perror("modifier.newPlugValue"); return status;}
status = connectObjectAttribute(
MPxTransform::geometry,
geometrySurfaceConstraint::constraintGeometry, false );
if (!status) { status.perror("connectObjectAttribute"); return status;}
}
status = connectObjectAttribute(
MPxTransform::parentInverseMatrix,
geometrySurfaceConstraint::constraintParentInverseMatrix, true, true );
if (!status) { status.perror("connectObjectAttribute"); return status;}
return MS::kSuccess;
}
示例2: centerPointCallback
//- This method is plugToManipConversionCallback function
//- You implement it so that a specific component of the manipulator
//- will be modified automatically when some plug value changes on
//- the custom locator.
//- Arguments:
//- manipIndex - the index of the component on the manip you want to affect,
//- in this case, it is the center point of this manip
//- Return Values:
//- MManipData object, which represents the updated value
MManipData arrowLocatorManip::centerPointCallback(unsigned int manipIndex)
{
MStatus status;
//Get parent transform node of the locator node
MObject parentTransform = fNodePath.transform(&status);
//Get the transform node DAG path
MDagPath transformPath;
MDagPath::getAPathTo(parentTransform,transformPath);
//Retrieve world space translation
MFnTransform fnTrans(transformPath,&status);
MVector translation = fnTrans.getTranslation(MSpace::kWorld,&status);
MFnNumericData numData;
MObject numDataValue = numData.create(MFnNumericData::k3Double,&status);
status = numData.setData3Double(translation.x,translation.y,translation.z);
MManipData manipData(numDataValue);
return manipData;
}