#include "testNsolverNode.h"
#include <maya/MIOStream.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MGlobal.h>
#include <maya/MTime.h>
#include <maya/MFnMesh.h>
#include <maya/MFnMeshData.h>
#include <maya/MFnUnitAttribute.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnIntArrayData.h>
#include <maya/MFnComponentListData.h>
#include <maya/MFnSingleIndexedComponent.h>
#include <maya/MDagPath.h>
#include <maya/MPoint.h>
#include <maya/MFloatPointArray.h>
#include <maya/MItMeshVertex.h>
#include <maya/MFnPlugin.h>
#include <math.h>
const MTypeId testNsolverNode::id( 0x85005 );
#include <maya/MFnNObjectData.h>
#include <maya/MnCloth.h>
MObject testNsolverNode::startState;
MObject testNsolverNode::currentState;
MObject testNsolverNode::nextState;
MObject testNsolverNode::currentTime;
{
if ( !stat )
{
cout<<msg<<"\n";
}
}
testNsolverNode::testNsolverNode()
{
solver.createNSolver();
solver.setGravity(9.8f);
solver.setStartTime((float)(1.0/24.0));
}
{
if ( plug == nextState )
{
if(currTime.
value() <= 1.0) {
cerr << "multi handle elementcount = " << count << "\n";
solver.removeAllCollisions();
for (int i = 0; i < count; i++) {
inputNData.getObjectPtr(nObj);
solver.removeNObject(nObj);
solver.addNObject(nObj);
delete nObj;
}
solver.makeAllCollide();
} else {
for (int i = 0; i < count; i++) {
inputNData.getObjectPtr(nObj);
delete nObj;
}
}
solver.setGravity(9.8f);
solver.setGravityDir(0.0f, -1.0f, 0.0f);
solver.setAirDensity(1.0f);
solver.setWindSpeed(0.0f);
solver.setWindDir(0.0f, 1.0f, 0.0f);
solver.setWindNoiseIntensity(0.0f);
solver.setDisabled(false);
solver.setSubsteps(3);
solver.solve(solveTime);
}
else if ( plug == currentState )
{
}
else if (plug == startState) {
}
else {
}
return stat;
}
MStatus testNsolverNode::initialize()
{
statCheck(stat, "failed to create startState");
statCheck(stat, "failed to create currentState");
statCheck(stat, "failed to create nextState");
addAttribute(startState);
addAttribute(currentState);
addAttribute(nextState);
addAttribute(currentTime);
attributeAffects(startState, nextState);
attributeAffects(currentState, nextState);
attributeAffects(currentTime, nextState);
}
{
MFnPlugin plugin(obj,
"Autodesk - nCloth Prototype 4",
"8.5",
"Any");
status = plugin.registerNode ( "testNsolverNode", testNsolverNode::id,testNsolverNode ::creator, testNsolverNode::initialize );
if ( !status )
{
status.
perror(
"registerNode");
return status;
}
return status;
}
{
status = plugin.deregisterNode(testNsolverNode::id);
if ( !status )
{
status.
perror(
"deregisterNode");
return status;
}
return status;
}