#include <maya/MPxCommand.h>
#include <maya/MStatus.h>
#include <maya/MArgList.h>
#include <maya/MFnPlugin.h>
#include <maya/MObject.h>
#include <maya/MGlobal.h>
#include <maya/MDagPath.h>
#include <maya/MItSelectionList.h>
#include <maya/MSelectionList.h>
#include <maya/MString.h>
#include <maya/MPoint.h>
#include <maya/MItCurveCV.h>
#include <maya/MItSurfaceCV.h>
#include <maya/MItMeshVertex.h>
#include <maya/MIOStream.h>
{
public:
cvPos();
virtual ~cvPos();
static void* creator();
private:
};
cvPos::cvPos() :
point(0.0, 0.0, 0.0)
{
}
cvPos::~cvPos() {}
void* cvPos::creator()
{
return new cvPos;
}
bool cvPos::isUndoable() const
{
return true;
}
{
}
{
for (
unsigned int i = 0; i < args.
length (); i++)
{
else
componentName = argStr;
}
if (!componentName.
length ()) {
if (iter.isDone ()) {
displayError ("No components selected");
} else {
iter.getDagPath (dagPath, component);
iter.next ();
if (!iter.isDone ()) {
displayError ("More than one component is selected");
}
}
} else {
if (! list.
add( componentName ) ) {
componentName += ": no such component";
displayError(componentName);
}
iter.getDagPath( dagPath, component );
}
displayError("not a component");
}
{
point = curveCVIter.position(transformSpace );
curveCVIter.next();
if (!curveCVIter.isDone()) {
displayError ("More than one component is selected");
}
break;
}
{
point = surfCVIter.position(transformSpace );
surfCVIter.next();
if (!surfCVIter.isDone()) {
displayError ("More than one component is selected");
}
break;
}
{
point = vertexIter.position(transformSpace );
vertexIter.next();
if (!vertexIter.isDone()) {
displayError ("More than one component is selected");
}
break;
}
default:
cerr <<
"Selected unsupported type: (" << component.
apiType()
}
return redoIt();
}
{
clearResult();
appendToResult( point.x );
appendToResult( point.y );
appendToResult( point.z );
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerCommand( "cvPos", cvPos::creator );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "cvPos" );
if (!status) {
status.
perror(
"deregisterCommand");
return status;
}
return status;
}