MStatus arrowLocator::initialize()
{
	//Here we create a new attribute type that handles units: angle, distance or time
	MFnUnitAttribute uAttr;
	windDirection = uAttr.create("windDirection", "wd", MFnUnitAttribute::kAngle, 0.0);
	uAttr.setStorable(true);
	uAttr.setWritable(true);
	uAttr.setReadable(true);
	uAttr.setKeyable(true);

	uAttr.setDefault(MAngle(0.0, MAngle::kDegrees));

	addAttribute(windDirection);

	//- TODO: To make connection between your custom node and your custom 
	//- TODO: manipulator node, you need to name your custom manipulator 
	//- TODO: after your custom node type name, also in your custom node's initialize()
	//- TODO: function, you need to call MPxManipContainer::addToManipConnectTable().
	//- TODO: This method adds the user defined node as an entry in the manipConnectTable 
	//- TODO: so that when this node is selected the user can use the show manip tool to 
	//- TODO: get the user defined manipulator associated with this node.
	//...

	return MS::kSuccess;
}
Exemplo n.º 2
0
MStatus simpleEvaluationNode::initialize()
{
	MFnNumericAttribute nAttr;
	MFnUnitAttribute    uAttr;
	MStatus				status;

	input = nAttr.create( "input", "in", MFnNumericData::kFloat, 2.0 );
 	nAttr.setStorable(true);

	aTimeInput = uAttr.create( "inputTime", "itm", MFnUnitAttribute::kTime, 0.0 );
	uAttr.setWritable(true);
	uAttr.setStorable(true);
    uAttr.setReadable(true);
    uAttr.setKeyable(true);

	output = nAttr.create( "output", "out", MFnNumericData::kFloat, 0.0 );
	nAttr.setWritable(false);
	nAttr.setStorable(false);

	status = addAttribute( input );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( aTimeInput );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( output );
		if (!status) { status.perror("addAttribute"); return status;}

	status = attributeAffects( input, output );
		if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( aTimeInput, output );
		if (!status) { status.perror("attributeAffects"); return status;}

	return MS::kSuccess;
}
//- The initialize 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
//-
/*static*/ MStatus arrowLocator::initialize()
{
	//- Here we create a new attribute type that handles units: angle, distance or time
	MFnUnitAttribute uAttr;
	windDirection = uAttr.create("windDirection", "wd", MFnUnitAttribute::kAngle, 0.0);
	uAttr.setStorable(true);
	uAttr.setWritable(true);
	uAttr.setReadable(true);
	uAttr.setKeyable(true);
	uAttr.setMin(0.0);
	uAttr.setMax(2*PI);
	uAttr.setDefault(MAngle(0.0, MAngle::kRadians));
	addAttribute(windDirection);

	return MS::kSuccess;
}
//- The initialize 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
//-
/*static*/ MStatus arrowLocator::initialize()
{
	//- Here we create a new attribute type that handles units: angle, distance or time
	MFnUnitAttribute uAttr;
	//- TODO: Create a angle attribute with long name "windDirection" and short name "wd"
	windDirection = //...
	uAttr.setStorable(true);
	uAttr.setWritable(true);
	uAttr.setReadable(true);
	uAttr.setKeyable(true);
	//- TODO: Set the min and max value this attribute can have 0, 2PI
	//...
	//...
	uAttr.setDefault(MAngle(0.0, MAngle::kRadians));
	addAttribute(windDirection);

	return MS::kSuccess;
}
Exemplo n.º 5
0
//
//  Initialize the node
//
MStatus jhMeshBlur::initialize()
{
    // attribute types
    MFnUnitAttribute    unitAttr;
    MFnNumericAttribute	nAttr;
    MFnTypedAttribute   tAttr;

    aOldMeshData = tAttr.create("oldMesh","om",MFnData::kPointArray);
    tAttr.setArray(true);
    tAttr.setHidden(true);
    tAttr.setIndexMatters(true);

    // create the attributes
    aStrength = nAttr.create( "Strength", "str", MFnNumericData::kFloat,1.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);
    nAttr.setMax(1.0);
    nAttr.setMin(0.0);

    aTreshhold = nAttr.create( "Treshold", "tres", MFnNumericData::kFloat,0.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);
    nAttr.setMin(0.0);

    aShapeFactor = nAttr.create( "ShapeFactor", "shapef", MFnNumericData::kFloat,0.5);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);
    nAttr.setMax(1.0);
    nAttr.setMin(0.0);

    aTweakBlur = nAttr.create( "TweakBlur", "tweak", MFnNumericData::kBoolean,false);
    nAttr.setKeyable(false);
    nAttr.setChannelBox(true);

    aQuadInterp = nAttr.create( "QuadInterpolation", "qi", MFnNumericData::kBoolean,true);
    nAttr.setKeyable(false);
    nAttr.setChannelBox(true);

    aInterpPower = nAttr.create( "InterpolationPower", "interp", MFnNumericData::kDouble, 0.75);
    nAttr.setKeyable(true);
    nAttr.setMax(1.0);
    nAttr.setMin(0.0);

    aTime = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 1.0 );
    unitAttr.setStorable(true);
    unitAttr.setCached(true);
	unitAttr.setReadable(true);
	unitAttr.setWritable(true);
	unitAttr.setAffectsAppearance(true);
	unitAttr.setAffectsWorldSpace(true);

    // Make the attributes visible to the user
    addAttribute( aStrength);
    addAttribute( aTreshhold);
    addAttribute( aTime);
    addAttribute( aTweakBlur);
    addAttribute( aQuadInterp);
    addAttribute( aInterpPower);
    addAttribute( aOldMeshData);

    // Make sure when an attribute changes, the node updates
    attributeAffects( aTime, outputGeom );
	attributeAffects( aStrength, outputGeom );
    attributeAffects( aTreshhold, outputGeom );
    attributeAffects( aQuadInterp, outputGeom );
    attributeAffects( aInterpPower, outputGeom );

    // Not implented yet, but make the weights paintable :)
    MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer jhMeshBlur weights;");

    return MStatus::kSuccess;
}