本文整理汇总了C++中MDoubleArray::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ MDoubleArray::insert方法的具体用法?C++ MDoubleArray::insert怎么用?C++ MDoubleArray::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDoubleArray
的用法示例。
在下文中一共展示了MDoubleArray::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doIt
MStatus particlePathsCmd::doIt( const MArgList& args )
{
MStatus stat = parseArgs( args );
if( stat != MS::kSuccess )
{
return stat;
}
MFnParticleSystem cloud( particleNode );
if( ! cloud.isValid() )
{
MGlobal::displayError( "The function set is invalid!" );
return MS::kFailure;
}
//
// Create curves from the particle system in two stages. First, sample
// all particle positions from the start time to the end time. Then,
// use the data that was collected to create curves.
//
// Create the particle hash table at a fixed size. This should work fine
// for small particle systems, but may become inefficient for larger ones.
// If the plugin is running very slow, increase the size. The value should
// be roughly the number of particles that are expected to be emitted
// within the time period.
//
ParticleIdHash hash(1024);
MIntArray idList;
//
// Stage 1
//
MVectorArray positions;
MIntArray ids;
int i = 0;
for (double time = start; time <= finish + TOLERANCE; time += increment)
{
MTime timeSeconds(time,MTime::kSeconds);
// It is necessary to query the worldPosition attribute to force the
// particle positions to update.
//
cloud.evaluateDynamics(timeSeconds,false);
// MGlobal::executeCommand(MString("getAttr ") + cloud.name() +
// MString(".worldPosition"));
if (!cloud.isValid())
{
MGlobal::displayError( "Particle system has become invalid." );
return MS::kFailure;
}
MGlobal::displayInfo( MString("Received ") + (int)(cloud.count()) +
" particles, at time " + time);
// Request position and ID data for particles
//
cloud.position( positions );
cloud.particleIds( ids );
if (ids.length() != cloud.count() || positions.length() != cloud.count())
{
MGlobal::displayError( "Invalid array sizes." );
return MS::kFailure;
}
for (int j = 0; j < (int)cloud.count(); j++)
{
// Uncomment to show particle positions as the plugin accumulates
// samples.
/*
MGlobal::displayInfo(MString("(") + (positions[j])[0] + MString(",") +
(positions[j])[1] + MString(",") + (positions[j])[2] + MString(")"));
*/
MPoint pt(positions[j]);
if (hash.getPoints(ids[j]).length() == 0)
{
idList.append(ids[j]);
}
hash.insert(ids[j],pt);
}
i++;
}
//
// Stage 2
//
for (i = 0; i < (int)(idList.length()); i++)
{
MPointArray points = hash.getPoints(idList[i]);
// Don't bother with single samples
if (points.length() <= 1)
{
//.........这里部分代码省略.........