#include "util.h"
#include "PointHelper.h"
#include "NodeIteratorVisitorHelper.h"
#include <maya/MString.h>
#include <maya/MPoint.h>
#include <maya/MPointArray.h>
#include <maya/MVector.h>
#include <maya/MGlobal.h>
#include <maya/MVectorArray.h>
#include <maya/MFnParticleSystem.h>
MStatus read(
double iFrame,
const Alembic::AbcGeom::IPoints & iNode,
{
printWarning("Reading animated particle data not supported.");
return status;
}
MStatus create(
double iFrame,
const Alembic::AbcGeom::IPoints & iNode,
{
Alembic::AbcGeom::IPointsSchema schema = iNode.getSchema();
if (schema.getNumSamples() == 0)
{
return status;
}
Alembic::AbcGeom::IPointsSchema::Sample samp;
Alembic::AbcCoreAbstract::index_t index =
schema.getTimeSampling()->getNearIndex(
iFrame, schema.getNumSamples()).first;
schema.get(samp, index);
size_t pSize = samp.getPositions()->size();
if (pSize == 0)
{
return status;
}
iObject = fnParticle.
create(iParent, &status);
fnParticle.
setName(iNode.getName().c_str());
Alembic::Abc::P3fArraySamplePtr v3ptr = samp.getPositions();
for (unsigned int pId = 0; pId < pSize; pId++)
{
pArray.
append((*v3ptr)[pId].x,
(*v3ptr)[pId].y,
(*v3ptr)[pId].z);
}
status = fnParticle.
emit(pArray);
return status;
}