当前位置: 首页>>代码示例>>C++>>正文


C++ MFnNumericData::setData3Double方法代码示例

本文整理汇总了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;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:39,代码来源:geometrySurfaceConstraint.cpp

示例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;
}
开发者ID:JerryKon,项目名称:Maya-Training-Material,代码行数:31,代码来源:arrowLocatorManipNode.cpp


注:本文中的MFnNumericData::setData3Double方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。