您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CHECK_MSTATUS函数代码示例

51自学网 2021-06-01 20:00:59
  C++
这篇教程C++ CHECK_MSTATUS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CHECK_MSTATUS函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_MSTATUS函数的具体用法?C++ CHECK_MSTATUS怎么用?C++ CHECK_MSTATUS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CHECK_MSTATUS函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CHECK_MSTATUS

MStatus TestDeformer::deform(MDataBlock& data,                          MItGeometry& iter,                          const MMatrix& localToWorldMatrix,                          unsigned int mIndex){    MStatus status;    // get the current node state    short initialized_mapping = data.inputValue( initialized_data, &status).asShort();    CHECK_MSTATUS(status);    __debug("%s(), initialized_mapping=%d, mIndex=%d", __FUNCTION__, initialized_mapping, mIndex);    if( initialized_mapping == 1 )    {        initVertMapping(data, iter, localToWorldMatrix, mIndex);        // set initialized_data to 2 automatically. User don't have to set it manully.        MObject tObj  =  thisMObject();        MPlug setInitMode = MPlug( tObj, initialized_data  );        setInitMode.setShort( 2 );        // and sync initialized_mapping from initialized_data        // so, the code section:        //     if (initialized_mapping == 2)        //     {        //         ...        //     }        // will be executed when this deform() function is called next time.        initialized_mapping = data.inputValue( initialized_data, &status ).asShort();        CHECK_MSTATUS(status);    }    if( initialized_mapping == 2 )    {        envelope = MPxDeformerNode::envelope;        MDataHandle envelopeHandle = data.inputValue( envelope, &status );        CHECK_MSTATUS( status );        MArrayDataHandle vertMapArrayData  = data.inputArrayValue( vert_map, &status  );        CHECK_MSTATUS( status );        MArrayDataHandle meshAttrHandle = data.inputArrayValue( driver_mesh, &status );        CHECK_MSTATUS( status );        /// 1. init tempOutputPts to zero points        MPointArray tempOutputPts;        iter.reset();        while( !iter.isDone(&status) )        {            CHECK_MSTATUS(tempOutputPts.append(MPoint(0, 0, 0)));            CHECK_MSTATUS(iter.next());        }        assert(tempOutputPts.length() == iter.count());        /// 2. set tempOutputPts to deform values which comes from each driver mesh        iter.reset();        int numMeshes = meshAttrHandle.elementCount();        __debug("%s(), numMeshes=%d", __FUNCTION__, numMeshes);        CHECK_MSTATUS(meshAttrHandle.jumpToElement(0));        // for each driver mesh        for( int count=0; count < numMeshes; ++count )        {            __debug("%s(), count=%d", __FUNCTION__, count);            // for one driver mesh: currentMesh            MDataHandle currentMesh = meshAttrHandle.inputValue(&status);            CHECK_MSTATUS( status );            MObject meshMobj = currentMesh.asMesh();            __debugMeshInfo(__FUNCTION__, meshMobj);            // accumulate deform values of currentMesh to tempOutputPts            _deform_on_one_mesh(data, iter, localToWorldMatrix, mIndex,                                meshMobj,                                envelopeHandle, vertMapArrayData, tempOutputPts );            if( !meshAttrHandle.next() )            {                break;            }        }// for each driver mesh        /// 3. add deform value to this geometry(driven mesh)        int i = 0;        iter.reset();        while( !iter.isDone(&status) )        {            MPoint p = iter.position(MSpace::kObject, &status);            CHECK_MSTATUS(status);            // add the deform value to this vertex            CHECK_MSTATUS(iter.setPosition( p + tempOutputPts[i]/numMeshes ));            CHECK_MSTATUS(iter.next());            ++i;//.........这里部分代码省略.........
开发者ID:yaoyansi,项目名称:mymagicbox,代码行数:101,


示例2: CHECK_MSTATUS

// The initialize routine is called after the node has been created.// It sets up the input and output attributes and adds them to the// node. Finally the dependencies are arranged so that when the// inputs change Maya knowns to call compute to recalculate the output// value.//MStatus stringFormat::initialize(){	MFnNumericAttribute numAttr;	MFnTypedAttribute	typedAttr;	MFnStringData		stringData;	MStatus				stat;	MStatus				stat2;	// Setup the input attributes	//	attrFormat = typedAttr.create("format", "f", MFnData::kString, 								  stringData.create(&stat2), &stat);	CHECK_MSTATUS( stat2 );	CHECK_MSTATUS( stat ); 	CHECK_MSTATUS( typedAttr.setStorable( true ) ); 	CHECK_MSTATUS( typedAttr.setKeyable( true ) );	attrValues = numAttr.create("values", "v", MFnNumericData::kDouble, 								0, &stat);	CHECK_MSTATUS( stat ); 	CHECK_MSTATUS( numAttr.setArray( true ) );	CHECK_MSTATUS( numAttr.setReadable( false ) ); 	CHECK_MSTATUS( numAttr.setIndexMatters( true ) ); 	CHECK_MSTATUS( numAttr.setStorable( true ) ); 	CHECK_MSTATUS( numAttr.setKeyable( true ) );	attrOutput = typedAttr.create( "output", "o", MFnData::kString,								   stringData.create(&stat2), &stat);	CHECK_MSTATUS( stat2 );	CHECK_MSTATUS( stat );	CHECK_MSTATUS( typedAttr.setWritable( false ) );	CHECK_MSTATUS( typedAttr.setStorable( false ) );	// Add the attributes to the node	//	CHECK_MSTATUS( addAttribute( attrFormat ) );	CHECK_MSTATUS( addAttribute( attrValues ) );	CHECK_MSTATUS( addAttribute( attrOutput ) );	// Set the attribute dependencies	//	CHECK_MSTATUS( attributeAffects( attrFormat, attrOutput ) );	CHECK_MSTATUS( attributeAffects( attrValues, attrOutput ) );	return MS::kSuccess;} 
开发者ID:DimondTheCat,项目名称:xray,代码行数:52,


示例3: meshFn

void LuxRenderer::defineTriangleMesh(mtlu_MayaObject *obj, bool noObjectDef = false){	MObject meshObject = obj->mobject;	MStatus stat = MStatus::kSuccess;	MFnMesh meshFn(meshObject, &stat);		CHECK_MSTATUS(stat);	MItMeshPolygon faceIt(meshObject, &stat);	CHECK_MSTATUS(stat);	MPointArray points;	meshFn.getPoints(points);    MFloatVectorArray normals;    meshFn.getNormals( normals, MSpace::kWorld );	MFloatArray uArray, vArray;	meshFn.getUVs(uArray, vArray);	logger.debug(MString("Translating mesh object ") + meshFn.name().asChar());	MString meshFullName = obj->fullNiceName;	MIntArray trianglesPerFace, triVertices;	meshFn.getTriangles(trianglesPerFace, triVertices);	int numTriangles = 0;	for( size_t i = 0; i < trianglesPerFace.length(); i++)		numTriangles += trianglesPerFace[i];	// lux render does not have a per vertex per face normal definition, here we can use one normal and uv per vertex only	// So I create the triangles with unique vertices, normals and uvs. Of course this way vertices etc. cannot be shared.	int numPTFloats = numTriangles * 3 * 3;	logger.debug(MString("Num Triangles: ") + numTriangles + " num tri floats " + numPTFloats);	float *floatPointArray = new float[numPTFloats];	float *floatNormalArray = new float[numPTFloats];	float *floatUvArray = new float[numTriangles * 3 * 2];		logger.debug(MString("Allocated ") + numPTFloats + " floats for point and normals");	MIntArray triangelVtxIdListA;	MFloatArray floatPointArrayA;	MPointArray triPoints;	MIntArray triVtxIds;	MIntArray faceVtxIds;	MIntArray faceNormalIds;		int *triangelVtxIdList = new int[numTriangles * 3];	for( uint sgId = 0; sgId < obj->shadingGroups.length(); sgId++)	{		MString slotName = MString("slot_") + sgId;	}		int triCount = 0;	int vtxCount = 0;	for(faceIt.reset(); !faceIt.isDone(); faceIt.next())	{		int faceId = faceIt.index();		int numTris;		faceIt.numTriangles(numTris);		faceIt.getVertices(faceVtxIds);		MIntArray faceUVIndices;		faceNormalIds.clear();		for( uint vtxId = 0; vtxId < faceVtxIds.length(); vtxId++)		{			faceNormalIds.append(faceIt.normalIndex(vtxId));			int uvIndex;			faceIt.getUVIndex(vtxId, uvIndex);			faceUVIndices.append(uvIndex);		}		int perFaceShadingGroup = 0;		if( obj->perFaceAssignments.length() > 0)			perFaceShadingGroup = obj->perFaceAssignments[faceId];		//logger.info(MString("Face ") + faceId + " will receive SG " +  perFaceShadingGroup);		for( int triId = 0; triId < numTris; triId++)		{			int faceRelIds[3];			faceIt.getTriangle(triId, triPoints, triVtxIds);			for( uint triVtxId = 0; triVtxId < 3; triVtxId++)			{				for(uint faceVtxId = 0; faceVtxId < faceVtxIds.length(); faceVtxId++)				{					if( faceVtxIds[faceVtxId] == triVtxIds[triVtxId])					{						faceRelIds[triVtxId] = faceVtxId;					}				}			}						uint vtxId0 = faceVtxIds[faceRelIds[0]];			uint vtxId1 = faceVtxIds[faceRelIds[1]];			uint vtxId2 = faceVtxIds[faceRelIds[2]];			uint normalId0 = faceNormalIds[faceRelIds[0]];//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,


示例4: MAKE_INPUT

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus Cell3D::initialize(){    MFnMatrixAttribute mAttr;    MFnNumericAttribute nAttr; 	// Input attributes    aColorGain = nAttr.createColor("colorGain", "cg");    MAKE_INPUT(nAttr);    CHECK_MSTATUS( nAttr.setDefault(1.0f,1.0f,1.0f) );    aColorOffset = nAttr.createColor("colorOffset", "co");    MAKE_INPUT(nAttr);        aPlaceMat = mAttr.create("placementMatrix", "pm", 							 MFnMatrixAttribute::kFloat);    MAKE_INPUT(mAttr);	// Implicit shading network attributes    aPointWorld = nAttr.createPoint("pointWorld", "pw");	MAKE_INPUT(nAttr);    CHECK_MSTATUS( nAttr.setHidden(true) );	// Create output attributes    aOutF0 = nAttr.create( "F0", "f0", MFnNumericData::kFloat);    MAKE_OUTPUT(nAttr);    aOutF1 = nAttr.create( "F1", "f1", MFnNumericData::kFloat);    MAKE_OUTPUT(nAttr);    aOutN0 = nAttr.create( "N0", "n0", MFnNumericData::kFloat);    MAKE_OUTPUT(nAttr);    aOutBorderDist = nAttr.create("borderDistance", "bd", 								  MFnNumericData::kFloat);    MAKE_OUTPUT(nAttr);        aOutColor = nAttr.createColor("outColor", "oc");	MAKE_OUTPUT(nAttr);    aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat);	MAKE_OUTPUT(nAttr);	// Add attributes to the node database.    CHECK_MSTATUS( addAttribute(aColorGain) );    CHECK_MSTATUS( addAttribute(aColorOffset) );    CHECK_MSTATUS( addAttribute(aPointWorld) );    CHECK_MSTATUS( addAttribute(aPlaceMat) );    CHECK_MSTATUS( addAttribute(aOutAlpha) );    CHECK_MSTATUS( addAttribute(aOutColor) );    CHECK_MSTATUS( addAttribute(aOutF0) );    CHECK_MSTATUS( addAttribute(aOutF1) );    CHECK_MSTATUS( addAttribute(aOutN0) );    CHECK_MSTATUS( addAttribute(aOutBorderDist) );    // All input affect the output color and alpha    CHECK_MSTATUS( attributeAffects (aColorGain, aOutColor) );    CHECK_MSTATUS( attributeAffects (aColorOffset, aOutColor) );    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutColor) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutColor) );    CHECK_MSTATUS( attributeAffects (aColorGain, aOutAlpha) );    CHECK_MSTATUS( attributeAffects (aColorOffset, aOutAlpha) );    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutAlpha) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutAlpha) );    // Geometry attribute affect all other outputs.    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF0) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF0) );    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF1) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF1) );    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutN0) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutN0) );    CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutBorderDist) );    CHECK_MSTATUS( attributeAffects (aPointWorld, aOutBorderDist) );    return MS::kSuccess;}
开发者ID:DimondTheCat,项目名称:xray,代码行数:90,


示例5: CHECK_MSTATUS

////      Deform computation//MStatus jhMeshBlur::deform( MDataBlock& block,MItGeometry& iter,const MMatrix& m,unsigned int multiIndex){    MStatus returnStatus;    // Envelope    float envData = block.inputValue(envelope, &returnStatus).asFloat();	CHECK_MSTATUS(returnStatus);    if(envData == 0)		return MS::kFailure;    /*     VARIABLES     */    //float factor = block.inputValue(aShapeFactor, &returnStatus).asFloat();    float fStrength = block.inputValue(aStrength, &returnStatus).asFloat();	CHECK_MSTATUS(returnStatus);		if (fStrength == 0)		return MS::kFailure;	    float fThreshold = block.inputValue(aTreshhold, &returnStatus).asFloat();	CHECK_MSTATUS(returnStatus);    float fW = 0.0f; // weight    float fDistance;    fStrength *= envData;    double dKracht = block.inputValue(aInterpPower, &returnStatus).asDouble();	CHECK_MSTATUS(returnStatus);    double dDotProduct;  // Dotproduct of the point    bool bTweakblur = block.inputValue(aTweakBlur, &returnStatus).asBool();	CHECK_MSTATUS(returnStatus);	    bool bQuad = block.inputValue(aQuadInterp, &returnStatus).asBool();	CHECK_MSTATUS(returnStatus);		MTime inTime = block.inputValue(aTime).asTime();    int nTijd = (int)inTime.as(MTime::kFilm);    MFloatVectorArray currentNormals;   // normals of mesh    MFnPointArrayData fnPoints;         // help converting to MPointArrays    MFloatVector dirVector;             // direction vector of the point    MFloatVector normal;                // normal of the point    MPointArray savedPoints;            // save all point before edited    MMatrix matInv = m.inverse();       // inversed matrix    MPoint ptA;                         // current point (iter mesh)    MPoint ptB;                         // previous point (iter mesh)    MPoint ptC;                         // mesh before previous point (iter mesh)    // get node, use node to get inputGeom, use inputGeom to get mesh data, use mesh data to get normal data    MFnDependencyNode nodeFn(this->thisMObject());    MPlug inGeomPlug(nodeFn.findPlug(this->inputGeom,true));    MObject inputObject(inGeomPlug.asMObject());    MFnMesh inMesh(inputObject);    inMesh.getVertexNormals(true, currentNormals);    // get the previous mesh data    MPlug oldMeshPlug = nodeFn.findPlug(MString("oldMesh"));    MPlug oldMeshPositionsAPlug = oldMeshPlug.elementByLogicalIndex((multiIndex*4) + 0);    MPlug oldMeshPositionsBPlug = oldMeshPlug.elementByLogicalIndex((multiIndex*4) + 1);    MPlug oldMeshPositionsCPlug = oldMeshPlug.elementByLogicalIndex((multiIndex*4) + 2); // cache for tweak mode    MPlug oldMeshPositionsDPlug = oldMeshPlug.elementByLogicalIndex((multiIndex*4) + 3); // cache for tweak mode    // convert to MPointArrays    MObject objOldMeshA;    MObject objOldMeshB;    MObject objOldMeshC; // cache    MObject objOldMeshD; // cache    oldMeshPositionsAPlug.getValue(objOldMeshA);    oldMeshPositionsBPlug.getValue(objOldMeshB);    oldMeshPositionsCPlug.getValue(objOldMeshC); // cache    oldMeshPositionsDPlug.getValue(objOldMeshD); // cache    fnPoints.setObject(objOldMeshA);    MPointArray oldMeshPositionsA = fnPoints.array();        fnPoints.setObject(objOldMeshB);    MPointArray oldMeshPositionsB = fnPoints.array();        fnPoints.setObject(objOldMeshC);    MPointArray oldMeshPositionsC = fnPoints.array(); // cache        fnPoints.setObject(objOldMeshD);    MPointArray oldMeshPositionsD = fnPoints.array(); // cache            // If mesh position variables are empty,fill them with default values    if(oldMeshPositionsA.length() == 0 || nTijd <= 1){        iter.allPositions(oldMeshPositionsA);        for(int i=0; i < oldMeshPositionsA.length(); i++)//.........这里部分代码省略.........
开发者ID:bungnoid,项目名称:jhMeshBlur,代码行数:101,


示例6: CHECK_MSTATUS

// The initialize routine is called after the node has been created.// It sets up the input and output attributes and adds them to the node.// Finally the dependencies are arranged so that when the inputs// change Maya knowns to call compute to recalculate the output values.//MStatus hwColorPerVertexShader::initialize(){    MFnNumericAttribute nAttr;     MFnTypedAttribute tAttr; 	MStatus status;    // Create input attributes.	// All attributes are cached internal	//    aColorGain = nAttr.createColor( "colorGain", "cg", &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(1.f, 1.f, 1.f));	nAttr.setCached( true );	nAttr.setInternal( true );    aTranspGain = nAttr.create("transparencyGain", "tg",						  MFnNumericData::kFloat, 1.f, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(1.f));    CHECK_MSTATUS( nAttr.setSoftMin(0.f));    CHECK_MSTATUS( nAttr.setSoftMax(2.f));	nAttr.setCached( true );	nAttr.setInternal( true );    aColorBias = nAttr.createColor( "colorBias", "cb", &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(0.f, 0.f, 0.f));	nAttr.setCached( true );	nAttr.setInternal( true );    aTranspBias = nAttr.create( "transparencyBias", "tb",						   MFnNumericData::kFloat, 0.f, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(0.f));    CHECK_MSTATUS( nAttr.setSoftMin(-1.f));    CHECK_MSTATUS( nAttr.setSoftMax(1.f));	nAttr.setCached( true );	nAttr.setInternal( true );	aNormalsPerVertex = nAttr.create("normalsPerVertex", "nv",		MFnNumericData::kInt, 0, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(false));    CHECK_MSTATUS( nAttr.setDefault(0));    CHECK_MSTATUS( nAttr.setSoftMin(0));    CHECK_MSTATUS( nAttr.setSoftMax(3));	nAttr.setCached( true );	nAttr.setInternal( true );	aColorsPerVertex = nAttr.create("colorsPerVertex", "cv",		MFnNumericData::kInt, 0, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(false));    CHECK_MSTATUS( nAttr.setDefault(0));    CHECK_MSTATUS( nAttr.setSoftMin(0));    CHECK_MSTATUS( nAttr.setSoftMax(5));	nAttr.setCached( true );	nAttr.setInternal( true );	aColorSetName = tAttr.create("colorSetName", "cs",		MFnData::kString, MObject::kNullObj, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( tAttr.setStorable(true));    CHECK_MSTATUS( tAttr.setKeyable(false));	tAttr.setCached( true );	tAttr.setInternal( true );    aTexRotateX = nAttr.create( "texRotateX", "tx",						   MFnNumericData::kFloat, 0.f, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(0.f));	nAttr.setCached( true );	nAttr.setInternal( true );	    aTexRotateY = nAttr.create( "texRotateY", "ty",						   MFnNumericData::kFloat, 0.f, &status);    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setStorable(true));    CHECK_MSTATUS( nAttr.setKeyable(true));    CHECK_MSTATUS( nAttr.setDefault(0.f));	nAttr.setCached( true );	nAttr.setInternal( true );//.........这里部分代码省略.........
开发者ID:DimondTheCat,项目名称:xray,代码行数:101,


示例7: CHECK_MSTATUS

MStatus retargetLocator::initialize(){    MFnNumericAttribute nAttr;	MFnMatrixAttribute mAttr;	MFnEnumAttribute eAttr;	MFnUnitAttribute uAttr;	MFnCompoundAttribute cAttr;	MFnTypedAttribute tAttr;		aOutput = nAttr.create( "output", "output", MFnNumericData::kDouble );	nAttr.setStorable( false );	CHECK_MSTATUS( addAttribute( aOutput ) );	aDiscMatrix = mAttr.create( "discMatrix", "discMatrix" );	mAttr.setStorable( true );	CHECK_MSTATUS( addAttribute( aDiscMatrix ) );	CHECK_MSTATUS( attributeAffects( aDiscMatrix, aOutput ) );	aDiscAxis = eAttr.create( "discAxis", "discAxis", 0 );	eAttr.addField( "X", 0 );	eAttr.addField( "Y", 1 );	eAttr.addField( "Z", 2 );	eAttr.setStorable( true );	eAttr.setChannelBox( true );	eAttr.setReadable( true );	CHECK_MSTATUS( addAttribute( aDiscAxis ) );	CHECK_MSTATUS( attributeAffects( aDiscAxis, aOutput ) );	aDiscDivision = nAttr.create( "discDivision", "discDivision", MFnNumericData::kInt, 32 );	nAttr.setMin( 1 );	nAttr.setMax( 32 );	nAttr.setStorable( true );	nAttr.setChannelBox( true );	CHECK_MSTATUS( addAttribute( aDiscDivision ) );	CHECK_MSTATUS( attributeAffects( aDiscDivision, aOutput ) );	aDiscAngle = uAttr.create( "discAngle", "discAngle", MFnUnitAttribute::kAngle, 0.0 );	uAttr.setStorable( true );	uAttr.setChannelBox( true );	CHECK_MSTATUS( addAttribute( aDiscAngle ) );	CHECK_MSTATUS( attributeAffects( aDiscAngle, aOutput ) );	aDiscOffsetX = nAttr.create( "discOffsetX", "discOffsetX", MFnNumericData::kDouble, 0.0 );	aDiscOffsetY = nAttr.create( "discOffsetY", "discOffsetY", MFnNumericData::kDouble, 0.0 );	aDiscOffsetZ = nAttr.create( "discOffsetZ", "discOffsetZ", MFnNumericData::kDouble, 0.0 );	aDiscOffset  = nAttr.create( "discOffset", "discOffset", aDiscOffsetX, aDiscOffsetY, aDiscOffsetZ );	uAttr.setStorable( true );	uAttr.setChannelBox( true );	CHECK_MSTATUS( addAttribute( aDiscOffset ) );	CHECK_MSTATUS( attributeAffects( aDiscOffset, aOutput ) );	aDiscSizeX = nAttr.create( "discSizeX", "discSizeX", MFnNumericData::kDouble, 1.0 );	aDiscSizeY = nAttr.create( "discSizeY", "discSizeY", MFnNumericData::kDouble, 1.0 );	aDiscSizeZ = nAttr.create( "discSizeZ", "discSizeZ", MFnNumericData::kDouble, 1.0 );	aDiscSize  = nAttr.create( "discSize", "discSize", aDiscSizeX, aDiscSizeY, aDiscSizeZ );	uAttr.setStorable( true );	uAttr.setChannelBox( true );	CHECK_MSTATUS( addAttribute( aDiscSize ) );	CHECK_MSTATUS( attributeAffects( aDiscSize, aOutput ) );	aDiscActiveColor = nAttr.createColor( "discActiveColor", "discActiveColor" );	nAttr.setStorable( true );	nAttr.setUsedAsColor(true);	nAttr.setDefault(1.0f, 1.0f, 1.0f);	CHECK_MSTATUS( addAttribute( aDiscActiveColor ) );	CHECK_MSTATUS( attributeAffects( aDiscActiveColor, aOutput ) );	aDiscLeadColor = nAttr.createColor( "discLeadColor", "discLeadColor" );	nAttr.setStorable( true );	nAttr.setUsedAsColor(true);	nAttr.setDefault(.263f, 1.0f, .639f);	CHECK_MSTATUS( addAttribute( aDiscLeadColor ) );	CHECK_MSTATUS( attributeAffects( aDiscLeadColor, aOutput ) );	aDiscDefaultColor = nAttr.createColor( "discDefaultColor", "discDefaultColor" );	nAttr.setStorable( true );	nAttr.setUsedAsColor(true);	nAttr.setDefault(.0f, .016f, .376f);	CHECK_MSTATUS( addAttribute( aDiscDefaultColor ) );	CHECK_MSTATUS( attributeAffects( aDiscDefaultColor, aOutput ) );	aDiscFillAlpha = nAttr.create( "discFillAlpha", "discFillAlpha", MFnNumericData::kFloat, 0.1f );	nAttr.setStorable( true );	nAttr.setMin( 0.0f );	nAttr.setMax( 1.0f );	CHECK_MSTATUS( addAttribute( aDiscFillAlpha ) );	CHECK_MSTATUS( attributeAffects( aDiscFillAlpha, aOutput ) );	aDiscLineAlpha = nAttr.create( "discLineAlpha", "discLineAlpha", MFnNumericData::kFloat, 1.0f );	nAttr.setStorable( true );	nAttr.setMin( 0.0f );	nAttr.setMax( 1.0f );	CHECK_MSTATUS( addAttribute( aDiscLineAlpha ) );	CHECK_MSTATUS( attributeAffects( aDiscLineAlpha, aOutput ) );//.........这里部分代码省略.........
开发者ID:jonntd,项目名称:mayadev-1,代码行数:101,


示例8: tmpMesh

void MayaObject::getMeshData(MPointArray& points, MFloatVectorArray& normals, MFloatArray& uArray, MFloatArray& vArray, MIntArray& triPointIndices, MIntArray& triNormalIndices, MIntArray& triUvIndices, MIntArray& triMatIndices){	MStatus stat;	MObject meshObject = this->mobject;	MMeshSmoothOptions options;	MFnMesh tmpMesh(this->mobject, &stat);	MFnMeshData meshData;	MObject dataObject;	MObject smoothedObj;	// create smooth mesh if needed	if (tmpMesh.findPlug("displaySmoothMesh").asBool())	{		stat = tmpMesh.getSmoothMeshDisplayOptions(options);		if (stat)		{			if (!tmpMesh.findPlug("useSmoothPreviewForRender", false, &stat).asBool())			{				//Logging::debug(MString("useSmoothPreviewForRender turned off"));				int smoothLevel = tmpMesh.findPlug("renderSmoothLevel", false, &stat).asInt();				options.setDivisions(smoothLevel);			}			if (options.divisions() > 0)			{				dataObject = meshData.create();				smoothedObj = tmpMesh.generateSmoothMesh(dataObject, &options, &stat);				if (stat)				{					meshObject = smoothedObj;				}			}		}	}	MFnMesh meshFn(meshObject, &stat);	CHECK_MSTATUS(stat);	MItMeshPolygon faceIt(meshObject, &stat);	CHECK_MSTATUS(stat);	meshFn.getPoints(points);	meshFn.getNormals(normals, MSpace::kObject);	meshFn.getUVs(uArray, vArray);	uint numVertices = points.length();	uint numNormals = normals.length();	uint numUvs = uArray.length();	//Logging::debug(MString("numVertices ") + numVertices);	//Logging::debug(MString("numNormals ") + numNormals);	//Logging::debug(MString("numUvs ") + numUvs);	// some meshes may have no uv's	// to avoid problems I add a default uv coordinate	if (numUvs == 0)	{		Logging::warning(MString("Object has no uv's: ") + this->shortName);		uArray.append(0.0);		vArray.append(0.0);	}	for (uint nid = 0; nid < numNormals; nid++)	{		if (normals[nid].length() < 0.1f)			Logging::warning(MString("Malformed normal in ") + this->shortName);	}	MPointArray triPoints;	MIntArray triVtxIds;	MIntArray faceVtxIds;	MIntArray faceNormalIds;	for (faceIt.reset(); !faceIt.isDone(); faceIt.next())	{		int faceId = faceIt.index();		int numTris;		faceIt.numTriangles(numTris);		faceIt.getVertices(faceVtxIds);		int perFaceShadingGroup = 0;		if (this->perFaceAssignments.length() > 0)			perFaceShadingGroup = this->perFaceAssignments[faceId];				MIntArray faceUVIndices;				faceNormalIds.clear();		for (uint vtxId = 0; vtxId < faceVtxIds.length(); vtxId++)		{			faceNormalIds.append(faceIt.normalIndex(vtxId));			int uvIndex;			if (numUvs == 0)			{				faceUVIndices.append(0);			}			else{				faceIt.getUVIndex(vtxId, uvIndex);				//if (uvIndex > uArray.length())				//	Logging::info(MString("-----------------> UV Problem!!! uvIndex ") + uvIndex + " > uvArray in object " + this->shortName);				faceUVIndices.append(uvIndex);			}		}//.........这里部分代码省略.........
开发者ID:haggi,项目名称:OpenMaya,代码行数:101,


示例9: MAKE_INPUT

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus PhongNode::initialize(){    MFnNumericAttribute nAttr;    MFnLightDataAttribute lAttr;    aTranslucenceCoeff = nAttr.create("translucenceCoeff", "tc",									  MFnNumericData::kFloat);    MAKE_INPUT(nAttr);    aDiffuseReflectivity = nAttr.create("diffuseReflectivity", "drfl",										MFnNumericData::kFloat);    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setDefault(0.8f) );    aColor = nAttr.createColor( "color", "c" );    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.58824f, 0.644f) );    aIncandescence = nAttr.createColor( "incandescence", "ic" );    MAKE_INPUT(nAttr);    aOutColor = nAttr.createColor( "outColor", "oc" );    MAKE_OUTPUT(nAttr);    aPointCamera = nAttr.createPoint( "pointCamera", "pc" );    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    aPower = nAttr.create( "power", "pow", MFnNumericData::kFloat);    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setMin(0.0f) );    CHECK_MSTATUS ( nAttr.setMax(200.0f) );    CHECK_MSTATUS ( nAttr.setDefault(10.0f) );    aSpecularity = nAttr.create( "specularity", "spc", MFnNumericData::kFloat);    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setMin(0.0f) );    CHECK_MSTATUS ( nAttr.setMax(1.0f) ) ;    CHECK_MSTATUS ( nAttr.setDefault(0.5f) );    aReflectGain = nAttr.create( "reflectionGain", "rg", MFnNumericData::kFloat);    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setMin(0.0f) );    CHECK_MSTATUS ( nAttr.setMax(1.0f) );    CHECK_MSTATUS ( nAttr.setDefault(0.5f) );    aNormalCamera = nAttr.createPoint( "normalCamera", "n" );    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    aTriangleNormalCamera = nAttr.createPoint( "triangleNormalCamera", "tn" );    MAKE_INPUT(nAttr);    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f));    CHECK_MSTATUS ( nAttr.setHidden(true));    aLightDirection = nAttr.createPoint( "lightDirection", "ld" );    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) );    aLightIntensity = nAttr.createColor( "lightIntensity", "li" );    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) );    aLightAmbient = nAttr.create( "lightAmbient", "la",								  MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    aLightDiffuse = nAttr.create( "lightDiffuse", "ldf",								  MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    aLightSpecular = nAttr.create( "lightSpecular", "ls",								   MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    aLightShadowFraction = nAttr.create("lightShadowFraction", "lsf",										MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );//.........这里部分代码省略.........
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:101,


示例10: MAKE_INPUT

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus CheckerNode::initialize(){    MFnNumericAttribute nAttr;    // Input attributes	aColor1 = nAttr.createColor("color1", "c1");	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setDefault(0., .58824, .644) );		// Light blue	aColor2 = nAttr.createColor("color2", "c2");	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setDefault(1., 1., 1.) );			// White    aBias = nAttr.create( "bias", "b", MFnNumericData::k2Float);	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setMin(0.0f, 0.0f) );    CHECK_MSTATUS(nAttr.setMax(1.0f, 1.0f) );    CHECK_MSTATUS(nAttr.setDefault(0.5f, 0.5f) );	// Implicit shading network attributes    MObject child1 = nAttr.create( "uCoord", "u", MFnNumericData::kFloat);    MObject child2 = nAttr.create( "vCoord", "v", MFnNumericData::kFloat);    aUVCoord = nAttr.create( "uvCoord","uv", child1, child2);    MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setHidden(true) );	// Output attributes    aOutColor = nAttr.createColor("outColor", "oc");	MAKE_OUTPUT(nAttr);    aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat);	MAKE_OUTPUT(nAttr);	// Add attributes to the node database.    CHECK_MSTATUS(addAttribute(aColor1));    CHECK_MSTATUS(addAttribute(aColor2));    CHECK_MSTATUS(addAttribute(aBias));    CHECK_MSTATUS(addAttribute(aUVCoord));    CHECK_MSTATUS(addAttribute(aOutColor));    CHECK_MSTATUS(addAttribute(aOutAlpha));    // All input affect the output color and alpha    CHECK_MSTATUS(attributeAffects (aColor1,  aOutColor));    CHECK_MSTATUS(attributeAffects(aColor1, aOutAlpha));    CHECK_MSTATUS(attributeAffects (aColor2,  aOutColor));    CHECK_MSTATUS(attributeAffects(aColor2, aOutAlpha));    CHECK_MSTATUS(attributeAffects(aBias, aOutColor));    CHECK_MSTATUS(attributeAffects(aBias, aOutAlpha));    CHECK_MSTATUS(attributeAffects (aUVCoord, aOutColor));    CHECK_MSTATUS(attributeAffects(aUVCoord, aOutAlpha));    return MS::kSuccess;}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:64,


示例11: initializePlugin

MStatus initializePlugin(    MObject obj) {    MStatus status;    MFnPlugin plugin(obj, "Pixar", "1.0", "Any");    // we use lambdas to pass in MCreatorFunctions into the various Maya registration    // functions so that we can specify the static data that the registered    // shape/data/node should be using.    status = plugin.registerData(            _data.stageData.typeName,            _data.stageData.typeId,            []() {                 return UsdMayaStageData::creator(_data.stageData);            });    CHECK_MSTATUS(status);    status = plugin.registerShape(            _data.proxyShape.typeName,            _data.proxyShape.typeId,            []() {                return UsdMayaProxyShape::creator(_data.proxyShape);              },            []() {                return UsdMayaProxyShape::initialize(                    &(_data.proxyShape));            },            UsdMayaProxyShapeUI::creator,            &UsdMayaProxyDrawOverride::sm_drawDbClassification);    CHECK_MSTATUS(status);    status = plugin.registerNode(            _data.referenceAssembly.typeName,            _data.referenceAssembly.typeId,            []() {                return UsdMayaReferenceAssembly::creator(                    _data.referenceAssembly);            },            []() {                return UsdMayaReferenceAssembly::initialize(                    &(_data.referenceAssembly));            },        MPxNode::kAssembly,        &UsdMayaReferenceAssembly::_classification);    CHECK_MSTATUS(status);    status =	MHWRender::MDrawRegistry::registerDrawOverrideCreator(	    UsdMayaProxyDrawOverride::sm_drawDbClassification,            UsdMayaProxyDrawOverride::sm_drawRegistrantId,            UsdMayaProxyDrawOverride::Creator);    CHECK_MSTATUS(status);    status = MGlobal::sourceFile("usdMaya.mel");    CHECK_MSTATUS(status);    // Set the label for the assembly node type so that it appears correctly    // in the 'Create -> Scene Assembly' menu.    const MString assemblyTypeLabel("UsdReferenceAssembly");    MString setLabelCmd;    status = setLabelCmd.format("assembly -e -type ^1s -label ^2s",                                _data.referenceAssembly.typeName,                                assemblyTypeLabel);    CHECK_MSTATUS(status);    status = MGlobal::executeCommand(setLabelCmd);    CHECK_MSTATUS(status);    // Procs stored in usdMaya.mel    // Add assembly callbacks for accessing data without creating an MPxAssembly instance    status = MGlobal::executeCommand("assembly -e -repTypeLabelProc usdMaya_UsdMayaReferenceAssembly_repTypeLabel -type " + _data.referenceAssembly.typeName);    CHECK_MSTATUS(status);    status = MGlobal::executeCommand("assembly -e -listRepTypesProc usdMaya_UsdMayaReferenceAssembly_listRepTypes -type " + _data.referenceAssembly.typeName);    CHECK_MSTATUS(status);    // Attribute Editor Templates    // XXX: The try/except here is temporary until we change the Pixar-internal    // package name to match the external package name.    MString attribEditorCmd(        "try:/n"        "    from pxr.UsdMaya import AEpxrUsdReferenceAssemblyTemplate/n"        "except ImportError:/n"        "    from pixar.UsdMaya import AEpxrUsdReferenceAssemblyTemplate/n"        "AEpxrUsdReferenceAssemblyTemplate.addMelFunctionStubs()");    status = MGlobal::executePythonCommand(attribEditorCmd);    CHECK_MSTATUS(status);    status = plugin.registerCommand("usdExport",             usdExport::creator,            usdExport::createSyntax );    if (!status) {        status.perror("registerCommand usdExport");    }    status = plugin.registerCommand("usdImport",            []() {                 return usdImport::creator(_data.referenceAssembly.typeName.asChar(),                                          _data.proxyShape.typeName.asChar());//.........这里部分代码省略.........
开发者ID:sho7noka,项目名称:USD,代码行数:101,


示例12: driver_meshVertIter

void TestDeformer::_deform_on_one_mesh(MDataBlock& data,                                      MItGeometry& iter,                                      const MMatrix& localToWorldMatrix,                                      unsigned int mIndex,                                      MObject &driver_mesh,                                      const MDataHandle &envelopeHandle, MArrayDataHandle &vertMapArrayData, MPointArray &tempOutputPts){    MStatus status;    float env = envelopeHandle.asFloat();    // use driver_meshVertIter to walk through the vertex of the current driver mesh    MItMeshVertex driver_meshVertIter( driver_mesh, &status );    CHECK_MSTATUS( status );    int i = 0;    iter.reset();    while( !iter.isDone(&status) )    {        CHECK_MSTATUS( status );        // get the weight        float weight = weightValue( data, mIndex, iter.index() ); //painted weight        float ww = weight * env;        if ( fabs(ww) > FLT_EPSILON )//if ( ww != 0 )        {            __debug("%s(), vertMapArrayData.elementCount()=%d, iter.index()=%d",                    __FUNCTION__, vertMapArrayData.elementCount(), iter.index());            // get index_mapped to which the currrent vertex vI is mapped            CHECK_MSTATUS(vertMapArrayData.jumpToElement(iter.index()));            int index_mapped = vertMapArrayData.inputValue(&status).asInt();            CHECK_MSTATUS( status );            if( index_mapped >= 0 )            {                __debug("index_mapped=%d", index_mapped);                int prevInt;                CHECK_MSTATUS( driver_meshVertIter.setIndex(index_mapped, prevInt) );                // vertex wrold position on driver mesh                MPoint mappedPt = driver_meshVertIter.position( MSpace::kWorld, &status );                CHECK_MSTATUS( status );                // vertex wrold position on driven mesh                MPoint iterPt = iter.position(MSpace::kObject, &status) * localToWorldMatrix;                CHECK_MSTATUS( status );                // use ww to interpolate between mappedPt and iterPt                MPoint pt = iterPt + ((mappedPt - iterPt) * ww );                pt = pt * localToWorldMatrix.inverse();                /// put the deform points to tempOutputPts                tempOutputPts[i] += pt;            }        }//if        CHECK_MSTATUS(iter.next());        ++i;    }//while}
开发者ID:yaoyansi,项目名称:mymagicbox,代码行数:61,


示例13: CHECK_MSTATUS

MStatus	MayaToIndigoGlobals::initialize(){	MayaRenderGlobalsNode::initialize();	MFnNumericAttribute nAttr;	MFnTypedAttribute tAttr;	MFnGenericAttribute gAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;	MStatus stat = MStatus::kSuccess;//	------------- automatically created attributes start ----------- // 	white_point = eAttr.create("white_point", "white_point", 4, &stat);	stat = eAttr.addField( "User", 0 );	stat = eAttr.addField( "A", 1 );	stat = eAttr.addField( "B", 2 );	stat = eAttr.addField( "C", 3 );	stat = eAttr.addField( "D50", 4 );	stat = eAttr.addField( "D55", 5 );	stat = eAttr.addField( "D65", 6 );	stat = eAttr.addField( "D75", 7 );	stat = eAttr.addField( "E", 8 );	stat = eAttr.addField( "F1", 9 );	stat = eAttr.addField( "F2", 10 );	stat = eAttr.addField( "F3", 11 );	stat = eAttr.addField( "F4", 12 );	stat = eAttr.addField( "F5", 13 );	stat = eAttr.addField( "F6", 14 );	stat = eAttr.addField( "F7", 15 );	stat = eAttr.addField( "F8", 16 );	stat = eAttr.addField( "F9", 17 );	stat = eAttr.addField( "F10", 18 );	stat = eAttr.addField( "F11", 19 );	stat = eAttr.addField( "F12", 20 );	CHECK_MSTATUS(addAttribute( white_point ));	white_pointX = nAttr.create("white_pointX", "white_pointX",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( white_pointX ));	white_pointY = nAttr.create("white_pointY", "white_pointY",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( white_pointY ));	bih_tri_threshold = nAttr.create("bih_tri_threshold", "bih_tri_threshold",  MFnNumericData::kInt, 1100000);	CHECK_MSTATUS(addAttribute( bih_tri_threshold ));	metropolis = nAttr.create("metropolis", "metropolis",  MFnNumericData::kBoolean, true);	CHECK_MSTATUS(addAttribute( metropolis ));	large_mutation_prob = nAttr.create("large_mutation_prob", "large_mutation_prob",  MFnNumericData::kFloat, 0.1);	CHECK_MSTATUS(addAttribute( large_mutation_prob ));	max_change = nAttr.create("max_change", "max_change",  MFnNumericData::kFloat, .01);	CHECK_MSTATUS(addAttribute( max_change ));	max_num_consec_rejections = nAttr.create("max_num_consec_rejections", "max_num_consec_rejections",  MFnNumericData::kInt, 1000);	CHECK_MSTATUS(addAttribute( max_num_consec_rejections ));	logging = nAttr.create("logging", "logging",  MFnNumericData::kBoolean, true);	CHECK_MSTATUS(addAttribute( logging ));	path_tracing = eAttr.create("path_tracing", "path_tracing", 0, &stat);	stat = eAttr.addField( "bidirectional", 0 );	stat = eAttr.addField( "backwards", 1 );	CHECK_MSTATUS(addAttribute( path_tracing ));	tone_mapper = eAttr.create("tone_mapper", "tone_mapper", 1, &stat);	stat = eAttr.addField( "linear", 0 );	stat = eAttr.addField( "reinhard", 1 );	stat = eAttr.addField( "camera", 2 );	CHECK_MSTATUS(addAttribute( tone_mapper ));	tone_linearScale = nAttr.create("tone_linearScale", "tone_linearScale",  MFnNumericData::kFloat, 1.0);	nAttr.setMin(0.0001);	nAttr.setMax(100);	CHECK_MSTATUS(addAttribute( tone_linearScale ));	tone_reinhardPreScale = nAttr.create("tone_reinhardPreScale", "tone_reinhardPreScale",  MFnNumericData::kFloat, 1.0);	CHECK_MSTATUS(addAttribute( tone_reinhardPreScale ));	tone_reinhardPostScale = nAttr.create("tone_reinhardPostScale", "tone_reinhardPostScale",  MFnNumericData::kFloat, 1.0);	CHECK_MSTATUS(addAttribute( tone_reinhardPostScale ));	tone_reinhardBurn = nAttr.create("tone_reinhardBurn", "tone_reinhardBurn",  MFnNumericData::kFloat, 10.0);	CHECK_MSTATUS(addAttribute( tone_reinhardBurn ));	tone_cameraResponse_function_path = tAttr.create("tone_cameraResponse_function_path", "tone_cameraResponse_function_path",  MFnNumericData::kString);	CHECK_MSTATUS(addAttribute( tone_cameraResponse_function_path ));	tone_cameraEv_adjust = nAttr.create("tone_cameraEv_adjust", "tone_cameraEv_adjust",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( tone_cameraEv_adjust ));	tone_cameraFilm_iso = nAttr.create("tone_cameraFilm_iso", "tone_cameraFilm_iso",  MFnNumericData::kFloat, 200.0);	CHECK_MSTATUS(addAttribute( tone_cameraFilm_iso ));	save_untonemapped_exr = nAttr.create("save_untonemapped_exr", "save_untonemapped_exr",  MFnNumericData::kBoolean, false);	CHECK_MSTATUS(addAttribute( save_untonemapped_exr ));	save_tonemapped_exr = nAttr.create("save_tonemapped_exr", "save_tonemapped_exr",  MFnNumericData::kBoolean, true);//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,


示例14: resultColor

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus PhongNode::compute(const MPlug&      plug,      MDataBlock& block ){    if ((plug != aOutColor) && (plug.parent() != aOutColor))		return MS::kUnknownParameter;    MFloatVector resultColor(0.0,0.0,0.0);    // get sample surface shading parameters    MFloatVector& surfaceNormal = block.inputValue( aNormalCamera ).asFloatVector();    MFloatVector& cameraPosition = block.inputValue( aPointCamera ).asFloatVector();	// use for raytracing api enhancement below	MFloatVector point = cameraPosition;	MFloatVector normal = surfaceNormal;    MFloatVector& surfaceColor  = block.inputValue( aColor ).asFloatVector();    MFloatVector& incandescence = block.inputValue( aIncandescence ).asFloatVector();    float diffuseReflectivity = block.inputValue( aDiffuseReflectivity ).asFloat();    // float translucenceCoeff   = block.inputValue( aTranslucenceCoeff ).asFloat();	// User-defined Reflection Color Gain	float reflectGain = block.inputValue( aReflectGain ).asFloat();    // Phong shading attributes    float power = block.inputValue( aPower ).asFloat();    float spec = block.inputValue( aSpecularity ).asFloat();    float specularR, specularG, specularB;    float diffuseR, diffuseG, diffuseB;    diffuseR = diffuseG = diffuseB = specularR = specularG = specularB = 0.0;    // get light list    MArrayDataHandle lightData = block.inputArrayValue( aLightData );    int numLights = lightData.elementCount();    // iterate through light list and get ambient/diffuse values    for( int count=1; count <= numLights; count++ )    {        MDataHandle currentLight = lightData.inputValue();        MFloatVector& lightIntensity = currentLight.child(aLightIntensity).asFloatVector();        // Find the blind data        void*& blindData = currentLight.child( aLightBlindData ).asAddr();        // find ambient component        if( currentLight.child(aLightAmbient).asBool() ) {            diffuseR += lightIntensity[0];            diffuseG += lightIntensity[1];            diffuseB += lightIntensity[2];        }        MFloatVector& lightDirection = currentLight.child(aLightDirection).asFloatVector();        if ( blindData == NULL )        {			// find diffuse and specular component			if( currentLight.child(aLightDiffuse).asBool() )			{			    float cosln = lightDirection * surfaceNormal;;			    if( cosln > 0.0f )  // calculate only if facing light			    {			         diffuseR += lightIntensity[0] * ( cosln * diffuseReflectivity );			         diffuseG += lightIntensity[1] * ( cosln * diffuseReflectivity );			         diffuseB += lightIntensity[2] * ( cosln * diffuseReflectivity );			    }			    CHECK_MSTATUS( cameraPosition.normalize() );				if( cosln > 0.0f ) // calculate only if facing light				{				    float RV = ( ( (2*surfaceNormal) * cosln ) - lightDirection ) * cameraPosition;				    if( RV > 0.0 ) RV = 0.0;				    if( RV < 0.0 ) RV = -RV;				    if ( power < 0 ) power = -power;				    float s = spec * powf( RV, power );				    specularR += lightIntensity[0] * s;				    specularG += lightIntensity[1] * s;				    specularB += lightIntensity[2] * s;				}			}        }        else        {			float cosln = MRenderUtil::diffuseReflectance( blindData, lightDirection, point, surfaceNormal, true );			if( cosln > 0.0f )  // calculate only if facing light			{			     diffuseR += lightIntensity[0] * ( cosln * diffuseReflectivity );			     diffuseG += lightIntensity[1] * ( cosln * diffuseReflectivity );			     diffuseB += lightIntensity[2] * ( cosln * diffuseReflectivity );			}			CHECK_MSTATUS ( cameraPosition.normalize() );//.........这里部分代码省略.........
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:101,


示例15: CHECK_MSTATUS

MStatus progressWindowPlugin::doIt(const MArgList &args){    MStatus stat = MS::kSuccess;    MString title = "Doing Nothing";    MString sleeping = "Sleeping: ";    int amount = 0;    int maxProgress = 10;    // First reserve the progress window.  If a progress window is already    // active (eg. through the mel "progressWindow" command), this command    // fails.    //    if (!MProgressWindow::reserve())    {        MGlobal::displayError("Progress window already in use.");        stat = MS::kFailure;        return stat;    }    //    // Set up and print progress window state    //    CHECK_MSTATUS(MProgressWindow::setProgressRange(amount, maxProgress));    CHECK_MSTATUS(MProgressWindow::setTitle(title));    CHECK_MSTATUS(MProgressWindow::setInterruptable(true));    CHECK_MSTATUS(MProgressWindow::setProgress(amount));    MString progressWindowState = MString("Progress Window Info:") +                                  MString("/nMin: ") + MProgressWindow::progressMin() +                                  MString("/nMax: ") + MProgressWindow::progressMax() +                                  MString("/nTitle: ") + MProgressWindow::title() +                                  MString("/nInterruptible: ") + MProgressWindow::isInterruptable();    MGlobal::displayInfo(progressWindowState);    CHECK_MSTATUS(MProgressWindow::startProgress());    // Count 10 seconds    //    for (int i = amount; i < maxProgress; i++)    {        if (i != 0 && MProgressWindow::isCancelled()) {            MGlobal::displayInfo("Progress interrupted!");            break;        }        MString statusStr = sleeping;        statusStr += i;        CHECK_MSTATUS(MProgressWindow::setProgressStatus(statusStr));        CHECK_MSTATUS(MProgressWindow::advanceProgress(1));        MGlobal::displayInfo(MString("Current progress: ") + MProgressWindow::progress());        MGlobal::executeCommand("pause -sec 1", false, false);    }    // End the progress, unreserving the progress window so it can be used    // elsewhere.    //    CHECK_MSTATUS(MProgressWindow::endProgress());    return stat;}
开发者ID:vasilenkomike,项目名称:xray,代码行数:65,


示例16: CHECK_MSTATUS

// The initialize routine is called after the node has been created.// It sets up the input and output attributes and adds them to the node.// Finally the dependencies are arranged so that when the inputs// change Maya knowns to call compute to recalculate the output values.// The inputs are: input, scale, frames// The outputs are: sineOutput, cosineOutput//MStatus circle::initialize(){	MFnNumericAttribute nAttr;	MStatus				stat;	// Setup the input attributes	//	input = nAttr.create( "input", "in", MFnNumericData::kFloat, 0.0,			&stat );	CHECK_MSTATUS( stat ); 	CHECK_MSTATUS( nAttr.setStorable( true ) );	scale = nAttr.create( "scale", "sc", MFnNumericData::kFloat, 10.0,			&stat );	CHECK_MSTATUS( stat );	CHECK_MSTATUS( nAttr.setStorable( true ) );	frames = nAttr.create( "frames", "fr", MFnNumericData::kFloat, 48.0,			&stat );	CHECK_MSTATUS( stat );	CHECK_MSTATUS( nAttr.setStorable( true ) );	// Setup the output attributes	//	sOutput = nAttr.create( "sineOutput", "so", MFnNumericData::kFloat,			0.0, &stat );	CHECK_MSTATUS( stat );	CHECK_MSTATUS( nAttr.setWritable( false ) );	CHECK_MSTATUS( nAttr.setStorable( false ) );	cOutput = nAttr.create( "cosineOutput", "co", MFnNumericData::kFloat,			0.0, &stat );	CHECK_MSTATUS( stat );	CHECK_MSTATUS( nAttr.setWritable( false ) );	CHECK_MSTATUS( nAttr.setStorable( false ) );	// Add the attributes to the node	//	CHECK_MSTATUS( addAttribute( input ) );	CHECK_MSTATUS( addAttribute( scale ) );	CHECK_MSTATUS( addAttribute( frames ) );	CHECK_MSTATUS( addAttribute( sOutput ) );	CHECK_MSTATUS( addAttribute( cOutput ) );	// Set the attribute dependencies	//	CHECK_MSTATUS( attributeAffects( input, sOutput ) );	CHECK_MSTATUS( attributeAffects( input, cOutput ) );	CHECK_MSTATUS( attributeAffects( scale, sOutput ) );	CHECK_MSTATUS( attributeAffects( scale, cOutput ) );	CHECK_MSTATUS( attributeAffects( frames, sOutput ) );	CHECK_MSTATUS( attributeAffects( frames, cOutput ) );	return MS::kSuccess;} 
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:62,


示例17: MAKE_OUTPUT

//// DESCRIPTION:MStatus brick::initialize(){	MFnNumericAttribute nAttr;	MFnTypedAttribute tAttr;	MFnGenericAttribute gAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;	MStatus status;	outColor = nAttr.createColor("outColor", "outColor");	MAKE_OUTPUT(nAttr);	CHECK_MSTATUS(addAttribute( outColor ));//---------------------------- automatically created attributes start ------------------------------------	MObject scaleX = nAttr.create("scaleX", "scalex", MFnNumericData::kDouble, 0.0);	MObject scaleY = nAttr.create("scaleY", "scaley", MFnNumericData::kDouble, 0.0);	MObject scaleZ = nAttr.create("scaleZ", "scalez", MFnNumericData::kDouble, 0.0);	scale = nAttr.create("scale", "scale", scaleX, scaleY, scaleZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(1,1,1);	CHECK_MSTATUS(addAttribute( scale ));	brickbevel = nAttr.create("brickbevel", "brickbevel",  MFnNumericData::kFloat, 0.0);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickbevel ));	brickbond = eAttr.create("brickbond", "brickbond", 0, &status);	status = eAttr.addField( "stacked", 0 );	status = eAttr.addField( "flemish", 1 );	status = eAttr.addField( "english", 2 );	status = eAttr.addField( "herringbone", 3 );	status = eAttr.addField( "basket", 4 );	status = eAttr.addField( "chain link", 5 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( brickbond ));	mortarsize = nAttr.create("mortarsize", "mortarsize",  MFnNumericData::kFloat, 0.01);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( mortarsize ));	brickwidth = nAttr.create("brickwidth", "brickwidth",  MFnNumericData::kFloat, 0.3);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickwidth ));	bricktex = nAttr.createColor("bricktex", "bricktex");	MAKE_INPUT(nAttr);	nAttr.setDefault(1.0,1.0,1.0);	CHECK_MSTATUS(addAttribute( bricktex ));	brickdepth = nAttr.create("brickdepth", "brickdepth",  MFnNumericData::kFloat, 0.15);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickdepth ));	coordinates = eAttr.create("coordinates", "coordinates", 0, &status);	status = eAttr.addField( "global", 0 );	status = eAttr.addField( "local", 1 );	status = eAttr.addField( "global normal", 2 );	status = eAttr.addField( "localnormal", 3 );	status = eAttr.addField( "uv", 4 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( coordinates ));	brickmodtex = nAttr.create("brickmodtex", "brickmodtex",  MFnNumericData::kFloat, 1.0);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickmodtex ));	MObject rotateX = nAttr.create("rotateX", "rotatex", MFnNumericData::kDouble, 0.0);	MObject rotateY = nAttr.create("rotateY", "rotatey", MFnNumericData::kDouble, 0.0);	MObject rotateZ = nAttr.create("rotateZ", "rotatez", MFnNumericData::kDouble, 0.0);	rotate = nAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( rotate ));	motartex = nAttr.createColor("motartex", "motartex");	MAKE_INPUT(nAttr);	nAttr.setDefault(0.2,0.2,0.2);	CHECK_MSTATUS(addAttribute( motartex ));	brickrun = nAttr.create("brickrun", "brickrun",  MFnNumericData::kFloat, 0.75);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickrun ));	MObject translateX = nAttr.create("translateX", "translatex", MFnNumericData::kDouble, 0.0);	MObject translateY = nAttr.create("translateY", "translatey", MFnNumericData::kDouble, 0.0);	MObject translateZ = nAttr.create("translateZ", "translatez", MFnNumericData::kDouble, 0.0);	translate = nAttr.create("translate", "translate", translateX, translateY, translateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( translate ));	brickheight = nAttr.create("brickheight", "brickheight",  MFnNumericData::kFloat, 0.1);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( brickheight ));	luxOutFloat = nAttr.create("luxOutFloat", "luxOutFloat",  MFnNumericData::kFloat);	MAKE_OUTPUT(nAttr);//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:OpenMaya,代码行数:101,


示例18: CHECK_MSTATUS

MStatus CoatingBSDF::initialize(){	MFnNumericAttribute nAttr;	MFnLightDataAttribute lAttr;	MFnTypedAttribute tAttr;	MFnGenericAttribute gAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;    MStatus status; // Status will be used to hold the MStatus value                    // returned by each api function call. It is important                    // to check the status returned by a call to aid in                    // debugging. Failed API calls can result in subtle                    // errors that can be difficult to track down, you may                    // wish to use the CHECK_MSTATUS macro for any API                    // call where you do not need to provide your own                    // error handling.                    ////---------------------------- automatically created attributes start ------------------------------------	normalMapping = nAttr.create("normalMapping", "normalMapping",  MFnNumericData::kBoolean, false);	CHECK_MSTATUS(addAttribute( normalMapping ));	kappa = nAttr.create("kappa", "kappa",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( kappa ));	bump = nAttr.create("bump", "bump",  MFnNumericData::kFloat, 1.0);	CHECK_MSTATUS(addAttribute( bump ));	anisotropy = nAttr.create("anisotropy", "anisotropy",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( anisotropy ));	reflectanceColor = nAttr.createColor("reflectanceColor", "reflectanceColor");	nAttr.setDefault(0.0,0.0,0.0);	CHECK_MSTATUS(addAttribute( reflectanceColor ));	ior = nAttr.create("ior", "ior",  MFnNumericData::kFloat, 1.5);	CHECK_MSTATUS(addAttribute( ior ));	roughness = nAttr.create("roughness", "roughness",  MFnNumericData::kFloat, 0.1);	CHECK_MSTATUS(addAttribute( roughness ));	microRoughnessHeight = nAttr.create("microRoughnessHeight", "microRoughnessHeight",  MFnNumericData::kFloat, 0.25);	CHECK_MSTATUS(addAttribute( microRoughnessHeight ));	coatingAbsorption = nAttr.create("coatingAbsorption", "coatingAbsorption",  MFnNumericData::kBoolean, false);	CHECK_MSTATUS(addAttribute( coatingAbsorption ));	microRoughness = nAttr.create("microRoughness", "microRoughness",  MFnNumericData::kBoolean, false);	CHECK_MSTATUS(addAttribute( microRoughness ));	rotation = nAttr.create("rotation", "rotation",  MFnNumericData::kFloat, 0.0);	CHECK_MSTATUS(addAttribute( rotation ));	thickness = nAttr.create("thickness", "thickness",  MFnNumericData::kFloat, 100.0);	CHECK_MSTATUS(addAttribute( thickness ));	microRoughnessWidth = nAttr.create("microRoughnessWidth", "microRoughnessWidth",  MFnNumericData::kFloat, 10.0);	CHECK_MSTATUS(addAttribute( microRoughnessWidth ));//---------------------------- automatically created attributes end ------------------------------------    // Input Attributes    //    aTranslucenceCoeff = nAttr.create( "translucenceCoeff", "tc",            MFnNumericData::kFloat, 0, &status );    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setKeyable( true ) );    CHECK_MSTATUS( nAttr.setStorable( true ) );    CHECK_MSTATUS( nAttr.setDefault( 0.0f ) );    aDiffuseReflectivity = nAttr.create( "diffuseReflectivity", "drfl",            MFnNumericData::kFloat, 0, &status );    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setKeyable( true ) );    CHECK_MSTATUS( nAttr.setStorable( true ) );    CHECK_MSTATUS( nAttr.setDefault( 0.8f ) );    aColor = nAttr.createColor( "color", "c", &status );    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setKeyable( true ) );    CHECK_MSTATUS( nAttr.setStorable( true ) );    CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.58824f, 0.644f ) );    aIncandescence = nAttr.createColor( "incandescence", "ic", &status );    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setKeyable( true ) );    CHECK_MSTATUS( nAttr.setStorable( true ) );    CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.0f, 0.0f ) );    aInTransparency = nAttr.createColor( "transparency", "it", &status );    CHECK_MSTATUS( status );    CHECK_MSTATUS( nAttr.setKeyable( true ) );    CHECK_MSTATUS( nAttr.setStorable( true ) );    CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.0f, 0.0f ) );    // Color Output    //    aOutColor = nAttr.createColor( "outColor", "oc", &status );    CHECK_MSTATUS( status );//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,


示例19: CHECK_MSTATUS

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus clearcoat::initialize(){    MFnNumericAttribute nAttr;    MFnCompoundAttribute   cAttr;    aIndex = nAttr.create( "index", "ix", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setDefault(1.8f) );    CHECK_MSTATUS ( nAttr.setSoftMin(1.0f) );    CHECK_MSTATUS ( nAttr.setSoftMax(5.0f) );    aScale = nAttr.create( "scale", "s", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setDefault(1.55f) );    CHECK_MSTATUS ( nAttr.setSoftMin(0.0f) );    CHECK_MSTATUS ( nAttr.setSoftMax(5.0f) );    aBias = nAttr.create( "bias", "b", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setDefault(-0.1f) );    CHECK_MSTATUS ( nAttr.setSoftMin(-1.0f) );    CHECK_MSTATUS ( nAttr.setSoftMax( 1.0f) );    aNormalCameraX = nAttr.create( "normalCameraX", "nx", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );    aNormalCameraY = nAttr.create( "normalCameraY", "ny", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false));    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );    aNormalCameraZ = nAttr.create( "normalCameraZ", "nz", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );    aNormalCamera = nAttr.create( "normalCamera","n",                                  aNormalCameraX, aNormalCameraY, aNormalCameraZ);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f));    CHECK_MSTATUS ( nAttr.setHidden(true) );    aRayDirectionX = nAttr.create( "rayDirectionX", "rx", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );    aRayDirectionY = nAttr.create( "rayDirectionY", "ry", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false));    CHECK_MSTATUS ( nAttr.setDefault(1.0f));    aRayDirectionZ = nAttr.create( "rayDirectionZ", "rz", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );    aRayDirection = nAttr.create( "rayDirection","r",                                  aRayDirectionX, aRayDirectionY, aRayDirectionZ);    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) );    CHECK_MSTATUS ( nAttr.setHidden(true) );// Outputs    aOutValue = nAttr.create( "outValue", "ov", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setHidden(false) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    CHECK_MSTATUS ( addAttribute(aIndex));    CHECK_MSTATUS ( addAttribute(aScale) );    CHECK_MSTATUS ( addAttribute(aBias) );	// compound attribute - only need to add parent    CHECK_MSTATUS ( addAttribute(aNormalCamera) );	// compound attribute - only need to add parent    CHECK_MSTATUS ( addAttribute(aRayDirection) );    CHECK_MSTATUS ( addAttribute(aOutValue) );    CHECK_MSTATUS ( attributeAffects (aIndex, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aScale, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aBias, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aNormalCameraX, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aNormalCameraY, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aNormalCameraZ, aOutValue) );    CHECK_MSTATUS ( attributeAffects (aNormalCamera, aOutValue) );//.........这里部分代码省略.........
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:101,


示例20: resultColor

// Compute takes two parameters: plug and data.// - Plug is the the data value that needs to be recomputed// - Data provides handles to all of the nodes attributes, only these//   handles should be used when performing computations.//MStatus CoatingBSDF::compute( const MPlug& plug, MDataBlock& block ){    // The plug parameter will allow us to determine which output attribute    // needs to be calculated.    //	if( plug == aOutColor || plug == aOutTransparency || plug.parent() == aOutColor || plug.parent() == aOutTransparency  )    {        MStatus status;        MFloatVector resultColor( 0.0, 0.0, 0.0 );        // Get surface shading parameters from input block        //        MFloatVector& surfaceNormal = block.inputValue( aNormalCamera, &status ).asFloatVector();        CHECK_MSTATUS( status );        MFloatVector& surfaceColor = block.inputValue( aColor, &status ).asFloatVector();        CHECK_MSTATUS( status );        MFloatVector& incandescence = block.inputValue( aIncandescence,  &status ).asFloatVector();        CHECK_MSTATUS( status );        float diffuseReflectivity = block.inputValue( aDiffuseReflectivity, &status ).asFloat();        CHECK_MSTATUS( status );//      float translucenceCoeff = block.inputValue( aTranslucenceCoeff,//              &status ).asFloat();//      CHECK_MSTATUS( status );        // Get light list        //        MArrayDataHandle lightData = block.inputArrayValue( aLightData, &status );        CHECK_MSTATUS( status );        int numLights = lightData.elementCount( &status );        CHECK_MSTATUS( status );        // Calculate the effect of the lights in the scene on the color        //        // Iterate through light list and get ambient/diffuse values        //        for( int count=1; count <= numLights; count++ )        {            // Get the current light out of the array            //            MDataHandle currentLight = lightData.inputValue( &status );            CHECK_MSTATUS( status );            // Get the intensity of that light            //            MFloatVector& lightIntensity = currentLight.child( aLightIntensity ).asFloatVector();            // Find ambient component            //            if ( currentLight.child( aLightAmbient ).asBool() )            {                resultColor += lightIntensity;            }            // Find diffuse component            //            if ( currentLight.child( aLightDiffuse ).asBool() )            {                MFloatVector& lightDirection = currentLight.child( aLightDirection ).asFloatVector();                float cosln = lightDirection * surfaceNormal;               if ( cosln > 0.0f ) 			   {                    resultColor += lightIntensity * ( cosln * diffuseReflectivity );               }            }            // Advance to the next light.            //            if ( count < numLights ) {                status = lightData.next();                CHECK_MSTATUS( status );            }        }        // Factor incident light with surface color and add incandescence        //        resultColor[0] = resultColor[0] * surfaceColor[0] + incandescence[0];        resultColor[1] = resultColor[1] * surfaceColor[1] + incandescence[1];        resultColor[2] = resultColor[2] * surfaceColor[2] + incandescence[2];        // Set ouput color attribute//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,


示例21: MAKE_INPUT

//// DESCRIPTION:///////////////////////////////////////////////////////MStatus depthShader::initialize(){    MFnNumericAttribute nAttr;    // Create input attributes	aColorNear = nAttr.createColor("color", "c");	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setDefault(0., 1., 0.));			// Green	aColorFar = nAttr.createColor("colorFar", "cf");	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setDefault(0., 0., 1.));			// Blue    aNear = nAttr.create("near", "n", MFnNumericData::kFloat);	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setMin(0.0f));	CHECK_MSTATUS(nAttr.setSoftMax(1000.0f));    aFar = nAttr.create("far", "f", MFnNumericData::kFloat);	MAKE_INPUT(nAttr);    CHECK_MSTATUS(nAttr.setMin(0.0f));	CHECK_MSTATUS(nAttr.setSoftMax(1000.0f));    CHECK_MSTATUS(nAttr.setDefault(2.0f));    aPointCamera = nAttr.createPoint("pointCamera", "p");	MAKE_INPUT(nAttr);	CHECK_MSTATUS(nAttr.setHidden(true));	// Create output attributes    aOutColor = nAttr.createColor("outColor", "oc");	MAKE_OUTPUT(nAttr);    CHECK_MSTATUS(addAttribute(aColorNear));    CHECK_MSTATUS(addAttribute(aColorFar));    CHECK_MSTATUS(addAttribute(aNear) );    CHECK_MSTATUS(addAttribute(aFar));    CHECK_MSTATUS(addAttribute(aPointCamera));    CHECK_MSTATUS(addAttribute(aOutColor));    CHECK_MSTATUS(attributeAffects(aColorNear, aOutColor));    CHECK_MSTATUS(attributeAffects(aColorFar, aOutColor));    CHECK_MSTATUS(attributeAffects(aNear, aOutColor));    CHECK_MSTATUS(attributeAffects(aFar, aOutColor));    CHECK_MSTATUS(attributeAffects(aPointCamera, aOutColor));    return MS::kSuccess;}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:51,


示例22: MAKE_OUTPUT

//// DESCRIPTION:MStatus marble::initialize(){	MFnNumericAttribute nAttr;	MFnTypedAttribute tAttr;	MFnGenericAttribute gAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;	MStatus status;	outColor = nAttr.createColor("outColor", "outColor");	MAKE_OUTPUT(nAttr);	CHECK_MSTATUS(addAttribute( outColor ));//---------------------------- automatically created attributes start ------------------------------------	scale = nAttr.create("scale", "scale",  MFnNumericData::kFloat, 1);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( scale ));	octaves = nAttr.create("octaves", "octaves",  MFnNumericData::kInt, 8);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( octaves ));	coordinates = eAttr.create("coordinates", "coordinates", 0, &status);	status = eAttr.addField( "global", 0 );	status = eAttr.addField( "local", 1 );	status = eAttr.addField( "global normal", 2 );	status = eAttr.addField( "localnormal", 3 );	status = eAttr.addField( "uv", 4 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( coordinates ));	roughness = nAttr.create("roughness", "roughness",  MFnNumericData::kFloat, 0.5);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( roughness ));	MObject rotateX = nAttr.create("rotateX", "rotatex", MFnNumericData::kDouble, 0.0);	MObject rotateY = nAttr.create("rotateY", "rotatey", MFnNumericData::kDouble, 0.0);	MObject rotateZ = nAttr.create("rotateZ", "rotatez", MFnNumericData::kDouble, 0.0);	rotate = nAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( rotate ));	variation = nAttr.create("variation", "variation",  MFnNumericData::kFloat, 0.2);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( variation ));	MObject translateX = nAttr.create("translateX", "translatex", MFnNumericData::kDouble, 0.0);	MObject translateY = nAttr.create("translateY", "translatey", MFnNumericData::kDouble, 0.0);	MObject translateZ = nAttr.create("translateZ", "translatez", MFnNumericData::kDouble, 0.0);	translate = nAttr.create("translate", "translate", translateX, translateY, translateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( translate ));	luxOutColor = nAttr.createColor("luxOutColor", "luxOutColor");	MAKE_OUTPUT(nAttr);	CHECK_MSTATUS(addAttribute( luxOutColor ));	CHECK_MSTATUS ( attributeAffects( scale, luxOutColor));	CHECK_MSTATUS ( attributeAffects( scale, outColor));//---------------------------- automatically created attributes end ------------------------------------    return MS::kSuccess;}
开发者ID:UIKit0,项目名称:OpenMaya,代码行数:68,


示例23: vertex

btCompoundShape* convex_decomposition_hacd::ConvexDecomp(int numVertices, float* vertices, int numIndices,const unsigned int* indices){	//-----------------------------------------------	// HACD	//-----------------------------------------------	std::vector< HACD::Vec3<HACD::Real> > points;	std::vector< HACD::Vec3<long> > triangles;	for(int i=0; i<numVertices; i++ ) 	{		int index = i*3;		HACD::Vec3<HACD::Real> vertex(vertices[index], vertices[index+1],vertices[index+2]);		points.push_back(vertex);	}	for(int i=0;i<numIndices/3;i++)	{		int index = i*3;		HACD::Vec3<long> triangle(indices[index], indices[index+1], indices[index+2]);		triangles.push_back(triangle);	}	HACD::HACD myHACD;	myHACD.SetPoints(&points[0]);	myHACD.SetNPoints(points.size());	myHACD.SetTriangles(&triangles[0]);	myHACD.SetNTriangles(triangles.size());	myHACD.SetCompacityWeight(0.1);	myHACD.SetVolumeWeight(0.0);	// HACD parameters	// Recommended parameters: 2 100 0 0 0 0	size_t nClusters = 2;	double concavity = 10;	bool invert = false;	bool addExtraDistPoints = true;//false;	bool addNeighboursDistPoints = true;//false;	bool addFacesPoints = false;       	myHACD.SetNClusters(nClusters);                     // minimum number of clusters	myHACD.SetNVerticesPerCH(256);                      // max of 100 vertices per convex-hull	myHACD.SetConcavity(concavity);                     // maximum concavity	myHACD.SetAddExtraDistPoints(addExtraDistPoints);   	myHACD.SetAddNeighboursDistPoints(addNeighboursDistPoints);   	myHACD.SetAddFacesPoints(addFacesPoints); 	myHACD.SetAddExtraDistPoints(true);   	myHACD.SetAddFacesPoints(true); 	        MStatus stat = MS::kSuccess;        MString title = "Esc to stop";        MString sleeping = "Esc to stop";                int amount = 0;        int maxProgress = 1000;                // First reserve the progress window.  If a progress window is already        // active (eg. through the mel "progressWindow" command), this command        // fails.        //        if (!MProgressWindow::reserve())        {                MGlobal::displayError("Progress window already in use.");                stat = MS::kFailure;        }        //        // Set up and print progress window state        //        CHECK_MSTATUS(MProgressWindow::setProgressRange(amount, maxProgress));        CHECK_MSTATUS(MProgressWindow::setTitle(title));        CHECK_MSTATUS(MProgressWindow::setInterruptable(true));        CHECK_MSTATUS(MProgressWindow::setProgress(amount));        MString progressWindowState = MString("Progress Window Info:") +                MString("/nMin: ") + MProgressWindow::progressMin() +                MString("/nMax: ") + MProgressWindow::progressMax() +                 MString("/nTitle: ") + MProgressWindow::title() +                 MString("/nInterruptible: ") + MProgressWindow::isInterruptable();        MGlobal::displayInfo(progressWindowState);                CHECK_MSTATUS(MProgressWindow::startProgress());        		int i=1;		MString statusStr = sleeping;        statusStr += i;		 CHECK_MSTATUS(MProgressWindow::setProgressStatus(statusStr));          CHECK_MSTATUS(MProgressWindow::advanceProgress(1));		   MGlobal::displayInfo(MString("Current progress: ") + MProgressWindow::progress());		    		   MGlobal::executeCommand("pause -sec 1", false,false);		           // Count 10 seconds//.........这里部分代码省略.........
开发者ID:benelot,项目名称:dynamica,代码行数:101,


示例24: MAKE_OUTPUT

//// DESCRIPTION:MStatus blender_marble::initialize(){	MFnNumericAttribute nAttr;	MFnTypedAttribute tAttr;	MFnGenericAttribute gAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;	MStatus status;	outColor = nAttr.createColor("outColor", "outColor");	MAKE_OUTPUT(nAttr);	CHECK_MSTATUS(addAttribute( outColor ));//---------------------------- automatically created attributes start ------------------------------------	noisesize = nAttr.create("noisesize", "noisesize",  MFnNumericData::kFloat, 0.25);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( noisesize ));	noisebasis2 = eAttr.create("noisebasis2", "noisebasis2", 0, &status);	status = eAttr.addField( "blender_original", 0 );	status = eAttr.addField( "original_perlin", 1 );	status = eAttr.addField( "improved_perlin", 2 );	status = eAttr.addField( "voronoi_f1", 3 );	status = eAttr.addField( "voronoi_f2", 4 );	status = eAttr.addField( "voronoi_f3", 5 );	status = eAttr.addField( "voronoi_f4", 6 );	status = eAttr.addField( "voronoi_f2f1", 7 );	status = eAttr.addField( "voronoi_crackle", 8 );	status = eAttr.addField( "cell_noise", 9 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( noisebasis2 ));	noisebasis = eAttr.create("noisebasis", "noisebasis", 0, &status);	status = eAttr.addField( "sin", 0 );	status = eAttr.addField( "saw", 1 );	status = eAttr.addField( "tri", 2 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( noisebasis ));	MObject scaleX = nAttr.create("scaleX", "scalex", MFnNumericData::kDouble, 0.0);	MObject scaleY = nAttr.create("scaleY", "scaley", MFnNumericData::kDouble, 0.0);	MObject scaleZ = nAttr.create("scaleZ", "scalez", MFnNumericData::kDouble, 0.0);	scale = nAttr.create("scale", "scale", scaleX, scaleY, scaleZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(1,1,1);	CHECK_MSTATUS(addAttribute( scale ));	noisedepth = nAttr.create("noisedepth", "noisedepth",  MFnNumericData::kInt, 2);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( noisedepth ));	turbulance = nAttr.create("turbulance", "turbulance",  MFnNumericData::kFloat, 5.0);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( turbulance ));	coordinates = eAttr.create("coordinates", "coordinates", 0, &status);	status = eAttr.addField( "global", 0 );	status = eAttr.addField( "local", 1 );	status = eAttr.addField( "global normal", 2 );	status = eAttr.addField( "localnormal", 3 );	status = eAttr.addField( "uv", 4 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( coordinates ));	bright = nAttr.create("bright", "bright",  MFnNumericData::kFloat, 1.0);	MAKE_INPUT(nAttr);	CHECK_MSTATUS(addAttribute( bright ));	MObject rotateX = nAttr.create("rotateX", "rotatex", MFnNumericData::kDouble, 0.0);	MObject rotateY = nAttr.create("rotateY", "rotatey", MFnNumericData::kDouble, 0.0);	MObject rotateZ = nAttr.create("rotateZ", "rotatez", MFnNumericData::kDouble, 0.0);	rotate = nAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( rotate ));	noisetype = eAttr.create("noisetype", "noisetype", 1, &status);	status = eAttr.addField( "soft_noise", 0 );	status = eAttr.addField( "hard_noise", 1 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( noisetype ));	MObject translateX = nAttr.create("translateX", "translatex", MFnNumericData::kDouble, 0.0);	MObject translateY = nAttr.create("translateY", "translatey", MFnNumericData::kDouble, 0.0);	MObject translateZ = nAttr.create("translateZ", "translatez", MFnNumericData::kDouble, 0.0);	translate = nAttr.create("translate", "translate", translateX, translateY, translateZ);	MAKE_INPUT(nAttr);	nAttr.setDefault(0,0,0);	CHECK_MSTATUS(addAttribute( translate ));	type = eAttr.create("type", "type", 0, &status);	status = eAttr.addField( "soft", 0 );	status = eAttr.addField( "sharp", 1 );	status = eAttr.addField( "sharper", 2 );	MAKE_INPUT(eAttr);	CHECK_MSTATUS(addAttribute( type ));//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:OpenMaya,代码行数:101,


示例25: CHECK_MSTATUS

MStatus mtmEnvLight::initialize(){    MFnTypedAttribute tAttr;     MFnNumericAttribute nAttr;     MFnLightDataAttribute lAttr;	MFnEnumAttribute eAttr;	MFnMessageAttribute mAttr;	MStatus stat;    //aColor = nAttr.createColor( "color", "c" );    //CHECK_MSTATUS ( nAttr.setKeyable(true) );    //CHECK_MSTATUS ( nAttr.setStorable(true) );    //CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.58824f, 0.644f) );    aLightColor = nAttr.createColor( "lightColor", "lightColor" );    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    nAttr.setDefault(0.7f, 0.58824f, 0.344f);	aShadowColor = nAttr.createColor( "shadowColor", "sc" );    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.0f, 0.0f) );    aPosition = nAttr.createPoint( "position", "pos" );    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    aInputDirection = nAttr.createPoint( "inputDirection", "id" );    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );    aInputAmbient = nAttr.create( "ambientOn", "an", MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setHidden(false) );    CHECK_MSTATUS ( nAttr.setDefault(true) );    aInputDiffuse = nAttr.create( "emitDiffuse", "dn", MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setHidden(false) );    CHECK_MSTATUS ( nAttr.setDefault(true) );    aInputSpecular = nAttr.create( "emitSpecular", "sn", MFnNumericData::kBoolean);    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setHidden(false) );    CHECK_MSTATUS ( nAttr.setDefault(true) );    aIntensity = nAttr.create( "intensity", "i", MFnNumericData::kFloat);    CHECK_MSTATUS ( nAttr.setKeyable(true) );    CHECK_MSTATUS ( nAttr.setStorable(true) );    CHECK_MSTATUS ( nAttr.setHidden(false) );    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );	samplingquality = nAttr.create( "samplingquality", "samplingquality", MFnNumericData::kFloat, 1.0);	envmap = tAttr.create( "envmap", "envmap", MFnNumericData::kString);	tAttr.setUsedAsFilename(true);	areamap = tAttr.create( "areamap", "areamap", MFnNumericData::kString);	tAttr.setUsedAsFilename(true);	areafullsphere = nAttr.create( "areafullsphere", "areafullsphere", MFnNumericData::kBoolean, true);	envintensity = nAttr.createColor( "envintensity", "envintensity" );	nAttr.setDefault(1.0f, 1.0f, 1.0f);	raybackground = nAttr.create( "raybackground", "raybackground", MFnNumericData::kBoolean, false);	castshadow = nAttr.create( "castshadow", "castshadow", MFnNumericData::kBoolean, true);	envtype = eAttr.create( "envtype", "envtype", 0, &stat);	stat = eAttr.addField( "Direct Lighting", 0 );	stat = eAttr.addField( "Ambient Occlusion", 1 );	stat = eAttr.addField( "Full Irradiance", 2 );	stat = eAttr.addField( "Raytrace Background", 3 );	eAttr.setDefault(0);			doraysamples = nAttr.create( "doraysamples", "doraysamples", MFnNumericData::kBoolean, false);	doadaptive = nAttr.create( "doadaptive", "doadaptive", MFnNumericData::kBoolean, false);	domaxdist = nAttr.create( "domaxdist", "domaxdist", MFnNumericData::kBoolean, false);	maxdist = nAttr.create( "maxdist", "maxdist", MFnNumericData::kFloat, 10.0);	coneangle = nAttr.create( "coneangle", "coneangle", MFnNumericData::kFloat, 45.0);	envtint = nAttr.createColor( "envtint", "envtint" );	nAttr.setDefault(1.0f, 1.0f, 1.0f);	shadowI = nAttr.create( "shadowI", "shadowI", MFnNumericData::kFloat, 1.0);	samples = nAttr.create( "samples", "samples", MFnNumericData::kInt, 32);	MFnStringData fnStringData;	MObject defaultObjectMask;	defaultObjectMask = fnStringData.create( "*" );	objectmask = tAttr.create( "objectmask", "objectmask", MFnNumericData::kString, defaultObjectMask);	usePortalGeometry = nAttr.create( "usePortalGeometry", "usePortalGeometry", MFnNumericData::kBoolean, false);	portalGeometry = mAttr.create( "portalGeometry", "portalGeometry");	mAttr.setConnectable(true);	mAttr.accepts(MFnData::kAny);	// Outputs    aLightDirection = nAttr.createPoint( "lightDirection", "ld" );    CHECK_MSTATUS ( nAttr.setStorable(false) );    CHECK_MSTATUS ( nAttr.setHidden(true) );    CHECK_MSTATUS ( nAttr.setReadable(true) );    CHECK_MSTATUS ( nAttr.setWritable(false) );    CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,


示例26: CHECK_MSTATUS

MStatus lambert::initialize(){	MFnNumericAttribute nAttr; 	MFnLightDataAttribute lAttr;	MStatus status; // Status will be used to hold the MStatus value					// returned by each api function call. It is important					// to check the status returned by a call to aid in					// debugging. Failed API calls can result in subtle 					// errors that can be difficult to track down, you may					// wish to use the CHECK_MSTATUS macro for any API					// call where you do not need to provide your own					// error handling.					//	// Attribute Initialization:	//	// create      - The create function creates a new attribute for the	//				 node, it takes a long name for the attribute, a short	//				 name for the attribute, the type of the attribute,	//				 and a status object to determine if the api call was	//				 successful.	//	// setKeyable  - Sets whether this attribute should accept keyframe	//				 data, Attributes are not keyable by default.	//	// setStorable - Sets whether this attribute should be storable. If an	//				 attribute is storable, then it will be writen out	//				 when the node is stored to a file. Attributes are 	//               storable by default.	//	// setDefault  - Sets the default value for this attribute.	//	// setUsedAsColor - Sets whether this attribute should be presented as	//				 a color in the UI.	//	// setHidden   - Sets whether this attribute should be hidden from the	//				 UI. This is useful if the attribute is being used for	//				 blind data, or if it is being used as scratch space	//				 for a geometry calculation (should also be marked	//				 non-connectable in that case). Attributes are not	//				 hidden by default.	//	// setReadable - Sets whether this attribute should be readable. If an	//				 attribute is readable, then it can be used as the	//				 source in a dependency graph connection. Attributes	//				 are readable by default.	//	// setWritable - Sets whether this attribute should be readable. If an	//				 attribute is writable, then it can be used as the	//				 destination in a dependency graph connection. If an	//			     attribute is not writable then setAttr commands will	//				 fail to change the attribute. If both keyable and	//				 writable for an attribute are set to true it will be	//				 displayed in the channel box when the node is	//				 selected. Attributes are writable by default.	//	// setArray    - Sets whether this attribute should have an array of	//				 data. This should be set to true if the attribute	//				 needs to accept multiple incoming connections.	//				 Attributes are single elements by default.	//	// Input Attributes	//	aTranslucenceCoeff = nAttr.create( "translucenceCoeff", "tc",			MFnNumericData::kFloat, 0, &status );	CHECK_MSTATUS( status );		CHECK_MSTATUS( nAttr.setKeyable( true ) );	CHECK_MSTATUS( nAttr.setStorable( true ) );	CHECK_MSTATUS( nAttr.setDefault( 0.0f ) );	aDiffuseReflectivity = nAttr.create( "diffuseReflectivity", "drfl",			MFnNumericData::kFloat, 0, &status );	CHECK_MSTATUS( status );	CHECK_MSTATUS( nAttr.setKeyable( true ) );	CHECK_MSTATUS( nAttr.setStorable( true ) );	CHECK_MSTATUS( nAttr.setDefault( 0.8f ) );	aColorR = nAttr.create( "colorR", "cr",MFnNumericData::kFloat, 0,			&status );	CHECK_MSTATUS( status );	CHECK_MSTATUS( nAttr.setKeyable( true ) );	CHECK_MSTATUS( nAttr.setStorable( true ) );	CHECK_MSTATUS( nAttr.setDefault( 0.0f ) );	aColorG = nAttr.create( "colorG", "cg", MFnNumericData::kFloat, 0,			&status );	CHECK_MSTATUS( status );	CHECK_MSTATUS( nAttr.setKeyable( true ) );	CHECK_MSTATUS( nAttr.setStorable( true ) );	CHECK_MSTATUS( nAttr.setDefault( 0.58824f ) );	aColorB = nAttr.create( "colorB", "cb",MFnNumericData::kFloat, 0,			&status );	CHECK_MSTATUS( status );	CHECK_MSTATUS( nAttr.setKeyable( true ) );	CHECK_MSTATUS( nAttr.setStorable( true ) );	CHECK_MSTATUS( nAttr.setDefault( 0.644f ) );//.........这里部分代码省略.........
开发者ID:DimondTheCat,项目名称:xray,代码行数:101,


示例27: addAttribute

// Attributes initialisationMStatus DA_GridGenerator::initialize(){    MStatus stat;    MFnCompoundAttribute cAttr;    MFnNumericAttribute nAttr;    MFnEnumAttribute eAttr;    MFnTypedAttribute tAttr;    //    // Controls    //    aWidth = nAttr.create("width", "w", MFnNumericData::kDouble, 1.0);    nAttr.setMin(0.001);    nAttr.setChannelBox(true);    nAttr.setKeyable(true);    stat = addAttribute(aWidth);    CHECK_MSTATUS(stat);    aHeight = nAttr.create("height", "h", MFnNumericData::kDouble, 1.0);    nAttr.setMin(0.001);    nAttr.setChannelBox(true);    nAttr.setKeyable(true);    stat = addAttribute(aHeight);    CHECK_MSTATUS(stat);    aResolutionX = nAttr.create("resolutionX", "resx", MFnNumericData::kInt, 10);    nAttr.setMin(2);    nAttr.setChannelBox(true);    nAttr.setKeyable(true);    aResolutionY = nAttr.create("resolutionY", "resy", MFnNumericData::kInt, 10);    nAttr.setMin(2);    nAttr.setChannelBox(true);    nAttr.setKeyable(true);    aResolution = cAttr.create("resolution", "res");    stat = cAttr.addChild(aResolutionX);    CHECK_MSTATUS(stat);    stat = cAttr.addChild(aResolutionY);    CHECK_MSTATUS(stat);    stat = addAttribute(aResolution);    CHECK_MSTATUS(stat);    aPattern = eAttr.create("pattern","pat",0);    eAttr.addField(DA_GridGeneratorPatterns::NONE, 0);    eAttr.addField(DA_GridGeneratorPatterns::BRICK_U, 1);    eAttr.addField(DA_GridGeneratorPatterns::BRICK_V, 2);    eAttr.setChannelBox(true);    eAttr.setKeyable(true);    stat = addAttribute(aPattern);    CHECK_MSTATUS(stat);    //    // Outputs    //    aOutDynamicArray = tAttr.create("outDynamicArray", "oda", MFnData::kDynArrayAttrs);    tAttr.setWritable(false); // Just output    stat = addAttribute(aOutDynamicArray);    CHECK_MSTATUS(stat);    //    // Attributes affects    //    attributeAffects(aWidth, aOutDynamicArray);    attributeAffects(aHeight, aOutDynamicArray);    attributeAffects(aResolutionX, aOutDynamicArray);    attributeAffects(aResolutionY, aOutDynamicArray);    attributeAffects(aPattern, aOutDynamicArray);    // Done    return stat;}
开发者ID:Leopardob,项目名称:jhDynArrayTools,代码行数:78,



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


C++ CHECK_NON_NULL函数代码示例
C++ CHECK_MPI_OK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。