MStatus SwirlDeformer::initialize()
{
MFnMatrixAttribute mAttr;
deformSpace = mAttr.create( "deformSpace", "dSp" );
mAttr.setStorable( false );

MFnUnitAttribute unitFn;    
startDist = unitFn.create( "startDist", "sd", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );

endDist = unitFn.create( "endDist", "ed", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 3.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );

addAttribute( deformSpace );
addAttribute( startDist );
addAttribute( endDist );

attributeAffects( deformSpace, outputGeom );
attributeAffects( startDist, outputGeom );
attributeAffects( endDist, outputGeom );

return MS::kSuccess;
}
MStatus BasicLocator::initialize()
{ 
MFnUnitAttribute unitFn;    
MFnNumericAttribute numFn;
MStatus stat;
    
xWidth = unitFn.create( "xWidth", "xw", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance(1.0, MDistance::uiUnit()) );
unitFn.setMin( MDistance(0.0, MDistance::uiUnit()) );
unitFn.setKeyable( true );
stat = addAttribute( xWidth );
if (!stat) 
    {
	stat.perror( "Unable to add \"xWidth\" attribute" );
	return stat;
    } 

zWidth = unitFn.create( "zWidth", "zw", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance(1.0, MDistance::uiUnit()) );
unitFn.setMin( MDistance(0.0, MDistance::uiUnit()) );
unitFn.setKeyable( true );
stat = addAttribute( zWidth );
if (!stat) 
    {
	stat.perror( "Unable to add \"zWidth\" attribute" );
	return stat;
    } 

dispType = numFn.create( "dispType", "att", MFnNumericData::kShort );
numFn.setDefault( 0);
numFn.setMin( 0 );
numFn.setMax( 2 );
numFn.setKeyable( true );
stat = addAttribute( dispType );
if (!stat) 
    {
	stat.perror( "Unable to add \"dispType\" attribute" );
	return stat;
    }

// Notify Maya that there is an associated manipulator for this particular type of node
MPxManipContainer::addToManipConnectTable( const_cast<MTypeId &>( typeId ) );

return MS::kSuccess;
}
Beispiel #3
0
MStatus kgLocator::initialize()

{
	

	MFnUnitAttribute  unitFn;
	MStatus stat;
	
	//Let us inherit the attributes,
	//in case we need it
	MString parentClass("MPxLocatorNode");
	stat = inheritAttributesFrom( parentClass );
	
	//Create the height attribute
	height = unitFn.create( "height", "h", MFnUnitAttribute::kDistance );
	unitFn.setDefault( MDistance( 2.0,  MDistance::uiUnit() ) );
	unitFn.setMin( MDistance( 0.0,  MDistance::uiUnit() ) );	
	stat = addAttribute( height );
	if (!stat )
	{
		stat.perror( "Unable to add \"height\" attribute");
		return stat;
		
	}


	//generates points for drwing the locator
	getPoints( pts );
	
	
	// Notify Maya that there is an associated manipulator for this particular type of node
	MPxManipContainer::addToManipConnectTable( const_cast<MTypeId &>( id ) );
	
	return MS::kSuccess;
	
}
Beispiel #4
0
MDistance convert( const float &from )
{
	return MDistance( from, MDistance::kCentimeters );
}
Beispiel #5
0
MDistance convert( const double &from )
{
	return MDistance( from, MDistance::kCentimeters );
}