#include <maya/MIOStream.h>
#include <maya/MPxCommand.h>
#include <maya/MFnPlugin.h>
#include <maya/MArgList.h>
#include <maya/MUintArray.h>
#include <maya/MSelectionList.h>
#include <maya/MGlobal.h>
#include <maya/MPlug.h>
#include <maya/MPolyMessage.h>
#include <maya/MDagPath.h>
#include <maya/MCallbackIdArray.h>
void userCB(
MUintArray componentIds[],
unsigned int count,
void *clientData )
{
cout << "poly component id modified";
cout << endl;
return;
unsigned int i, id;
for ( i = 0; i < vertexIds.
length(); i++ )
{
id = vertexIds[i];
if ( id == kDeletedId )
cout << "vertex " << i << " deleted" << endl;
else if ( i != id )
cout << "vertex " << i << " " << id << endl;
}
for ( i = 0; i < edgeIds.
length(); i++ )
{
id = edgeIds[i];
if ( id == kDeletedId )
cout << "edge " << i << " deleted" << endl;
else if ( i != id )
cout << "edge " << i << " " << id << endl;
}
for ( i = 0; i < faceIds.
length(); i++ )
{
id = faceIds[i];
if ( id == kDeletedId )
cout << "face " << i << " deleted" << endl;
else if ( i != id )
cout << "face " << i << " " << id << endl;
}
}
{
public:
polyMessageCmd() {};
virtual ~polyMessageCmd();
static void* creator();
};
polyMessageCmd::~polyMessageCmd() {}
void* polyMessageCmd::creator()
{
return new polyMessageCmd();
}
{
MCallbackId id;
for (
unsigned int i=0; i<list.
length(); i++ )
{
bool wantIdChanges[3];
wantIdChanges, 3,
userCB,
NULL,
&stat);
if ( stat ) {
} else {
cout << "MPolyMessage.addCallback failed\n";
}
}
return stat;
}
{
MFnPlugin plugin(obj, PLUGIN_COMPANY,
"6.0",
"Any");
return plugin.registerCommand( "polyMessage", polyMessageCmd::creator );
}
{
for (
unsigned int i=0; i<callbackIds.
length(); i++ ) {
}
return plugin.deregisterCommand( "polyMessage" );
}