#include <maya/MGlobal.h>
#include <maya/MString.h>
#include <maya/MPointArray.h>
#include <maya/MVectorArray.h>
#include <maya/MDoubleArray.h>
#include <maya/MIntArray.h>
#include <maya/MArgList.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MSelectionList.h>
#include <maya/MPxCommand.h>
#include <maya/MFnParticleSystem.h>
#include <maya/MFnPlugin.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MSyntax.h>
#include <maya/MArgDatabase.h>
#include <maya/MTime.h>
#include <maya/MAnimControl.h>
#include "particleIdHash.h"
static const char *startFlag = "-s";
static const char *startLongFlag = "-start";
static const char *finishFlag = "-f";
static const char *finishLongFlag = "-finish";
static const char *incrementFlag = "-i";
static const char *incrementLongFlag = "-increment";
static const double TOLERANCE = 1e-10;
{
public:
particlePathsCmd();
~particlePathsCmd() override;
static void* creator();
private:
private:
double start,finish,increment;
};
particlePathsCmd::particlePathsCmd() : start(0.0),finish(0.0),increment(0.0)
{
}
particlePathsCmd::~particlePathsCmd()
{
}
MSyntax particlePathsCmd::newSyntax() {
return syntax;
}
{
if (argData.isFlagSet(startFlag))
{
argData.getFlagArgument(startFlag, 0, start);
}
if (argData.isFlagSet(finishFlag))
{
argData.getFlagArgument(finishFlag, 0, finish);
}
if (argData.isFlagSet(incrementFlag))
{
argData.getFlagArgument(incrementFlag, 0, increment);
}
if (finish <= start || increment <= 0.0)
{
return MS::kFailure;
}
argData.getObjects(selectList);
{
return MS::kFailure;
}
else if( selectList.
length() > 1 )
{
return MS::kFailure;
}
{
return MS::kFailure;
}
return MS::kSuccess;
}
{
if( stat != MS::kSuccess )
{
return stat;
}
if( ! cloud.isValid() )
{
return MS::kFailure;
}
ParticleIdHash hash(1024);
int i = 0;
for (double time = start; time <= finish + TOLERANCE; time += increment)
{
cloud.evaluateDynamics(timeSeconds,false);
if (!cloud.isValid())
{
return MS::kFailure;
}
" particles, at time " + time);
cloud.position( positions );
cloud.particleIds( ids );
if (ids.
length() != cloud.count() || positions.
length() != cloud.count())
{
return MS::kFailure;
}
for (int j = 0; j < (int)cloud.count(); j++)
{
if (hash.getPoints(ids[j]).length() == 0)
{
}
hash.insert(ids[j],pt);
}
i++;
}
for (i = 0; i < (int)(idList.
length()); i++)
{
{
continue;
}
MPoint p1 = points[0]*2 - points[1];
MPoint p2 = points[points.length()-1]*2 - points[points.length()-2];
points.insert(p1,0);
points.append(p2);
for (int j = 0; j < (int)(points.length()); j++)
{
}
knots.
append(points.length()-1);
if (!status)
{
return MS::kFailure;
}
}
return MS::kSuccess;
}
void * particlePathsCmd::creator() { return new particlePathsCmd(); }
{
MFnPlugin plugin(obj, PLUGIN_COMPANY,
"6.0",
"Any");
MStatus status = plugin.registerCommand(
"particlePaths",
particlePathsCmd::creator,
particlePathsCmd::newSyntax);
if (!status)
status.
perror(
"registerCommand");
return status;
}
{
MStatus status = plugin.deregisterCommand(
"particlePaths");
if (!status)
status.
perror(
"deregisterCommand");
return status;
}