Exemplo n.º 1
0
MStatus inverseSkinCluster::initialize()
{
	MStatus   status;

	MFnNumericAttribute nAttr;
	MFnMatrixAttribute mAttr;
	MFnMessageAttribute msgAttr;
	MFnTypedAttribute tAttr;

	aInMesh = tAttr.create( "inMesh", "inMesh", MFnData::kMesh );
	tAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInMesh ) );

	aGeomMatrix = mAttr.create( "geomMatrix", "geomMatrix" );
	tAttr.setCached( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGeomMatrix ) );

	aMatrix = mAttr.create( "matrix", "matrix" );
	mAttr.setArray( true );
	mAttr.setStorable( true );
	mAttr.setUsesArrayDataBuilder( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMatrix ) );

	aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" );
	mAttr.setArray( true );
	mAttr.setStorable( true );
	mAttr.setUsesArrayDataBuilder( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBindPreMatrix ) );

	aUpdateMatrix = nAttr.create( "updateMatrix", "updateMatrix", MFnNumericData::kBoolean, false );
	nAttr.setStorable( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateMatrix ) );

	aTargetSkinCluster = msgAttr.create( "targetSkinCluster", "targetSkinCluster" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aTargetSkinCluster ) );

	aUpdateWeightList = nAttr.create( "updateWeightList", "updateWeightList", MFnNumericData::kBoolean, false );
	nAttr.setStorable( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateWeightList ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInMesh, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGeomMatrix, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBindPreMatrix, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateMatrix, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateWeightList, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aTargetSkinCluster, outputGeom ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );

	return MS::kSuccess;
}
Exemplo n.º 2
0
MStatus sgMeshIntersect::initialize()	
{
	MStatus				status;
	MFnNumericAttribute nAttr;
	MFnTypedAttribute   tAttr;
	MFnMatrixAttribute  mAttr;

	aPointSourceX = nAttr.create( "pointSourceX", "psx", MFnNumericData::kDouble, 0.0 );
	aPointSourceY = nAttr.create( "pointSourceY", "psy", MFnNumericData::kDouble, 0.0 );
	aPointSourceZ = nAttr.create( "pointSourceZ", "psz", MFnNumericData::kDouble, 0.0 );
	aPointSource  = nAttr.create( "pointSource", "ps", aPointSourceX, aPointSourceY, aPointSourceZ );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointSource ) );

	aPointDestX = nAttr.create( "pointDestX", "pdx", MFnNumericData::kDouble, 0.0 );
	aPointDestY = nAttr.create( "pointDestY", "pdy", MFnNumericData::kDouble, 0.0 );
	aPointDestZ = nAttr.create( "pointDestZ", "pdz", MFnNumericData::kDouble, 0.0 );
	aPointDest  = nAttr.create( "pointDest", "pd", aPointDestX, aPointDestY, aPointDestZ );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointDest ) );

	aInputMesh = tAttr.create( "inputMesh", "inMesh", MFnData::kMesh );
	tAttr.setCached( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) );

	aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inMatrix" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) );

	aParentInverseMatrix = mAttr.create( "parentInverseMatrix", "pim" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aParentInverseMatrix ) );

	aOutPointX = nAttr.create( "outPointX", "opx", MFnNumericData::kDouble, 0.0 );
	aOutPointY = nAttr.create( "outPointY", "opy", MFnNumericData::kDouble, 0.0 );
	aOutPointZ = nAttr.create( "outPointZ", "opz", MFnNumericData::kDouble, 0.0 );
	aOutPoint  = nAttr.create( "outPoint", "op", aOutPointX, aOutPointY, aOutPointZ );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutPoint ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointSource, aOutPoint ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointDest, aOutPoint ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutPoint ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutPoint ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aParentInverseMatrix, aOutPoint ) );

	m_nodeNumber = 0;

	return MS::kSuccess;
}
Exemplo n.º 3
0
MStatus  matrixFromPolygon::initialize()
{
	MStatus  status;

	MFnNumericAttribute nAttr;
	MFnMatrixAttribute  mAttr;
	MFnTypedAttribute   tAttr;

	aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) );

	aInputMesh = tAttr.create( "inputMesh", "inputMesh", MFnData::kMesh );
	tAttr.setStorable( true );
	tAttr.setCached( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutputMatrix ) );

	aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inputMeshMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutputMatrix ) );

	aPolygonIndex = nAttr.create( "polygonIndex", "polygonIndex", MFnNumericData::kInt, 0 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPolygonIndex ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPolygonIndex, aOutputMatrix ) );

	aU = nAttr.create( "u", "u", MFnNumericData::kDouble, 0.5 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aU ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aU, aOutputMatrix ) );

	aV = nAttr.create( "v", "v", MFnNumericData::kDouble, 0.5 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aV ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aV, aOutputMatrix ) );

	return  MS::kSuccess;
}
    //---------------------------------------------------
    MObject DagHelper::createAttribute (
        const MObject& node,
        const char* attributeName,
        const char* attributeShortName,
        MFnData::Type type,
        const char *value )
    {
        // Before creating a new attribute: verify that an old one doesn't already exist
        MStatus status;
        MObject attribute;
        MFnDependencyNode nodeFn ( node );
        MPlug plug = nodeFn.findPlug ( attributeShortName, status );

        if ( status != MStatus::kSuccess )
        {
            MFnTypedAttribute attr;
            MStatus status;
            attribute = attr.create ( attributeName,attributeShortName,type,&status );
            if ( status != MStatus::kSuccess ) return MObject::kNullObj;

            attr.setStorable ( true );
            attr.setKeyable ( false );
            attr.setCached ( true );
            attr.setReadable ( true );
            attr.setWritable ( true );
            status = nodeFn.addAttribute ( attribute, MFnDependencyNode::kLocalDynamicAttr );
            if ( status != MStatus::kSuccess ) return MObject::kNullObj;

            plug = nodeFn.findPlug ( attribute, &status );
            if ( status != MStatus::kSuccess ) return MObject::kNullObj;
        }

        status = plug.setValue ( value );
        if ( status != MStatus::kSuccess ) return MObject::kNullObj;

        return attribute;
    }
