dynExprField.h
#include <maya/MIOStream.h>
#include <maya/MVector.h>
#include <maya/MObject.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MFnPlugin.h>
#include <maya/MPxFieldNode.h>
#if defined(OSMac_MachO_)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#define McheckErr(stat, msg) \
if ( MS::kSuccess != stat ) \
{ \
cerr << msg; \
return MS::kFailure; \
}
class dynExprField: public MPxFieldNode
{
public:
dynExprField() {};
virtual ~dynExprField() {};
static void *creator();
static MStatus initialize();
virtual MStatus compute( const MPlug& plug, MDataBlock& block );
virtual MStatus iconSizeAndOrigin( GLuint& width,
GLuint& height,
GLuint& xbo,
GLuint& ybo );
virtual MStatus iconBitmap(GLubyte* bitmap);
static MObject mDirection;
static MTypeId id;
private:
double magnitude(MDataBlock& block);
MVector direction(MDataBlock& block);
void apply(MDataBlock &block,
int receptorSize,
const MDoubleArray &magnitudeArray,
const MDoubleArray &magnitudeOwnerArray,
const MVectorArray &directionArray,
const MVectorArray &directionOwnerArray,
MVectorArray &outputForce);
};