Exemplo n.º 1
0
MStatus btSPHMgrNode::initialize()
{
	_LogFunctionCall("btSPHMgrNode::initialize()");

	MStatus status;
	MFnUnitAttribute uAttr;	
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;

	i_particleShape = nAttr.create(particleShape, ps, MFnNumericData::kInt, 0, &status);
	IfMErrorWarn(status);
	IfMErrorWarn(addAttribute(i_particleShape));

	i_particlePPAttr = nAttr.create(particlePPAttr, pppa, MFnNumericData::kInt, 0, &status);
	IfMErrorWarn(status);
	IfMErrorWarn(addAttribute(i_particlePPAttr));

	i_particleCount = nAttr.create( particleCount, pc, MFnNumericData::kInt, 300,&status);
	IfMErrorWarn(status);
	IfMErrorWarn(addAttribute( i_particleCount ));

	i_obstacleAABB = tAttr.create(obstacleBox, obox, MFnData::kMesh, MObject::kNullObj, &status);
	IfMErrorWarn(status);
	IfMErrorWarn(addAttribute(i_obstacleAABB));

	i_initAABB = tAttr.create(initBox, ibox, MFnData::kMesh, MObject::kNullObj, &status);
	IfMErrorWarn(status);
	IfMErrorWarn(addAttribute(i_initAABB));

	return MS::kSuccess;
}
Exemplo n.º 2
0
MStatus SceneShape::initialize()
{
	MStatus s = inheritAttributesFrom( "ieSceneShapeInterface" );
	MFnTypedAttribute tAttr;
	
	// will need to check for sceneFile extensions
	aSceneFilePlug = tAttr.create( "file", "scf", MFnData::kString, &s );
	assert( s );
	s = addAttribute( aSceneFilePlug );
	assert( s );
	
	aSceneRootPlug = tAttr.create( "root", "scr", MFnData::kString, MFnStringData().create( "/" ), &s );
	assert( s );
	s = addAttribute( aSceneRootPlug );
	assert( s );
	
	attributeAffects( aSceneFilePlug, aTransform );
	attributeAffects( aSceneFilePlug, aBound );
	attributeAffects( aSceneFilePlug, aOutputObjects );
	attributeAffects( aSceneFilePlug, aAttributes );
	
	attributeAffects( aSceneRootPlug, aTransform );
	attributeAffects( aSceneRootPlug, aBound );
	attributeAffects( aSceneRootPlug, aOutputObjects );
	attributeAffects( aSceneRootPlug, aAttributes );

	return s;
}
MStatus testNpassiveNode::initialize()
{
    MStatus stat;
    MFnTypedAttribute tAttr;
    inputGeom = tAttr.create("inputGeom", "ing", MFnData::kMesh, MObject::kNullObj, &stat );
    //statCheck(stat, "failed to create inputGeom");
    tAttr.setWritable(true);
    tAttr.setStorable(true);
    tAttr.setHidden(true);
    currentState = tAttr.create("currentState", "cus", MFnData::kNObject, MObject::kNullObj, &stat );
   // statCheck(stat, "failed to create currentState");
    tAttr.setWritable(true);
    tAttr.setStorable(false);
    tAttr.setHidden(true);
    startState = tAttr.create( "startState", "sts", MFnData::kNObject, MObject::kNullObj, &stat );
    //statCheck(stat, "failed to create startState");
    tAttr.setWritable(true);
    tAttr.setStorable(false);
    tAttr.setHidden(true);
    MFnUnitAttribute uniAttr;
    currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime,  0.0, &stat  );    
    addAttribute(inputGeom);
    addAttribute(currentTime);
    addAttribute(startState);
    addAttribute(currentState);
    
    attributeAffects(inputGeom, startState);
    attributeAffects(inputGeom, currentState);
    attributeAffects(currentTime, currentState);    
    attributeAffects(currentTime, startState);    
    return MStatus::kSuccess;
}
Exemplo n.º 4
0
MStatus fullLoft::initialize()
{
	MStatus stat;
	MFnTypedAttribute typedAttr;
	
	inputCurve=typedAttr.create( "inputCurve", "in",
										 MFnNurbsCurveData::kNurbsCurve,
										 &stat );
	PERRORfail("initialize create input attribute");
	stat = typedAttr.setArray( true );
	PERRORfail("initialize set input attribute array");
	
	outputSurface=typedAttr.create( "outputSurface", "out",
											MFnNurbsSurfaceData::kNurbsSurface,
											&stat );
	PERRORfail("initialize create output attribute");
	stat = typedAttr.setStorable( false );
	PERRORfail("initialize set output attribute storable");

	stat = addAttribute( inputCurve );
	PERRORfail("addAttribute(inputCurve)");

	stat = addAttribute( outputSurface );
	PERRORfail("addAttribute(outputSurface)");

	stat = attributeAffects( inputCurve, outputSurface );
	PERRORfail("attributeAffects(inputCurve, outputSurface)");

	return MS::kSuccess;
}
Exemplo n.º 5
0
MStatus HesMeshNode::initialize()
{
	MFnNumericAttribute numAttr;
	MStatus				stat;
	
	MFnTypedAttribute stringAttr;
	input = stringAttr.create( "hesPath", "hsp", MFnData::kString );
 	stringAttr.setStorable(true);
	addAttribute( input );
	
	ameshname = stringAttr.create( "meshName", "mn", MFnData::kString );
 	stringAttr.setStorable(true);
    stringAttr.setArray(true);
    stringAttr.setDisconnectBehavior(MFnAttribute::kDelete);
	addAttribute( ameshname );
	
	MFnTypedAttribute meshAttr;
	outMesh = meshAttr.create( "outMesh", "o", MFnData::kMesh ); 
	meshAttr.setStorable(false);
	meshAttr.setWritable(false);
    meshAttr.setArray(true);
    meshAttr.setDisconnectBehavior(MFnAttribute::kDelete);
	addAttribute( outMesh );
    
	attributeAffects( input, outMesh );
	
	return MS::kSuccess;
}
Exemplo n.º 6
0
MStatus  clusterControledCurve::initialize()
{
	MStatus  status;

	MFnNumericAttribute  nAttr;
	MFnMatrixAttribute   mAttr;
	MFnTypedAttribute    tAttr;
	MFnCompoundAttribute cAttr;

	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aInputCurve ) );

	aInputCurveMatrix = mAttr.create( "inputCurveMatrix", "inputCurveMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aInputCurveMatrix ) );

	aDumyMatrix = mAttr.create( "dumyMatrix", "dumyMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aDumyMatrix ) );

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

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

	aWeightList = cAttr.create( "weightList", "weightList" );
	aWeights = nAttr.create( "weights", "weights", MFnNumericData::kFloat, 0.0 );
	nAttr.setArray( true );
	nAttr.setUsesArrayDataBuilder( true );
	cAttr.addChild( aWeights );
	cAttr.setArray( true );
	cAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aWeightList ) );

	aUpdate = nAttr.create( "update", "update", MFnNumericData::kBoolean, false );
	nAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aUpdate ) );

	aOutputCurve = tAttr.create( "outputCurve", "outputCurve", MFnData::kNurbsCurve );
	CHECK_MSTATUS( addAttribute( aOutputCurve ) );

	CHECK_MSTATUS( attributeAffects( aInputCurve, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aInputCurveMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aDumyMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aBindPreMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aWeightList, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aUpdate, aOutputCurve ) );

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

  MFnUnitAttribute uAttr;
  MFnTypedAttribute tAttr;
  MFnNumericAttribute nAttr;
  MFnGenericAttribute gAttr;
  MFnStringData emptyStringData;
  MObject emptyStringObject = emptyStringData.create("");

  // input time
  mTimeAttr = uAttr.create("inTime", "tm", MFnUnitAttribute::kTime, 0.0);
  status = uAttr.setStorable(true);
  status = uAttr.setKeyable(true);
  status = addAttribute(mTimeAttr);

  // input file name
  mFileNameAttr =
      tAttr.create("fileName", "fn", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setUsedAsFilename(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mFileNameAttr);

  // input identifier
  mIdentifierAttr =
      tAttr.create("identifier", "if", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mIdentifierAttr);

  // output for list of ArbGeomParams
  mGeomParamsList = tAttr.create("ExocortexAlembic_GeomParams", "exo_gp",
      MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = tAttr.setHidden(false);
  status = tAttr.setInternal(true);
  status = addAttribute(mGeomParamsList);

  // output for list of UserAttributes
  mUserAttrsList = tAttr.create("ExocortexAlembic_UserAttributes", "exo_ua",
      MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = tAttr.setHidden(false);
  status = tAttr.setInternal(true);
  status = addAttribute(mUserAttrsList);

  // create a mapping
  status = attributeAffects(mTimeAttr, outputGeom);
  status = attributeAffects(mFileNameAttr, outputGeom);
  status = attributeAffects(mIdentifierAttr, outputGeom);

  return status;
}
Exemplo n.º 8
0
MStatus DynamicEnum::initialize()
{
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnStringData sData;
	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:
	aFilePath = tAttr.create( "filepath", "file", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aGridName = tAttr.create( "grid", "grd", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aOutColor = nAttr.createColor( "outColor", "oc", &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( nAttr.setHidden( false ) );
	CHECK_MSTATUS( nAttr.setReadable( true ) );
	CHECK_MSTATUS( nAttr.setWritable( false ) );

	// Next we will add the attributes we have defined to the node
	//
	CHECK_MSTATUS( addAttribute( aFilePath ) );
	CHECK_MSTATUS( addAttribute( aGridName ) );
	CHECK_MSTATUS( addAttribute( aOutColor ) );

	// The attributeAffects() method is used to indicate when the input
	// attribute affects the output attribute. This knowledge allows Maya
	// to optimize dependencies in the graph in more complex nodes where
	// there may be several inputs and outputs, but not all the inputs
	// affect all the outputs.
	//
	CHECK_MSTATUS( attributeAffects( aFilePath, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aGridName, aOutColor ) );

	return( MS::kSuccess );
}
Exemplo n.º 9
0
MStatus resetVtxRemapNode::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				status;

	MFnTypedAttribute attrFn;

	inMesh = attrFn.create("inMesh", "im", MFnMeshData::kMesh);
	attrFn.setStorable(true);	// To be stored during file-save

	// Attribute is read-only because it is an output attribute
	//
	outMesh = attrFn.create("outMesh", "om", MFnMeshData::kMesh);
	attrFn.setStorable(false);
	attrFn.setWritable(false);

	status = addAttribute( inMesh );
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}
	status = addAttribute( outMesh);
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}

	// 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.
	//
	status = attributeAffects( inMesh, outMesh );
		if (!status)
		{
			status.perror("attributeAffects");
			return status;
		}

	return MS::kSuccess;

}
Exemplo n.º 10
0
MStatus LSystemNode::initialize()
{
        MFnUnitAttribute unitAttr;
        MFnTypedAttribute typedAttr;
		MFnNumericAttribute numericAttr;

        MStatus returnStatus;
		//(i)angle
		LSystemNode::angle = numericAttr.create("angle","ag",MFnNumericData::kDouble,90.0,&returnStatus);
		McheckErr(returnStatus, "ERROR creating LSystemNode angle attribute\n");
		//(ii)size
		step = numericAttr.create("step","st",MFnNumericData::kDouble,1.0, &returnStatus);
		McheckErr(returnStatus, "ERROR creating LSystemNode step attribute\n");//(iv)time
        //(iii)grammar
		LSystemNode::grammar = typedAttr.create( "grammar", "grm", MFnData::kString, &returnStatus );
		McheckErr(returnStatus, "ERROR creating LSystemNode grammar attribute\n");
		//(iv)time
		LSystemNode::time = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 0.0, &returnStatus );
        McheckErr(returnStatus, "ERROR creating LSystemNode time attribute\n");
		//(v)output
        LSystemNode::outputMesh = typedAttr.create( "outputMesh", "out", MFnData::kMesh, &returnStatus ); 
        McheckErr(returnStatus, "ERROR creating LSystemNode output attribute\n");
        typedAttr.setStorable(false);


		//(i)angle
		returnStatus = addAttribute(LSystemNode::angle);
		McheckErr(returnStatus, "ERROR adding angle attribute\n");
		//(ii)step
		returnStatus = addAttribute(LSystemNode::step);
		McheckErr(returnStatus, "ERROR adding step attribute\n");
		//(iii)grammar
		returnStatus = addAttribute(LSystemNode::grammar);
		McheckErr(returnStatus, "ERROR adding grammar attribute\n");
		//(iv)time
        returnStatus = addAttribute(LSystemNode::time);
        McheckErr(returnStatus, "ERROR adding time attribute\n");
		//(v)output
        returnStatus = addAttribute(LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

		returnStatus = attributeAffects(LSystemNode::angle,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
		returnStatus = attributeAffects(LSystemNode::step,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
		returnStatus = attributeAffects(LSystemNode::grammar,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
        returnStatus = attributeAffects(LSystemNode::time,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");

        return MS::kSuccess;
}
Exemplo n.º 11
0
MStatus multiCurve::initialize()
{
	MStatus				stat;
	MFnNumericAttribute	nAttr;
	MFnTypedAttribute	typedAttr;
	
	numCurves = nAttr.create ("numCurves", "nc",
							  MFnNumericData::kLong, 5, &stat);
	PERRORfail(stat, "initialize create numCurves attribute");
	CHECK_MSTATUS ( nAttr.setKeyable( true ) );
	stat = addAttribute( numCurves );
	PERRORfail(stat, "addAttribute(numCurves)");
	
	curveOffset = nAttr.create ("curveOffset", "co",
							  MFnNumericData::kDouble, 1.0, &stat);
	PERRORfail(stat, "initialize create curveOffset attribute");
	CHECK_MSTATUS ( nAttr.setKeyable( true ) );
	stat = addAttribute( curveOffset );
	PERRORfail(stat, "addAttribute(curveOffset)");

	inputCurve = typedAttr.create( "inputCurve", "ic",
								   MFnNurbsCurveData::kNurbsCurve, &stat );
	PERRORfail(stat, "initialize create inputCurve attribute");
	CHECK_MSTATUS ( typedAttr.setReadable( false ) );
	CHECK_MSTATUS ( typedAttr.setWritable( true ) );
	stat = addAttribute( inputCurve );
	PERRORfail(stat, "addAttribute(inputCurve)");
	
	outputCurves = typedAttr.create( "outputCurves", "oc",
									 MFnNurbsCurveData::kNurbsCurve, &stat );
	PERRORfail(stat, "initialize create outputCurves attribute");
	CHECK_MSTATUS ( typedAttr.setArray( true ) );
	CHECK_MSTATUS ( typedAttr.setReadable( true ) );
	CHECK_MSTATUS ( typedAttr.setWritable( false ) );
	CHECK_MSTATUS ( typedAttr.setUsesArrayDataBuilder( true ) );
	stat = addAttribute( outputCurves );
	PERRORfail(stat, "addAttribute(outputCurves)");

	stat = attributeAffects( numCurves, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	stat = attributeAffects( curveOffset, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	stat = attributeAffects( inputCurve, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	return stat;
}
Exemplo n.º 12
0
MStatus CmpMeshModifierNode::initialize()
{	
	MFnTypedAttribute tAttr;
	inMesh = tAttr.create( "inMesh", "im", MFnData::kMesh );
	
	outMesh = tAttr.create( "outMesh", "om", MFnData::kMesh );
	tAttr.setStorable( false );
	
	addAttribute( inMesh );
	addAttribute( outMesh );
	
	attributeAffects( inMesh, outMesh );
	
	return MS::kSuccess;
}
Exemplo n.º 13
0
MStatus ModifyArrayNode::initialize()
{
    MStatus status;

    MFnTypedAttribute T;
    MFnNumericAttribute N;
    MFnEnumAttribute E;

    aInput = T.create("input", "i", MFnData::kDoubleArray);
    T.setKeyable(false);
    T.setChannelBox(false);
    T.setStorable(true);
    T.setWritable(true);

    aOperation = E.create("operation", "operation");
    E.addField("No Operation", kNO_OP);
    E.addField("Sort", kSORT);
    E.addField("Absolute Value", kABS);
    E.addField("Reflect Left", kREFLECT_LEFT);
    E.addField("Reflect Right", kREFLECT_RIGHT);
    E.setDefault(kNO_OP);
    E.setKeyable(true);
    E.setStorable(true);
    E.setWritable(true);

    aReverse = N.create("reverse", "rev", MFnNumericData::kBoolean);
    N.setKeyable(true);
    N.setChannelBox(true);
    N.setStorable(true);
    N.setWritable(true);

    aOutput = T.create("output", "o", MFnData::kDoubleArray);
    T.setKeyable(false);
    T.setChannelBox(false);
    T.setWritable(false);
    T.setStorable(false);

    addAttribute(aOperation);
    addAttribute(aInput);
    addAttribute(aReverse);
    addAttribute(aOutput);

    attributeAffects(aOperation, aOutput);
    attributeAffects(aInput, aOutput);
    attributeAffects(aReverse, aOutput);

    return MS::kSuccess;
}
Exemplo n.º 14
0
MStatus EntityNode::Initialize()
{
    MAYA_START_EXCEPTION_HANDLING();

    MStatus stat;

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Create a string attribute "ArtFilePath" 
    MFnTypedAttribute tAttr;

    s_ArtFilePath = tAttr.create("ArtFilePath", "afp", MFnData::kString, &stat);
    MCheckErr(stat, "Unable to create attr: ArtFilePath");

    tAttr.setReadable(true);
    tAttr.setWritable(false);

    stat = addAttribute(s_ArtFilePath);
    MCheckErr(stat, "Unable to add attr: ArtFilePath");

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Create an array attribute "ImportNodes"
    MFnMessageAttribute mAttr;

    m_ImportNodes = mAttr.create( "ImortObjects", "ios", &stat );
    MCheckErr(stat, "Unable to create attr: ImportNodes");

    mAttr.setArray( true );

    stat = addAttribute(m_ImportNodes);
    MCheckErr(stat, "Unable to add attr: ImportNodes");

    MAYA_FINISH_EXCEPTION_HANDLING();

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

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	//add bulge attribute which affects the output geom
	aAmount = nAttr.create("amount", "amt", MFnNumericData::kDouble, 0.0);
	nAttr.setKeyable(true);
	addAttribute(aAmount);

	aStressMap = tAttr.create("aStressMap", "stMap", MFnData::kDoubleArray);
	tAttr.setKeyable(true);
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	addAttribute(aStressMap);

	aUseStress = nAttr.create("useStress", "useStress", MFnNumericData::kBoolean, 0);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	addAttribute(aUseStress);

	aMultiThreadingType = nAttr.create("multiThreadingType", "multiThreadingType", MFnNumericData::kInt, 0);
	nAttr.setKeyable(true);
	addAttribute(aMultiThreadingType);

	attributeAffects(aAmount, outputGeom);
	attributeAffects(aStressMap, outputGeom);
	attributeAffects(aUseStress, outputGeom);
  attributeAffects(aMultiThreadingType, outputGeom);
	// make paintable deformer
	MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer pushDeformer weights");

	return MS::kSuccess;
}
Exemplo n.º 16
0
//------------------------------------------------------------------------------
//
MStatus AdskPrepareRenderGlobals::initialize()
{    
   MStatus stat;  
   MFnStringData stringFn;
   MObject emptyStr = stringFn.create( &stat );
   
   MObject* attrib[3];
   attrib[0] = &aRepName;
   attrib[1] = &aRepLabel;
   attrib[2] = &aRepType;
   const char* longName[] = {"repName", "repLabel", "repType"};
   const char* shortName[] = {"rna", "rla", "rty"};
   
   MFnTypedAttribute stringAttrFn;
   for (int i = 0; i < 3; i++)
   {      
      *attrib[i] = stringAttrFn.create(longName[i], shortName[i], MFnData::kString, emptyStr);     
      stat = MPxNode::addAttribute(*attrib[i]);
      CHECK_MSTATUS_AND_RETURN_IT(stat);
   }
   
   MFnNumericAttribute boolAttrFn;
   aUseRegEx = boolAttrFn.create("useRegExp", "urx", MFnNumericData::kBoolean, 0);  
   stat = MPxNode::addAttribute(aUseRegEx);
   CHECK_MSTATUS_AND_RETURN_IT(stat);

   return  stat;
}
Exemplo n.º 17
0
MStatus sgBulgeDeformer::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnMatrixAttribute mAttr;
	MFnCompoundAttribute cAttr;

	aBulgeWeight = nAttr.create(nameBulgeWeight, nameBulgeWeight, MFnNumericData::kFloat, 1.0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeWeight);

	aBulgeRadius = nAttr.create(nameBulgeRadius, nameBulgeRadius, MFnNumericData::kDouble, 0);
	nAttr.setMin(0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeRadius);

	aBulgeInputs = cAttr.create(nameBulgeInputs, nameBulgeInputs);
	aMatrix = mAttr.create(nameMatrix, nameMatrix);
	aMesh = tAttr.create(nameMesh, nameMesh, MFnData::kMesh );
	cAttr.addChild(aMatrix);
	cAttr.addChild(aMesh);
	cAttr.setArray(true);
	addAttribute(aBulgeInputs);

	attributeAffects(aBulgeWeight, outputGeom);
	attributeAffects(aBulgeRadius, outputGeom);
	attributeAffects(aBulgeInputs, outputGeom);

	return status;
}
Exemplo n.º 18
0
MStatus ClothSimMayaPlugin::initialize()
{
	MFnUnitAttribute unitAttr;
	MFnTypedAttribute typedAttr;

	MStatus returnStatus;

	g_aTime = unitAttr.create("time", "tm",	MFnUnitAttribute::kTime, 0.0, &returnStatus);
	McheckErr(returnStatus, "ERROR creating time attribute\n");

	g_aOutputMesh = typedAttr.create("outputMesh", "out", MFnData::kMesh, &returnStatus);
	McheckErr(returnStatus, "ERROR creating output attribute\n");
	typedAttr.setStorable(false);

	returnStatus = addAttribute(g_aTime);
	McheckErr(returnStatus, "ERROR adding time attribute\n");

	returnStatus = addAttribute(g_aOutputMesh);
	McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

	returnStatus = attributeAffects(g_aTime, g_aOutputMesh);
	McheckErr(returnStatus, "ERROR in attributeAffects\n");

	return MS::kSuccess;
}
Exemplo n.º 19
0
MStatus blindDataMesh::initialize()
{
	MFnTypedAttribute typedAttr;
	MStatus returnStatus;

	blindDataMesh::outputMesh = typedAttr.create( "outputMesh", "out",
		MFnData::kMesh, &returnStatus ); 
	McheckErr(returnStatus, "ERROR creating blindDataMesh output attribute\n");
	typedAttr.setStorable(false);

	returnStatus = addAttribute(blindDataMesh::outputMesh);
	McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

	MFnNumericAttribute numAttr;
	blindDataMesh::seed = numAttr.create( "randomSeed", "seed",
		MFnNumericData::kLong, 0, &returnStatus );
	McheckErr(returnStatus, "ERROR creating blindDataMesh input attribute\n");

	returnStatus = addAttribute(blindDataMesh::seed);
	McheckErr(returnStatus, "ERROR adding input attribute\n");

	returnStatus = attributeAffects(blindDataMesh::seed,
								    blindDataMesh::outputMesh);
	McheckErr(returnStatus, "ERROR in attributeAffects\n");

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

    MFnNumericAttribute N;
    MFnTypedAttribute T;
    MFnUnitAttribute U;

    aSize = N.create("size", "size", MFnNumericData::kInt, 8.0, &status);
    N.setKeyable(true);
    N.setStorable(true);
    N.setWritable(true);
    N.setDefault(8);

    aInput = U.create("input", "i", MFnUnitAttribute::kAngle, 0.0, &status);
    U.setKeyable(false);
    U.setStorable(true);
    U.setWritable(true);
    U.setArray(true);

    aOutput = T.create("output", "o", MFnData::kDoubleArray, &status);
    T.setKeyable(false);
    T.setChannelBox(false);
    T.setWritable(false);
    T.setStorable(false);

    addAttribute(aSize);
    addAttribute(aInput);
    addAttribute(aOutput);

    attributeAffects(aSize, aOutput);
    attributeAffects(aInput, aOutput);

    return MS::kSuccess;
}
Exemplo n.º 21
0
MStatus EntityInstanceNode::Initialize()
{
    MAYA_START_EXCEPTION_HANDLING();

    MStatus stat;

    // wtf is this - rachel
    MFnStringData dataFn;
    MObject stringData = dataFn.create( "" );

    // fileName attribute
    MFnTypedAttribute tAttr;
    s_ArtFilePath = tAttr.create("ArtFilePath", "fn", MFnData::kString, &stat);
    tAttr.setDefault( stringData );
    MCheckErr(stat, "Unable to create attr: ArtFilePath");

    tAttr.setReadable(true);
    tAttr.setWritable(false);

    stat = addAttribute(s_ArtFilePath);
    MCheckErr(stat, "Unable to add attr: ArtFilePath");

    MAYA_FINISH_EXCEPTION_HANDLING();

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

	MFnNumericAttribute nAttr;
	MFnTypedAttribute   tAttr;

	aOutputValue    = nAttr.create( "outputValue", "outputValue", MFnNumericData::kInt, 1.0 );
	nAttr.setStorable( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputValue ) );
	CHECK_MSTATUS_AND_RETURN_IT( status );


	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputCurve ) );


	aLineWidth = nAttr.create( "lineWidth", "lineWidth", MFnNumericData::kInt, 1 );
	nAttr.setMin( 1 );
	nAttr.setKeyable( true );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aLineWidth ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputCurve, aOutputValue ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aLineWidth,  aOutputValue ) );


	return MS::kSuccess;
}
Exemplo n.º 23
0
//
// DESCRIPTION:
MStatus OSLNode::initialize()
{
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnGenericAttribute gAttr;
	MFnEnumAttribute eAttr;
	MFnMessageAttribute mAttr;

	MStatus status;

	color = nAttr.createColor("color", "color");
	MAKE_INPUT(nAttr);
	CHECK_MSTATUS(addAttribute( color ));

	script = tAttr.create("script", "script", MFnNumericData::kString);
	MAKE_INPUT(tAttr);
	CHECK_MSTATUS(addAttribute( script ));

	outColor = nAttr.createColor("outColor", "outColor");
	MAKE_OUTPUT(nAttr);
	CHECK_MSTATUS(addAttribute( outColor ));

//---------------------------- automatically created attributes start ------------------------------------
//---------------------------- automatically created attributes end ------------------------------------

	attributeAffects(color, outColor);
	attributeAffects(script, outColor);

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

	MFnNumericAttribute  nAttr;
	MFnTypedAttribute    tAttr;
	MFnCompoundAttribute cAttr;

	aInputs = cAttr.create( "inputs", "inputs" );

	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( false );
	aWeight = nAttr.create( "weight", "weight", MFnNumericData::kFloat, 1.0 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	aBlendPosition = nAttr.create( "blendPosition", "blendPosition", MFnNumericData::kFloat, 1.0 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	aBlendArea     = nAttr.create( "blendArea", "blendArea", MFnNumericData::kFloat, 0.5 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	cAttr.addChild( aInputCurve );
	cAttr.addChild( aWeight );
	cAttr.addChild( aBlendPosition );
	cAttr.addChild( aBlendArea );
	cAttr.setArray( true );

	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputs ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputs, outputGeom ) );

	return MS::kSuccess;
}
Exemplo n.º 25
0
MStatus MocapMesh::initialize()
{
	MStatus stat;

	MFnTypedAttribute tAttr;
	MFnNumericAttribute nAttr;

	in_inMesh  = tAttr.create("inMesh", "im",MFnData::kMesh);
	tAttr.setKeyable(true);
	tAttr.setStorable(true);
	tAttr.setReadable(true);
	tAttr.setWritable(true);
	stat = addAttribute(in_inMesh);
	if(!stat) { stat.perror("adding inMesh"); return stat; }

	out_message  = nAttr.create("test", "test", MFnNumericData::kDouble, 0.0);
	nAttr.setKeyable(false);
	nAttr.setStorable(false);
	nAttr.setWritable(false);
	nAttr.setReadable(true);
	stat = addAttribute(out_message);
	if(!stat) { stat.perror("adding test"); return stat; }

	stat = attributeAffects(in_inMesh,out_message);
	if(!stat) { stat.perror("attributeAffects"); return stat; }
	return MS::kSuccess;
}
Exemplo n.º 26
0
MStatus animCube::initialize()
{
	MFnUnitAttribute unitAttr;
	MFnTypedAttribute typedAttr;

	MStatus returnStatus;

	animCube::time = unitAttr.create( "time", "tm",
										  MFnUnitAttribute::kTime,
										  0.0, &returnStatus );
	McheckErr(returnStatus, "ERROR creating animCube time attribute\n");


	animCube::outputMesh = typedAttr.create( "outputMesh", "out",
												 MFnData::kMesh,
												 &returnStatus ); 
	McheckErr(returnStatus, "ERROR creating animCube output attribute\n");
	typedAttr.setStorable(false);

	returnStatus = addAttribute(animCube::time);
	McheckErr(returnStatus, "ERROR adding time attribute\n");

	returnStatus = addAttribute(animCube::outputMesh);
	McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

	returnStatus = attributeAffects(animCube::time,
								    animCube::outputMesh);
	McheckErr(returnStatus, "ERROR in attributeAffects\n");

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

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;

	aBlendMesh = tAttr.create("blendMesh", "blendMesh", MFnData::kMesh);
	addAttribute(aBlendMesh);
	
	aBlendMap = nAttr.createColor("blendMap", "blendMap");
	addAttribute(aBlendMap);

	aUseBlendMap = nAttr.create("useBlendMap", "useBlendMap", MFnNumericData::kBoolean);
	nAttr.setDefault(true);
	addAttribute(aUseBlendMap);

	aBlendMapMultiplier = nAttr.create("blendMapMultiplier", "blendMapMultiplier", MFnNumericData::kFloat);
	nAttr.setDefault(1.0);
	nAttr.setMin(0.0);
	addAttribute(aBlendMapMultiplier);
	
	attributeAffects(aBlendMesh, outputGeom);
	attributeAffects(aBlendMap, outputGeom);
	attributeAffects(aUseBlendMap, outputGeom);
	attributeAffects(aBlendMapMultiplier, outputGeom);

	MGlobal::executeCommand( "makePaintable -attrType multiFloat -sm deformer blendNode weights;" );

	return MS::kSuccess;
}
Exemplo n.º 28
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
// 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;
} 
Exemplo n.º 29
0
MStatus testNucleusNode::initialize()
{
	MStatus stat;

	MFnTypedAttribute tAttr;

	startState = tAttr.create("startState", "sst", MFnData::kNObject, MObject::kNullObj, &stat );

	statCheck(stat, "failed to create startState");
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	tAttr.setHidden(true);
    tAttr.setArray(true);


    currentState = tAttr.create("currentState", "cst", MFnData::kNObject, MObject::kNullObj, &stat );

	statCheck(stat, "failed to create currentState");
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	tAttr.setHidden(true);
    tAttr.setArray(true);
	

    nextState = tAttr.create("nextState", "nst", MFnData::kNObject, MObject::kNullObj, &stat );

	statCheck(stat, "failed to create nextState");
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	tAttr.setHidden(true);
    tAttr.setArray(true);

   	MFnUnitAttribute uniAttr;
	currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime,  0.0, &stat  );    	

	addAttribute(startState);
	addAttribute(currentState);
	addAttribute(nextState);
    addAttribute(currentTime);
	
	attributeAffects(startState, nextState);
	attributeAffects(currentState, nextState);	
    attributeAffects(currentTime, nextState);	

	return MStatus::kSuccess;
}
Exemplo n.º 30
0
MStatus AlembicCurvesLocatorNode::initialize()
{
  MStatus status;

  MFnUnitAttribute uAttr;
  MFnTypedAttribute tAttr;
  MFnNumericAttribute nAttr;
  MFnGenericAttribute gAttr;
  MFnStringData emptyStringData;
  MObject emptyStringObject = emptyStringData.create("");

  // input time
  mTimeAttr = uAttr.create("inTime", "tm", MFnUnitAttribute::kTime, 0.0);
  status = uAttr.setStorable(true);
  status = uAttr.setKeyable(true);
  status = addAttribute(mTimeAttr);

  // input file name
  mFileNameAttr =
      tAttr.create("fileName", "fn", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setUsedAsFilename(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mFileNameAttr);

  // input identifier
  mIdentifierAttr =
      tAttr.create("identifier", "if", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mIdentifierAttr);

  // sentinel attr
  mSentinelAttr = nAttr.create("sentinel", "sent", MFnNumericData::kInt, 0);
  nAttr.setHidden(true);
  status = addAttribute(mSentinelAttr);

  // create a mapping
  status = attributeAffects(mTimeAttr, mSentinelAttr);
  status = attributeAffects(mFileNameAttr, mSentinelAttr);
  status = attributeAffects(mIdentifierAttr, mSentinelAttr);

  return status;
}