Exemplo n.º 5
0
MStatus pointOnSubd::initialize()
//
//	Description:
//		This method is called to create and initialize all of the attributes
//      and attribute dependencies for this node type.  This is only called 
//		once when the node type is registered with Maya.
//
//	Return Values:
//		MS::kSuccess
//		MS::kFailure
//		
{
	MStatus stat;

	MFnTypedAttribute subdAttr;
	aSubd = subdAttr.create( "subd", "s", MFnSubdData::kSubdSurface, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aSubd" );
 	subdAttr.setStorable(true);
 	subdAttr.setKeyable(false);
	subdAttr.setReadable( true );
	subdAttr.setWritable( true );
	subdAttr.setCached( false );
	stat = addAttribute( pointOnSubd::aSubd );
	McheckErr( stat, "cannot add pointOnSubd::aSubd" );

	MFnNumericAttribute faceFirstAttr;
	aFaceFirst = faceFirstAttr.create( "faceFirst", "ff",
									   MFnNumericData::kLong, 0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aFaceFirst" );
 	faceFirstAttr.setStorable(true);
 	faceFirstAttr.setKeyable(true);
	faceFirstAttr.setSoftMin( 0.0 );
	faceFirstAttr.setReadable( true );
	faceFirstAttr.setWritable( true );
	faceFirstAttr.setCached( false );
	stat = addAttribute( pointOnSubd::aFaceFirst );
	McheckErr( stat, "cannot add pointOnSubd::aFaceFirst" );

	MFnNumericAttribute faceSecondAttr;
	aFaceSecond = faceSecondAttr.create( "faceSecond", "fs",
										 MFnNumericData::kLong, 0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aFaceSecond" );
 	faceSecondAttr.setStorable(true);
 	faceSecondAttr.setKeyable(true);
	faceSecondAttr.setSoftMin( 0.0 );
	faceSecondAttr.setReadable( true );
	faceSecondAttr.setWritable( true );
	faceSecondAttr.setCached( false );
	stat = addAttribute( pointOnSubd::aFaceSecond );
	McheckErr( stat, "cannot add pointOnSubd::aFaceSecond" );

	MFnNumericAttribute uAttr;
	aU = uAttr.create( "uValue", "u", MFnNumericData::kDouble,
					   0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aU" );
 	uAttr.setStorable(true);
 	uAttr.setKeyable(true);
	uAttr.setSoftMin( 0.0 );
	uAttr.setSoftMax( 1.0 );
	uAttr.setReadable( true );
	uAttr.setWritable( true );
	uAttr.setCached( false );
	stat = addAttribute( aU );
	McheckErr( stat, "cannot add pointOnSubd::aU" );

	MFnNumericAttribute vAttr;
	aV = vAttr.create( "vValue", "v", MFnNumericData::kDouble,
					   0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aV" );
 	vAttr.setStorable(true);
 	vAttr.setKeyable(true);
	vAttr.setSoftMin( 0.0 );
	vAttr.setSoftMax( 1.0 );
	vAttr.setReadable( true );
	vAttr.setWritable( true );
	vAttr.setCached( false );
	stat = addAttribute( aV );
	McheckErr( stat, "cannot add pointOnSubd::aV" );

	MFnNumericAttribute relAttr;
	aRelativeUV = relAttr.create( "relative", "rel", MFnNumericData::kBoolean,
								  0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aRelativeUV" );
 	relAttr.setStorable(true);
 	relAttr.setKeyable(true);
	relAttr.setSoftMin( 0.0 );
	relAttr.setSoftMax( 1.0 );
	relAttr.setReadable( true );
	relAttr.setWritable( true );
	relAttr.setCached( false );
	stat = addAttribute( pointOnSubd::aRelativeUV );
	McheckErr( stat, "cannot add pointOnSubd::aRelativeUV" );

	MFnNumericAttribute pointXAttr;
	aPointX = pointXAttr.create( "pointX", "px", MFnNumericData::kDouble,
								0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aPointX" );
	pointXAttr.setWritable(false);
	pointXAttr.setStorable(false);
	pointXAttr.setReadable( true );
	pointXAttr.setCached( true );
	stat = addAttribute( aPointX );
	McheckErr( stat, "cannot add pointOnSubd::aPointX" );

	MFnNumericAttribute pointYAttr;
	aPointY = pointYAttr.create( "pointY", "py", MFnNumericData::kDouble,
								0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aPointY" );
	pointYAttr.setWritable(false);
	pointYAttr.setStorable(false);
	pointYAttr.setReadable( true );
	pointYAttr.setCached( true );
	stat = addAttribute( aPointY );
	McheckErr( stat, "cannot add pointOnSubd::aPointY" );

	MFnNumericAttribute pointZAttr;
	aPointZ = pointZAttr.create( "pointZ", "pz", MFnNumericData::kDouble,
								0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aPointZ" );
	pointZAttr.setWritable(false);
	pointZAttr.setStorable(false);
	pointZAttr.setReadable( true );
	pointZAttr.setCached( true );
	stat = addAttribute( aPointZ );
	McheckErr( stat, "cannot add pointOnSubd::aPointZ" );

	MFnNumericAttribute pointAttr;
	aPoint = pointAttr.create( "point", "p", aPointX, aPointY, aPointZ, &stat);
	McheckErr( stat, "cannot create pointOnSubd::aPoint" );
	pointAttr.setWritable(false);
	pointAttr.setStorable(false);
	pointAttr.setReadable( true );
	pointAttr.setCached( true );
	stat = addAttribute( aPoint );
	McheckErr( stat, "cannot add pointOnSubd::aPoint" );

	MFnNumericAttribute normalXAttr;
	aNormalX = normalXAttr.create( "normalX", "nx", MFnNumericData::kDouble,
								   0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aNormal" );
	normalXAttr.setWritable(false);
	normalXAttr.setStorable(false);
	normalXAttr.setReadable( true );
	normalXAttr.setCached( true );
	stat = addAttribute( aNormalX );
	McheckErr( stat, "cannot add pointOnSubd::aNormalX" );

	MFnNumericAttribute normalYAttr;
	aNormalY = normalYAttr.create( "normalY", "ny", MFnNumericData::kDouble,
								   0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aNormal" );
	normalYAttr.setWritable(false);
	normalYAttr.setStorable(false);
	normalYAttr.setReadable( true );
	normalYAttr.setCached( true );
	stat = addAttribute( aNormalY );
	McheckErr( stat, "cannot add pointOnSubd::aNormalY" );

	MFnNumericAttribute normalZAttr;
	aNormalZ = normalZAttr.create( "normalZ", "nz", MFnNumericData::kDouble,
								   0.0, &stat );
	McheckErr( stat, "cannot create pointOnSubd::aNormal" );
	normalZAttr.setWritable(false);
	normalZAttr.setStorable(false);
	normalZAttr.setReadable( true );
	normalZAttr.setCached( true );
	stat = addAttribute( aNormalZ );
	McheckErr( stat, "cannot add pointOnSubd::aNormalZ" );

	MFnNumericAttribute normalAttr;
	aNormal = normalAttr.create("normal","n",aNormalX,aNormalY,aNormalZ,&stat);
	McheckErr( stat, "cannot create pointOnSubd::aNormal" );
	normalAttr.setWritable(false);
	normalAttr.setStorable(false);
	normalAttr.setReadable( true );
	normalAttr.setCached( true );
	stat = addAttribute( aNormal );
	McheckErr( stat, "cannot add pointOnSubd::aNormal" );


	// Set up a dependency between the input and the output.  This will cause
	// the output to be marked dirty when the input changes.  The output will
	// then be recomputed the next time the value of the output is requested.
	//
	stat = attributeAffects( aSubd, aPoint );
	stat = attributeAffects( aSubd, aPointX );
	stat = attributeAffects( aSubd, aPointY );
	stat = attributeAffects( aSubd, aPointZ );
	stat = attributeAffects( aSubd, aNormal );
	stat = attributeAffects( aSubd, aNormalX );
	stat = attributeAffects( aSubd, aNormalY );
	stat = attributeAffects( aSubd, aNormalZ );

	stat = attributeAffects( aFaceFirst, aPoint );
	stat = attributeAffects( aFaceFirst, aPointX );
	stat = attributeAffects( aFaceFirst, aPointY );
	stat = attributeAffects( aFaceFirst, aPointZ );
	stat = attributeAffects( aFaceFirst, aNormal );
	stat = attributeAffects( aFaceFirst, aNormalX );
	stat = attributeAffects( aFaceFirst, aNormalY );
	stat = attributeAffects( aFaceFirst, aNormalZ );

	stat = attributeAffects( aFaceSecond, aPoint );
	stat = attributeAffects( aFaceSecond, aPointX );
	stat = attributeAffects( aFaceSecond, aPointY );
	stat = attributeAffects( aFaceSecond, aPointZ );
	stat = attributeAffects( aFaceSecond, aNormal );
	stat = attributeAffects( aFaceSecond, aNormalX );
	stat = attributeAffects( aFaceSecond, aNormalY );
	stat = attributeAffects( aFaceSecond, aNormalZ );

	stat = attributeAffects( aU, aPoint );
	stat = attributeAffects( aU, aPointX );
	stat = attributeAffects( aU, aPointY );
	stat = attributeAffects( aU, aPointZ );
	stat = attributeAffects( aU, aNormal );
	stat = attributeAffects( aU, aNormalX );
	stat = attributeAffects( aU, aNormalY );
	stat = attributeAffects( aU, aNormalZ );

	stat = attributeAffects( aV, aPoint );
	stat = attributeAffects( aV, aPointX );
	stat = attributeAffects( aV, aPointY );
	stat = attributeAffects( aV, aPointZ );
	stat = attributeAffects( aV, aNormal );
	stat = attributeAffects( aV, aNormalX );
	stat = attributeAffects( aV, aNormalY );
	stat = attributeAffects( aV, aNormalZ );

	stat = attributeAffects( aRelativeUV, aPoint );
	stat = attributeAffects( aRelativeUV, aPointX );
	stat = attributeAffects( aRelativeUV, aPointY );
	stat = attributeAffects( aRelativeUV, aPointZ );
	stat = attributeAffects( aRelativeUV, aNormal );
	stat = attributeAffects( aRelativeUV, aNormalX );
	stat = attributeAffects( aRelativeUV, aNormalY );
	stat = attributeAffects( aRelativeUV, aNormalZ );

	return MS::kSuccess;

}
Exemplo n.º 6
0
// 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 );

    aTexRotateZ = nAttr.create( "texRotateZ", "tz",
						   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 );

	// create output attributes here
	// outColor is the only output attribute and it is inherited
	// so we do not need to create or add it.
	//

	// Add the attributes here

    CHECK_MSTATUS( addAttribute(aColorGain));
    CHECK_MSTATUS( addAttribute(aTranspGain));
    CHECK_MSTATUS( addAttribute(aColorBias));
    CHECK_MSTATUS( addAttribute(aTranspBias));
	CHECK_MSTATUS( addAttribute(aNormalsPerVertex));
	CHECK_MSTATUS( addAttribute(aColorsPerVertex));
	CHECK_MSTATUS( addAttribute(aColorSetName));
	CHECK_MSTATUS( addAttribute(aTexRotateX));
	CHECK_MSTATUS( addAttribute(aTexRotateY));
	CHECK_MSTATUS( addAttribute(aTexRotateZ));

    CHECK_MSTATUS( attributeAffects (aColorGain,  outColor));
    CHECK_MSTATUS( attributeAffects (aTranspGain, outColor));
    CHECK_MSTATUS( attributeAffects (aColorBias,  outColor));
    CHECK_MSTATUS( attributeAffects (aTranspBias, outColor));
    CHECK_MSTATUS( attributeAffects (aNormalsPerVertex, outColor));
    CHECK_MSTATUS( attributeAffects (aColorsPerVertex, outColor));
    CHECK_MSTATUS( attributeAffects (aColorSetName, outColor));
    CHECK_MSTATUS( attributeAffects (aTexRotateX, outColor));
    CHECK_MSTATUS( attributeAffects (aTexRotateY, outColor));
    CHECK_MSTATUS( attributeAffects (aTexRotateZ, outColor));

    return MS::kSuccess;
}
MStatus closestPointOnCurveNode::initialize()

{

   // CREATE AND ADD ".inCurve" ATTRIBUTE:

   MFnTypedAttribute inCurveAttrFn;

   aInCurve = inCurveAttrFn.create("inCurve", "ic", MFnData::kNurbsCurve);

   inCurveAttrFn.setStorable(true);

   inCurveAttrFn.setKeyable(false);

   inCurveAttrFn.setReadable(true);

   inCurveAttrFn.setWritable(true);

   inCurveAttrFn.setCached(false);

   addAttribute(aInCurve);



   // CREATE AND ADD ".inPositionX" ATTRIBUTE:

   MFnNumericAttribute inPositionXAttrFn;

   aInPositionX = inPositionXAttrFn.create("inPositionX", "ipx", MFnNumericData::kDouble, 0.0);

   inPositionXAttrFn.setStorable(true);

   inPositionXAttrFn.setKeyable(true);

   inPositionXAttrFn.setReadable(true);

   inPositionXAttrFn.setWritable(true);

   addAttribute(aInPositionX);



   // CREATE AND ADD ".inPositionY" ATTRIBUTE:

   MFnNumericAttribute inPositionYAttrFn;

   aInPositionY = inPositionYAttrFn.create("inPositionY", "ipy", MFnNumericData::kDouble, 0.0);

   inPositionYAttrFn.setStorable(true);

   inPositionYAttrFn.setKeyable(true);

   inPositionYAttrFn.setReadable(true);

   inPositionYAttrFn.setWritable(true);

   addAttribute(aInPositionY);



   // CREATE AND ADD ".inPositionZ" ATTRIBUTE:

   MFnNumericAttribute inPositionZAttrFn;

   aInPositionZ = inPositionZAttrFn.create("inPositionZ", "ipz", MFnNumericData::kDouble, 0.0);

   inPositionZAttrFn.setStorable(true);

   inPositionZAttrFn.setKeyable(true);

   inPositionZAttrFn.setReadable(true);

   inPositionZAttrFn.setWritable(true);

   addAttribute(aInPositionZ);



   // CREATE AND ADD ".inPosition" ATTRIBUTE:

   MFnNumericAttribute inPositionAttrFn;

   aInPosition = inPositionAttrFn.create("inPosition", "ip", aInPositionX, aInPositionY, aInPositionZ);

   inPositionAttrFn.setStorable(true);

   inPositionAttrFn.setKeyable(true);

   inPositionAttrFn.setReadable(true);

   inPositionAttrFn.setWritable(true);

   addAttribute(aInPosition);



   // CREATE AND ADD ".positionX" ATTRIBUTE:

   MFnNumericAttribute pointXAttrFn;

   aPositionX = pointXAttrFn.create("positionX", "px", MFnNumericData::kDouble, 0.0);

   pointXAttrFn.setStorable(false);

   pointXAttrFn.setKeyable(false);

   pointXAttrFn.setReadable(true);

   pointXAttrFn.setWritable(false);

   addAttribute(aPositionX);



   // CREATE AND ADD ".positionY" ATTRIBUTE:

   MFnNumericAttribute pointYAttrFn;

   aPositionY = pointYAttrFn.create("positionY", "py", MFnNumericData::kDouble, 0.0);

   pointYAttrFn.setStorable(false);

   pointYAttrFn.setKeyable(false);

   pointYAttrFn.setReadable(true);

   pointYAttrFn.setWritable(false);

   addAttribute(aPositionY);



   // CREATE AND ADD ".positionZ" ATTRIBUTE:

   MFnNumericAttribute pointZAttrFn;

   aPositionZ = pointZAttrFn.create("positionZ", "pz", MFnNumericData::kDouble, 0.0);

   pointZAttrFn.setStorable(false);

   pointZAttrFn.setKeyable(false);

   pointZAttrFn.setReadable(true);

   pointZAttrFn.setWritable(false);

   addAttribute(aPositionZ);



   // CREATE AND ADD ".position" ATTRIBUTE:

   MFnNumericAttribute pointAttrFn;

   aPosition = pointAttrFn.create("position", "p", aPositionX, aPositionY, aPositionZ);

   pointAttrFn.setStorable(false);

   pointAttrFn.setKeyable(false);

   pointAttrFn.setReadable(true);

   pointAttrFn.setWritable(false);

   addAttribute(aPosition);



   // CREATE AND ADD ".normalX" ATTRIBUTE:

   MFnNumericAttribute normalXAttrFn;

   aNormalX = normalXAttrFn.create("normalX", "nx", MFnNumericData::kDouble, 0.0);

   normalXAttrFn.setStorable(false);

   normalXAttrFn.setKeyable(false);

   normalXAttrFn.setReadable(true);

   normalXAttrFn.setWritable(false);

   addAttribute(aNormalX);



   // CREATE AND ADD ".normalY" ATTRIBUTE:

   MFnNumericAttribute normalYAttrFn;

   aNormalY = normalYAttrFn.create("normalY", "ny", MFnNumericData::kDouble, 0.0);

   normalYAttrFn.setStorable(false);

   normalYAttrFn.setKeyable(false);

   normalYAttrFn.setReadable(true);

   normalYAttrFn.setWritable(false);

   addAttribute(aNormalY);



   // CREATE AND ADD ".normalZ" ATTRIBUTE:

   MFnNumericAttribute normalZAttrFn;

   aNormalZ = normalZAttrFn.create("normalZ", "nz", MFnNumericData::kDouble, 0.0);

   normalZAttrFn.setStorable(false);

   normalZAttrFn.setKeyable(false);

   normalZAttrFn.setReadable(true);

   normalZAttrFn.setWritable(false);

   addAttribute(aNormalZ);



   // CREATE AND ADD ".normal" ATTRIBUTE:

   MFnNumericAttribute normalAttrFn;

   aNormal = normalAttrFn.create("normal", "n", aNormalX, aNormalY, aNormalZ);

   normalAttrFn.setStorable(false);

   normalAttrFn.setKeyable(false);

   normalAttrFn.setReadable(true);

   normalAttrFn.setWritable(false);

   addAttribute(aNormal);



   // CREATE AND ADD ".tangentX" ATTRIBUTE:

   MFnNumericAttribute tangentXAttrFn;

   aTangentX = tangentXAttrFn.create("tangentX", "tx", MFnNumericData::kDouble, 0.0);

   tangentXAttrFn.setStorable(false);

   tangentXAttrFn.setKeyable(false);

   tangentXAttrFn.setReadable(true);

   tangentXAttrFn.setWritable(false);

   addAttribute(aTangentX);



   // CREATE AND ADD ".tangentY" ATTRIBUTE:

   MFnNumericAttribute tangentYAttrFn;

   aTangentY = tangentYAttrFn.create("tangentY", "ty", MFnNumericData::kDouble, 0.0);

   tangentYAttrFn.setStorable(false);

   tangentYAttrFn.setKeyable(false);

   tangentYAttrFn.setReadable(true);

   tangentYAttrFn.setWritable(false);

   addAttribute(aTangentY);



   // CREATE AND ADD ".tangentZ" ATTRIBUTE:

   MFnNumericAttribute tangentZAttrFn;

   aTangentZ = tangentZAttrFn.create("tangentZ", "tz", MFnNumericData::kDouble, 0.0);

   tangentZAttrFn.setStorable(false);

   tangentZAttrFn.setKeyable(false);

   tangentZAttrFn.setReadable(true);

   tangentZAttrFn.setWritable(false);

   addAttribute(aTangentZ);



   // CREATE AND ADD ".tangent" ATTRIBUTE:

   MFnNumericAttribute tangentAttrFn;

   aTangent = tangentAttrFn.create("tangent", "t", aTangentX, aTangentY, aTangentZ);

   tangentAttrFn.setStorable(false);

   tangentAttrFn.setKeyable(false);

   tangentAttrFn.setReadable(true);

   tangentAttrFn.setWritable(false);

   addAttribute(aTangent);



   // CREATE AND ADD ".parameU" ATTRIBUTE:

   MFnNumericAttribute paramUAttrFn;

   aParamU = paramUAttrFn.create("paramU", "u", MFnNumericData::kDouble, 0.0);

   paramUAttrFn.setStorable(false);

   paramUAttrFn.setKeyable(false);

   paramUAttrFn.setReadable(true);

   paramUAttrFn.setWritable(false);

   addAttribute(aParamU);



   // CREATE AND ADD ".distance" ATTRIBUTE:

   MFnNumericAttribute distanceAttrFn;

   aDistance = distanceAttrFn.create("distance", "d", MFnNumericData::kDouble, 0.0);

   distanceAttrFn.setStorable(false);

   distanceAttrFn.setKeyable(false);

   distanceAttrFn.setReadable(true);

   distanceAttrFn.setWritable(false);

   addAttribute(aDistance);



   // DEPENDENCY RELATIONS FOR ".inCurve":

   attributeAffects(aInCurve, aPosition);

   attributeAffects(aInCurve, aPositionX);

   attributeAffects(aInCurve, aPositionY);

   attributeAffects(aInCurve, aPositionZ);

   attributeAffects(aInCurve, aNormal);

   attributeAffects(aInCurve, aNormalX);

   attributeAffects(aInCurve, aNormalY);

   attributeAffects(aInCurve, aNormalZ);

   attributeAffects(aInCurve, aTangent);

   attributeAffects(aInCurve, aTangentX);

   attributeAffects(aInCurve, aTangentY);

   attributeAffects(aInCurve, aTangentZ);

   attributeAffects(aInCurve, aParamU);

   attributeAffects(aInCurve, aDistance);



   // DEPENDENCY RELATIONS FOR ".inPosition":

   attributeAffects(aInPosition, aPosition);

   attributeAffects(aInPosition, aPositionX);

   attributeAffects(aInPosition, aPositionY);

   attributeAffects(aInPosition, aPositionZ);

   attributeAffects(aInPosition, aNormal);

   attributeAffects(aInPosition, aNormalX);

   attributeAffects(aInPosition, aNormalY);

   attributeAffects(aInPosition, aNormalZ);

   attributeAffects(aInPosition, aTangent);

   attributeAffects(aInPosition, aTangentX);

   attributeAffects(aInPosition, aTangentY);

   attributeAffects(aInPosition, aTangentZ);

   attributeAffects(aInPosition, aParamU);

   attributeAffects(aInPosition, aDistance);



   // DEPENDENCY RELATIONS FOR ".inPositionX":

   attributeAffects(aInPositionX, aPosition);

   attributeAffects(aInPositionX, aPositionX);

   attributeAffects(aInPositionX, aPositionY);

   attributeAffects(aInPositionX, aPositionZ);

   attributeAffects(aInPositionX, aNormal);

   attributeAffects(aInPositionX, aNormalX);

   attributeAffects(aInPositionX, aNormalY);

   attributeAffects(aInPositionX, aNormalZ);

   attributeAffects(aInPositionX, aTangent);

   attributeAffects(aInPositionX, aTangentX);

   attributeAffects(aInPositionX, aTangentY);

   attributeAffects(aInPositionX, aTangentZ);

   attributeAffects(aInPositionX, aParamU);

   attributeAffects(aInPositionX, aDistance);



   // DEPENDENCY RELATIONS FOR ".inPositionY":

   attributeAffects(aInPositionY, aPosition);

   attributeAffects(aInPositionY, aPositionX);

   attributeAffects(aInPositionY, aPositionY);

   attributeAffects(aInPositionY, aPositionZ);

   attributeAffects(aInPositionY, aNormal);

   attributeAffects(aInPositionY, aNormalX);

   attributeAffects(aInPositionY, aNormalY);

   attributeAffects(aInPositionY, aNormalZ);

   attributeAffects(aInPositionY, aTangent);

   attributeAffects(aInPositionY, aTangentX);

   attributeAffects(aInPositionY, aTangentY);

   attributeAffects(aInPositionY, aTangentZ);

   attributeAffects(aInPositionY, aParamU);

   attributeAffects(aInPositionY, aDistance);



   // DEPENDENCY RELATIONS FOR ".inPositionZ":

   attributeAffects(aInPositionZ, aPosition);

   attributeAffects(aInPositionZ, aPositionX);

   attributeAffects(aInPositionZ, aPositionY);

   attributeAffects(aInPositionZ, aPositionZ);

   attributeAffects(aInPositionZ, aNormal);

   attributeAffects(aInPositionZ, aNormalX);

   attributeAffects(aInPositionZ, aNormalY);

   attributeAffects(aInPositionZ, aNormalZ);

   attributeAffects(aInPositionZ, aTangent);

   attributeAffects(aInPositionZ, aTangentX);

   attributeAffects(aInPositionZ, aTangentY);

   attributeAffects(aInPositionZ, aTangentZ);

   attributeAffects(aInPositionZ, aParamU);

   attributeAffects(aInPositionZ, aDistance);



   return MS::kSuccess;

}
Exemplo n.º 8
0
MStatus bruiseMapNode::initialize()
{ 
	MStatus			 status;
	    MFnNumericAttribute nAttr; 
    MFnTypedAttribute tAttr;
	
	aBias = nAttr.create("bias", "bs",
						  MFnNumericData::kFloat, 0.1f, &status);
    CHECK_MSTATUS( status );
    CHECK_MSTATUS( nAttr.setStorable(true));
    CHECK_MSTATUS( nAttr.setKeyable(true));
    CHECK_MSTATUS( nAttr.setMin(0.f));
	
	amapsize = nAttr.create( "mapsize", "mapsize", MFnNumericData::kInt, 1024 );
	nAttr.setStorable(false);
	nAttr.setKeyable(false);
	addAttribute( amapsize );
	
	auvset = tAttr.create("uvset", "uv",
	MFnData::kString, MObject::kNullObj, &status);
    CHECK_MSTATUS( status );
    CHECK_MSTATUS( tAttr.setStorable(true));
    CHECK_MSTATUS( tAttr.setKeyable(false));
	tAttr.setCached( true );
	tAttr.setInternal( true );
	
	zWorks::createMatrixAttr(aworldSpace, "worldSpace", "ws");

	aoutput = nAttr.create( "outval", "ov", MFnNumericData::kInt, 1 );
	nAttr.setStorable(false);
	nAttr.setWritable(false);
	nAttr.setKeyable(false);
	addAttribute( aoutput );
	
	zWorks::createTypedAttr(agrowth, MString("growMesh"), MString("gm"), MFnData::kMesh);
	zCheckStatus(addAttribute(agrowth), "ERROR adding grow mesh");
	
	zWorks::createTypedAttr(aguide, MString("guideMesh"), MString("gdm"), MFnData::kMesh);
	zCheckStatus(addAttribute(aguide), "ERROR adding grow mesh");
	
	astartframe = nAttr.create( "startFrame", "sf", MFnNumericData::kInt, 1 );
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
	addAttribute( astartframe );
	
	zWorks::createTimeAttr(acurrenttime, MString("currentTime"), MString("ct"), 1.0);
	zCheckStatus(addAttribute(acurrenttime), "ERROR adding time");
	
	asavemap = nAttr.create( "saveMap", "sm", MFnNumericData::kInt, 0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(asavemap);
	
	CHECK_MSTATUS( addAttribute(aBias));
	CHECK_MSTATUS( addAttribute(auvset));
	
	addAttribute(aworldSpace);
	attributeAffects( aBias, aoutput );
	attributeAffects( amapsize, aoutput );
	attributeAffects( agrowth, aoutput );
	attributeAffects( astartframe, aoutput );
	attributeAffects( acurrenttime, aoutput );
	attributeAffects( aguide, aoutput );
	attributeAffects( asavemap, aoutput );
	
	return MS::kSuccess;
}
Exemplo n.º 9
0
MStatus curveColliderLocator::initialize()
{ 
	MFnNumericAttribute nAttr;
	MStatus				stat;
	
	colliderRadiusIn = nAttr.create( "radius", "rd", MFnNumericData::kDouble );
	nAttr.setDefault(1.0);
	nAttr.setMin(0);
	nAttr.setKeyable(true);
	nAttr.setArray(true);
	nAttr.setStorable(true);
	nAttr.setWritable(true);
	
	stat = addAttribute(colliderRadiusIn);
	if (!stat) {
		stat.perror("Could not add colliderRadiusIn attribute");
		return stat;
	}
	
	// CREATE AND ADD ".inCurve" ATTRIBUTE:
	
	MFnTypedAttribute inCurveAttrFn;
	colliderCurveIn = inCurveAttrFn.create("colliderCurve", "ic", MFnData::kNurbsCurve);
	inCurveAttrFn.setStorable(true);
	inCurveAttrFn.setKeyable(false);
	inCurveAttrFn.setReadable(true);
	inCurveAttrFn.setWritable(true);
	inCurveAttrFn.setCached(false);

	stat = addAttribute(colliderCurveIn);
	if (!stat) {
		stat.perror("Could not add colliderCurveIn attribute");
		return stat;
	}
	
	MFnMatrixAttribute mAttr;
	colliderXform =mAttr.create("colliderXfm", "cx");
	mAttr.setReadable(false); 
	mAttr.setKeyable(false); 
	mAttr.setConnectable(true);
	stat = addAttribute( colliderXform ); 
	if (!stat) {
		stat.perror("Could not add colliderXform attribute");
		return stat;
	}
	
	colliderColorR = nAttr.create( "colorR", "clr", MFnNumericData::kFloat );
	nAttr.setDefault(0.2f);
	nAttr.setMin(0.0f);
	nAttr.setMax(1.0f);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	nAttr.setReadable(true);
	nAttr.setWritable(true);
	stat = addAttribute(colliderColorR);
	if (!stat) {
		stat.perror("Could not add colliderColorR attribute");
		return stat;
	}
	
	colliderColorG = nAttr.create( "colorG", "clg", MFnNumericData::kFloat );
	nAttr.setDefault(0.2f);
	nAttr.setMin(0.0f);
	nAttr.setMax(1.0f);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	nAttr.setReadable(true);
	nAttr.setWritable(true);
	stat = addAttribute(colliderColorG);
	if (!stat) {
		stat.perror("Could not add colliderColorG attribute");
		return stat;
	}

	colliderColorB = nAttr.create( "colorB", "clb", MFnNumericData::kFloat );
	nAttr.setDefault(0.8f);
	nAttr.setMin(0.0f);
	nAttr.setMax(1.0f);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	nAttr.setReadable(true);
	nAttr.setWritable(true);
	stat = addAttribute(colliderColorB);
	if (!stat) {
		stat.perror("Could not add colliderColorB attribute");
		return stat;
	}
	
	colliderTransparency = nAttr.create( "colorT", "clt", MFnNumericData::kFloat );
	nAttr.setDefault(1.0f);
	nAttr.setMin(0.0f);
	nAttr.setMax(1.0f);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	nAttr.setReadable(true);
	nAttr.setWritable(true);
	stat = addAttribute(colliderTransparency);
	if (!stat) {
		stat.perror("Could not add colliderTransparency attribute");
		return stat;
	}
	return MS::kSuccess;
}
Exemplo n.º 10
0
MStatus octreeVizNode::initialize()
{ 
	MStatus			 status;
	MFnNumericAttribute numAttr;
    MFnTypedAttribute tAttr;

	alevel = numAttr.create("alevel","alr",MFnNumericData::kShort);
	numAttr.setDefault( 4 ); 
	numAttr.setMin( 0 );
	numAttr.setMax( 10 );
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(alevel);
	CHECK_MSTATUS( status );

    aarea = numAttr.create("aarea","aar",MFnNumericData::kFloat);
	numAttr.setDefault( 10.0 ); 
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(aarea);
	CHECK_MSTATUS( status );

	acount = numAttr.create("acount","aco",MFnNumericData::kInt);
	numAttr.setDefault( 100 ); 
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(acount);
	CHECK_MSTATUS( status );

	adefinepositionX = numAttr.create("adefinepositionX","poX",MFnNumericData::kFloat);
	numAttr.setDefault( 0.0 ); 
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(adefinepositionX);
	CHECK_MSTATUS( status );

	adefinepositionY = numAttr.create("adefinepositionY","poY",MFnNumericData::kFloat);
	numAttr.setDefault( 0.0 ); 
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(adefinepositionY);
	CHECK_MSTATUS( status );

	adefinepositionZ= numAttr.create("adefinepositionZ","poZ",MFnNumericData::kFloat);
	numAttr.setDefault( 0.0 ); 
	numAttr.setKeyable( true ); 
    numAttr.setReadable( true ); 
    numAttr.setWritable( true ); 
    numAttr.setStorable( true ); 
	status = addAttribute(adefinepositionZ);
	CHECK_MSTATUS( status );


	afuzz = numAttr.create( "fuzz", "fuzz", MFnNumericData::kFloat, 0.0 );
	numAttr.setStorable(true);
	numAttr.setKeyable(true);
	addAttribute(afuzz);
	
	alengthnoise = numAttr.create("kink", "kink",
						  MFnNumericData::kFloat, 0.f, &status);
    CHECK_MSTATUS( status );
    CHECK_MSTATUS( numAttr.setStorable(true));
    CHECK_MSTATUS( numAttr.setKeyable(true));
	addAttribute(alengthnoise);
	
	aSize = numAttr.create("clumping", "clp",
						  MFnNumericData::kFloat, 0.f, &status);
    CHECK_MSTATUS( status );
    CHECK_MSTATUS( numAttr.setStorable(true));
    CHECK_MSTATUS( numAttr.setKeyable(true));
    CHECK_MSTATUS( numAttr.setDefault(0.f));
	numAttr.setCached( true );
	addAttribute(aSize);
	
	astep = numAttr.create( "drawStep", "dsp", MFnNumericData::kInt, 1 );
	numAttr.setStorable(true);
	numAttr.setKeyable(true);
	addAttribute(astep);
	
	aHDRName = tAttr.create("cachePath", "cp",
	MFnData::kString, MObject::kNullObj, &status);
    CHECK_MSTATUS( status );
    CHECK_MSTATUS( tAttr.setStorable(true));
    CHECK_MSTATUS( tAttr.setKeyable(false));
	tAttr.setCached( true );
	
	zWorks::createMatrixAttr(aworldSpace, "worldSpace", "ws");
	
	aoutput = numAttr.create( "outval", "ov", MFnNumericData::kInt, 1 );
	numAttr.setStorable(false);
	numAttr.setWritable(false);
	numAttr.setKeyable(false);
	addAttribute( aoutput );
	
	zWorks::createTypedAttr(agrowth, MString("growMesh"), MString("gm"), MFnData::kMesh);
	zCheckStatus(addAttribute(agrowth), "ERROR adding grow mesh");
	
	zWorks::createTypedArrayAttr(aguide, MString("guideMesh"), MString("gdm"), MFnData::kMesh);
	zCheckStatus(addAttribute(aguide), "ERROR adding guide mesh");
	
	astartframe = numAttr.create( "startFrame", "sf", MFnNumericData::kInt, 1 );
	numAttr.setStorable(true);
	numAttr.setKeyable(true);
	addAttribute( astartframe );
	
	zWorks::createTimeAttr(acurrenttime, MString("currentTime"), MString("ct"), 1.0);
	zCheckStatus(addAttribute(acurrenttime), "ERROR adding time");
	
	asavemap = numAttr.create( "saveMap", "sm", MFnNumericData::kInt, 0);
	numAttr.setStorable(false);
	numAttr.setKeyable(true);
	addAttribute(asavemap);
	
	aalternativepatch = numAttr.create( "patchOrder", "pod", MFnNumericData::kInt, 0);
	numAttr.setStorable(true);
	numAttr.setKeyable(true);
	addAttribute(aalternativepatch);
	
	CHECK_MSTATUS( addAttribute(aHDRName));
	addAttribute(aworldSpace);
	attributeAffects( alengthnoise, aoutput );
	attributeAffects( aSize, aoutput );
	attributeAffects( aworldSpace, aoutput );
	attributeAffects( agrowth, aoutput );
	attributeAffects( aguide, aoutput );
	attributeAffects( astartframe, aoutput );
	attributeAffects( acurrenttime, aoutput );
	attributeAffects( asavemap, aoutput );
	attributeAffects( afuzz, aoutput );
	attributeAffects( astep, aoutput );
	attributeAffects( aalternativepatch, aoutput );
	attributeAffects( alevel, aoutput );
	attributeAffects( aarea, aoutput );
	attributeAffects( acount, aoutput );
	attributeAffects( adefinepositionX, aoutput );
	attributeAffects( adefinepositionY, aoutput );
	attributeAffects( adefinepositionZ, aoutput );
	attributeAffects( aHDRName, aoutput );
	
	return MS::kSuccess;
}