本文整理汇总了C++中MItDag::currentItem方法的典型用法代码示例。如果您正苦于以下问题:C++ MItDag::currentItem方法的具体用法?C++ MItDag::currentItem怎么用?C++ MItDag::currentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MItDag
的用法示例。
在下文中一共展示了MItDag::currentItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBoundingBox
MBoundingBox AbcWriteJob::getBoundingBox(double iFrame, const MMatrix & eMInvMat)
{
MStatus status;
MBoundingBox curBBox;
if (iFrame == mFirstFrame)
{
// Set up bbox shape map in the first frame.
// If we have a lot of transforms and shapes, we don't need to
// iterate them for each frame.
MItDag dagIter;
for (dagIter.reset(mCurDag); !dagIter.isDone(); dagIter.next())
{
MObject object = dagIter.currentItem();
MDagPath path;
dagIter.getPath(path);
// short-circuit if the selection flag is on but this node is not in the
// active selection
// MGlobal::isSelected(ob) doesn't work, because DG node and DAG node is
// not the same even if they refer to the same MObject
if (mArgs.useSelectionList && !mSList.hasItem(path))
{
dagIter.prune();
continue;
}
MFnDagNode dagNode(path, &status);
if (status == MS::kSuccess)
{
// check for riCurves flag for flattening all curve object to
// one curve group
MPlug riCurvesPlug = dagNode.findPlug("riCurves", &status);
if ( status == MS::kSuccess && riCurvesPlug.asBool() == true)
{
MBoundingBox box = dagNode.boundingBox();
box.transformUsing(path.exclusiveMatrix()*eMInvMat);
curBBox.expand(box);
// Prune this curve group
dagIter.prune();
// Save children paths
std::map< MDagPath, util::ShapeSet, util::cmpDag >::iterator iter =
mBBoxShapeMap.insert(std::make_pair(mCurDag, util::ShapeSet())).first;
if (iter != mBBoxShapeMap.end())
(*iter).second.insert(path);
}
else if (object.hasFn(MFn::kParticle)
|| object.hasFn(MFn::kMesh)
|| object.hasFn(MFn::kNurbsCurve)
|| object.hasFn(MFn::kNurbsSurface) )
{
if (util::isIntermediate(object))
continue;
MBoundingBox box = dagNode.boundingBox();
box.transformUsing(path.exclusiveMatrix()*eMInvMat);
curBBox.expand(box);
// Save children paths
std::map< MDagPath, util::ShapeSet, util::cmpDag >::iterator iter =
mBBoxShapeMap.insert(std::make_pair(mCurDag, util::ShapeSet())).first;
if (iter != mBBoxShapeMap.end())
(*iter).second.insert(path);
}
}
}
}
else
{
// We have already find out all the shapes for the dag path.
std::map< MDagPath, util::ShapeSet, util::cmpDag >::iterator iter =
mBBoxShapeMap.find(mCurDag);
if (iter != mBBoxShapeMap.end())
{
// Iterate through the saved paths to calculate the box.
util::ShapeSet& paths = (*iter).second;
for (util::ShapeSet::iterator pathIter = paths.begin();
pathIter != paths.end(); pathIter++)
{
MFnDagNode dagNode(*pathIter, &status);
if (status == MS::kSuccess)
{
MBoundingBox box = dagNode.boundingBox();
box.transformUsing((*pathIter).exclusiveMatrix()*eMInvMat);
curBBox.expand(box);
}
}
}
}
return curBBox;
}