#include <maya/MIOStream.h>
#include "latticeNoise.h"
#include <maya/MObject.h>
#include <maya/MFnLatticeDeformer.h>
#include <maya/MSelectionList.h>
#include <maya/MString.h>
#include <maya/MArgList.h>
#include <maya/MGlobal.h>
#include <maya/MItSelectionList.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MFnLattice.h>
#include <maya/MDGModifier.h>
#define McheckErr(stat,msg) \
if ( MS::kSuccess != stat ) { \
cerr << msg << endl; \
return MS::kFailure; \
}
void* latticeNoiseCmd::creator()
{
return new latticeNoiseCmd();
}
{
unsigned last = args.
length();
for ( unsigned i = 0; i < last; i++ ) {
res = args.
get( i, argStr );
McheckErr( res, "Invalid argument type" );
res = list.
add( argStr );
McheckErr( res, "Invalid object" );
}
} else {
}
McheckErr( res, "Deformer creation failed" );
!iter.
isDone(); iter.next() ) {
iter.getDependNode( geomObj );
}
McheckErr( res, "Lattice noise node creation failed" );
attrName.
set(
"output" );
attrName.
set(
"deformedLatticePoints" );
McheckErr( res, "Could not get the deformed lattice node" );
MFnLattice latticeShapeFn( deformedLattice, &res );
attrName.
set(
"latticeOutput" );
MObject sourceLattAttr = latticeShapeFn.attribute( attrName );
res = modifier.
disconnect( deformedLattice, sourceLattAttr,
deformNode, destLattAttr );
McheckErr( res, "Could not disconnect nodes" );
modifier.
connect( deformedLattice, sourceLattAttr,
noiseNode, inputAttr );
modifier.
connect( noiseNode, outputAttr,
deformNode, destLattAttr );
McheckErr( res, "Could not get the time node" );
attrName.
set(
"outTime" );
MObject timeOutAttr = timeFn.attribute( attrName );
modifier.
connect( timeNode, timeOutAttr,
noiseNode, timeAttr );
McheckErr( res, "Error changing deformer graph connections" );
MString name = latticeShapeFn.name();
return res;
}