#include <math.h>
#include <maya/MIOStream.h>
#include <maya/MFnPlugin.h>
#include <apiSimpleShape.h>
#include <apiSimpleShapeUI.h>
#include <apiSimpleShapeIterator.h>
MTypeId apiSimpleShape::id( 0x8009a );
apiSimpleShape::apiSimpleShape() {}
apiSimpleShape::~apiSimpleShape() {}
void* apiSimpleShape::creator()
{
return new apiSimpleShape();
}
MStatus apiSimpleShape::initialize()
{
return MS::kSuccess;
}
MPxGeometryIterator* apiSimpleShape::geometryIteratorSetup(MObjectArray& componentList,
MObject& components,
bool forReadOnly )
{
apiSimpleShapeIterator * result = NULL;
if ( components.isNull() )
{
result = new apiSimpleShapeIterator( getControlPoints(), componentList );
}
else
{
result = new apiSimpleShapeIterator( getControlPoints(), components );
}
return result;
}
bool apiSimpleShape::acceptsGeometryIterator( bool writeable )
{
return true;
}
bool apiSimpleShape::acceptsGeometryIterator( MObject&, bool writeable, bool forReadOnly )
{
return true;
}
MStatus initializePlugin( MObject obj )
{
MFnPlugin plugin( obj, PLUGIN_COMPANY, "5.0", "Any");
MStatus stat = plugin.registerShape( "apiSimpleShape", apiSimpleShape::id,
&apiSimpleShape::creator,
&apiSimpleShape::initialize,
&apiSimpleShapeUI::creator );
if ( ! stat ) {
cerr << "Failed to register shape\n";
}
return stat;
}
MStatus uninitializePlugin( MObject obj)
{
MFnPlugin plugin( obj );
MStatus stat;
stat = plugin.deregisterNode( apiSimpleShape::id );
if ( ! stat ) {
cerr << "Failed to deregister shape : apiSimpleShape \n";
}
return stat;
}