#include "meshOpNode.h"
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnMeshData.h>
#include <maya/MFnComponentListData.h>
#include <maya/MFnSingleIndexedComponent.h>
#include <maya/MFnEnumAttribute.h>
#include <maya/MGlobal.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MIOStream.h>
#define MCheckStatus(status,message) \
if( MStatus::kSuccess != status ) { \
cerr << message << "\n"; \
return status; \
}
MTypeId meshOpNode::id( 0x00085000 );
meshOpNode::meshOpNode()
{}
meshOpNode::~meshOpNode()
{}
{
MCheckStatus( status, "ERROR getting state" );
{
MCheckStatus(status,"ERROR getting inMesh");
MCheckStatus(status,"ERROR getting outMesh");
}
else
{
if (plug == outMesh)
{
MCheckStatus(status,"ERROR getting inMesh");
MCheckStatus(status,"ERROR getting outMesh");
MCheckStatus(status,"ERROR getting componentList");
MCheckStatus(status,"ERROR getting opType");
MeshOperation operationType = (MeshOperation) opTypeData.
asShort();
meshOpFty::getExpectedComponentType(operationType);
unsigned i;
int j;
for( i = 0; i < compListFn.length(); i++ )
{
if( comp.
apiType() == componentType )
{
for( j = 0; j < siComp.elementCount(); j++ )
cpIds.
append( siComp.element(j) );
}
}
fmeshOpFactory.setMesh( mesh );
fmeshOpFactory.setComponentList( compList );
fmeshOpFactory.setComponentIDs( cpIds );
fmeshOpFactory.setMeshOperation( operationType );
status = fmeshOpFactory.doIt();
}
else
{
}
}
return status;
}
void* meshOpNode::creator()
{
return new meshOpNode();
}
{
cpList = attrFn.
create(
"inputComponents",
"ics",
opType = enumFn.
create(
"operationType",
"oprt", 0, &status);
status = addAttribute( cpList );
if (!status)
{
status.
perror(
"addAttribute");
return status;
}
status = addAttribute( opType );
if (!status)
{
status.
perror(
"addAttribute");
return status;
}
status = addAttribute( inMesh );
if (!status)
{
status.
perror(
"addAttribute");
return status;
}
status = addAttribute( outMesh);
if (!status)
{
status.
perror(
"addAttribute");
return status;
}
status = attributeAffects( inMesh, outMesh );
if (!status)
{
status.
perror(
"attributeAffects");
return status;
}
status = attributeAffects( cpList, outMesh );
if (!status)
{
status.
perror(
"attributeAffects");
return status;
}
status = attributeAffects( opType, outMesh );
if (!status)
{
status.
perror(
"attributeAffects");
return status;
}
}