#include <maya/MIOStream.h>
#include <math.h>
#include "simpleSpring.h"
#include <maya/MFnDependencyNode.h>
#include <maya/MFnNumericAttribute.h>
MObject simpleSpring::aSpringFactor;
MTypeId simpleSpring::id( 0x80017 );
simpleSpring::simpleSpring()
: factor(0.0)
{
}
simpleSpring::~simpleSpring()
{
}
void *simpleSpring::creator()
{
return new simpleSpring;
}
{
status = addAttribute( aSpringFactor );
McheckErr(status, "ERROR adding aSpringFactor attribute.\n");
return( MS::kSuccess );
}
{
factor = springFactor( block );
return( MS::kUnknownParameter );
}
MStatus simpleSpring::applySpringLaw
(
double , double , double restLength,
double , double ,
)
{
double F = factor * (L - restLength);
forceV1 = - F * distV;
forceV2 = - forceV1;
return( MS::kSuccess );
}
{
MFnPlugin plugin(obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerNode( "simpleSpring", simpleSpring::id,
&simpleSpring::creator, &simpleSpring::initialize,
if (!status) {
status.
perror(
"registerNode");
return status;
}
return status;
}
{
status = plugin.deregisterNode( simpleSpring::id );
if (!status) {
status.
perror(
"deregisterNode");
return status;
}
return status;
}