本文整理汇总了C++中MDagPath::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagPath::pop方法的具体用法?C++ MDagPath::pop怎么用?C++ MDagPath::pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagPath
的用法示例。
在下文中一共展示了MDagPath::pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetShapeNode
MStatus GetShapeNode(MDagPath& path, bool intermediate) {
MStatus status;
if (IsShapeNode(path)) {
// Start at the transform so we can honor the intermediate flag.
path.pop();
}
if (path.hasFn(MFn::kTransform)) {
unsigned int shapeCount = path.childCount();
for (unsigned int i = 0; i < shapeCount; ++i) {
status = path.push(path.child(i));
CHECK_MSTATUS_AND_RETURN_IT(status);
if (!IsShapeNode(path)) {
path.pop();
continue;
}
MFnDagNode fnNode(path, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
if ((!fnNode.isIntermediateObject() && !intermediate) ||
(fnNode.isIntermediateObject() && intermediate)) {
return MS::kSuccess;
}
// Go to the next shape
path.pop();
}
}
// No valid shape node found.
return MS::kFailure;
}
示例2: getShapeNode
MStatus sgCurveEditBrush_context::getShapeNode( MDagPath& path )
{
MStatus status;
if ( path.apiType() == MFn::kNurbsCurve )
{
return MS::kSuccess;
}
unsigned int numShapes;
status = path.numberOfShapesDirectlyBelow( numShapes );
CHECK_MSTATUS_AND_RETURN_IT( status );
for ( unsigned int i = 0; i < numShapes; ++i )
{
status = path.extendToShapeDirectlyBelow( i );
CHECK_MSTATUS_AND_RETURN_IT( status );
if ( !path.hasFn( MFn::kNurbsCurve ) )
{
path.pop();
continue;
}
MFnDagNode fnNode( path, &status );
CHECK_MSTATUS_AND_RETURN_IT( status );
if ( !fnNode.isIntermediateObject() )
{
return MS::kSuccess;
}
path.pop();
}
return MS::kFailure;
}
示例3: IsLayerVisible
bool IsLayerVisible(MDagPath& dp)
{
MStatus stat = MStatus::kSuccess;
MDagPath dagPath = dp;
while (stat == MStatus::kSuccess)
{
MFnDependencyNode node(dagPath.node());
MPlug doPlug = node.findPlug("drawOverride", &stat);
if (stat)
{
MObject layer = getOtherSideNode(doPlug);
MFnDependencyNode layerNode(layer, &stat);
if (stat)
{
bool visibility = true;
if (getBool("visibility", layerNode, visibility))
if (!visibility)
return false;
if (getEnumInt("displayType", layerNode) == 1) // template
return false;
}
}
stat = dagPath.pop();
}
return true;
}
示例4: IsLayerVisible
bool IsLayerVisible(MDagPath& dp)
{
MStatus stat = MStatus::kSuccess;
MDagPath dagPath = dp;
while (stat == MStatus::kSuccess)
{
MFnDependencyNode node(dagPath.node());
MPlug doPlug = node.findPlug("drawOverride", &stat);
if( stat )
{
MObject layer = getOtherSideNode(doPlug);
MFnDependencyNode layerNode(layer, &stat);
if( stat )
{
MGlobal::displayInfo(MString("check layer ") + layerNode.name() + " for node " + dagPath.fullPathName());
bool visibility = true;
if(getBool("visibility", layerNode, visibility))
if(!visibility)
return false;
}
}
stat = dagPath.pop();
}
return true;
}
示例5: nodeTranslation
MVector swissArmyLocatorManip::nodeTranslation() const
{
MFnDagNode dagFn(fNodePath);
MDagPath path;
dagFn.getPath(path);
path.pop(); // pop from the shape to the transform
MFnTransform transformFn(path);
return transformFn.translation(MSpace::kWorld);
}
示例6: IsPathVisible
//-----------------------------------------------------------------------------
//
// Purpose: Determine if a given Maya Dag path is visible through
// Simply makes sure the node and all of its ancestors are visible
// Input: mDagPath The node to check for visibility
// Output: templateAsInvisible If true, template objects are considered to be invisible
//
//-----------------------------------------------------------------------------
bool ValveMaya::IsPathVisible( MDagPath mDagPath, bool bTemplateAsInvisible )
{
for ( ; mDagPath.length(); mDagPath.pop() )
{
if ( !IsNodeVisible( mDagPath, bTemplateAsInvisible ) )
return false;
}
return true;
}
示例7:
AbcWriteJob::AbcWriteJob(const char * iFileName,
std::set<double> & iTransFrames,
Alembic::AbcCoreAbstract::TimeSamplingPtr iTransTime,
const JobArgs & iArgs)
{
MStatus status;
mFileName = iFileName;
mBoxIndex = 0;
mArgs = iArgs;
mTransSamples = 1;
if (mArgs.useSelectionList)
{
bool emptyDagPaths = mArgs.dagPaths.empty();
// get the active selection
MSelectionList activeList;
MGlobal::getActiveSelectionList(activeList);
mSList = activeList;
unsigned int selectionSize = activeList.length();
for (unsigned int index = 0; index < selectionSize; index ++)
{
MDagPath dagPath;
status = activeList.getDagPath(index, dagPath);
if (status == MS::kSuccess)
{
unsigned int length = dagPath.length();
while (--length)
{
dagPath.pop();
mSList.add(dagPath, MObject::kNullObj, true);
}
if (emptyDagPaths)
{
mArgs.dagPaths.insert(dagPath);
}
}
}
}
mTransFrames = iTransFrames;
// only needed during creation of the transforms
mTransTime = iTransTime;
mTransTimeIndex = 0;
// should have at least 1 value
assert(!mTransFrames.empty());
mFirstFrame = *(mTransFrames.begin());
std::set<double>::iterator last = mTransFrames.end();
last--;
mLastFrame = *last;
}
示例8: IsPathTemplated
bool IsPathTemplated(MDagPath& path)
{
MStatus stat = MStatus::kSuccess;
while (stat == MStatus::kSuccess)
{
MFnDagNode node;
node.setObject(path.node());
if (IsTemplated(node))
return true;
stat = path.pop();
}
return false;
}
示例9: GetParentTransform
MMatrix HesperisIO::GetParentTransform(const MDagPath & path)
{
MMatrix m;
MDagPath parentPath = path;
parentPath.pop();
MStatus stat;
MFnTransform ft(parentPath, &stat);
if(!stat) {
MGlobal::displayWarning(MString("hesperis io cannot create transform func by paht ")+path.fullPathName());
return m;
}
m = ft.transformation().asMatrix();
return m;
}
示例10: IsPathVisible
bool IsPathVisible(MDagPath& dp)
{
MStatus stat = MStatus::kSuccess;
MDagPath dagPath = dp;
while (stat == MStatus::kSuccess)
{
MFnDagNode node(dagPath.node());
if (!IsVisible(node))
{
return false;
}
stat = dagPath.pop();
}
return true;
}
示例11: GetWorldTransform
MMatrix HesperisIO::GetWorldTransform(const MDagPath & path)
{
MMatrix m;
MDagPath parentPath = path;
MStatus stat;
for(;;) {
stat = parentPath.pop();
if(!stat) break;
MFnTransform ft(parentPath, &stat);
if(!stat) {
return m;
}
m *= ft.transformation().asMatrix();
}
return m;
}
示例12: stopWatchingUnselectedDagObjects
// Remove any DAG object not in the selectedObjects list.
void ShapeMonitor::stopWatchingUnselectedDagObjects(MSelectionList& selectedObjects)
{
// For each monitored object...
for (int i = monitoredObjectsPtrArray.length()-1; i >= 0; i--)
{
MonitoredObject *pMonObject = monitoredObjectsPtrArray[i];
MStatus stat;
// Get an MObject for the MonitoredObject->mayaNodeName.
MDagPath dagpath;
MSelectionList selList;
selList.add(pMonObject->mayaNodeName);
stat = selList.getDagPath(0, dagpath);
// If the MObject is a DAG node...
if (stat)
{
bool found = false;
// Check if the dag path is included in the selectedObjects list.
// For example, say that dagpath = "|group1|group2|pSphere|pSphereShape",
// selectedObjects contains "|group1|group2".
// We first check if dagpath is included in selectedObjects. If that's not the
// case, we pop() one component, so that dagpath = "|group1|group2|pSphere", then
// check again. We do that until either the dagpath is found to be included in
// the selectedObjects list, or until there's no component left in dagpath.
while (!found && dagpath.length() > 0)
{
// Since we store the shape name (as opposed to the parent transform dagpath),
// we need to pop() to get the parent transform dagpath.
dagpath.pop();
MObject component;
// Check if the dag path is included in the objects list.
if (selectedObjects.hasItemPartly(dagpath, component))
found = true;
}
// If the object was not in the selectedObjects list, stop watching it.
if (!found)
stopWatching(pMonObject->mayaNodeName);
}
}
}
示例13: getSelectionStatus
bool OpenSubdivDrawOverride::getSelectionStatus(const MDagPath& objPath) const
{
// retrieve the selection status of the node
MStatus status;
MSelectionList selectedList;
status = MGlobal::getActiveSelectionList(selectedList);
if(!status)
return false;
MDagPath pathCopy = objPath;
do {
if(selectedList.hasItem(pathCopy)) return true;
status = pathCopy.pop();
} while(status);
return false;
}
示例14: appendForcedNodeToList
// ------------------------------------------------------------
void SceneGraph::appendForcedNodeToList ( const MDagPath& dagPath )
{
// Attach a function set
MFnDependencyNode fn ( dagPath.node() );
String theNodeName = fn.name().asChar();
MDagPath dagPathCopy = dagPath;
while ( dagPathCopy.length() > 0 && !isForcedNode ( dagPathCopy ) )
{
// Attach a function set
MFnDependencyNode fn ( dagPathCopy.node() );
String theNodeName = fn.name().asChar();
mForcedNodes.append ( dagPathCopy );
dagPathCopy.pop();
}
}
示例15: dagFn
MStatus V3Manipulator::connectToDependNode( const MObject & node )
{
MFnDagNode dagFn( node );
MDagPath nodePath;
dagFn.getPath( nodePath );
MStatus status;
m_translatePlug = dagFn.findPlug( m_plug.partialName(), &status );
if( !status )
{
return MStatus::kFailure;
}
MFnFreePointTriadManip translateFn( m_translateManip );
translateFn.connectToPointPlug( m_translatePlug );
addManipToPlugConversionCallback( m_translatePlug, (manipToPlugConversionCallback)&V3Manipulator::vectorManipToPlugConversion );
addPlugToManipConversionCallback( translateFn.pointIndex(), (plugToManipConversionCallback)&V3Manipulator::vectorPlugToManipConversion );
MStatus stat = finishAddingManips();
if( stat == MStatus::kFailure )
{
return MStatus::kFailure;
}
MPxManipContainer::connectToDependNode( node );
readParameterOptions( dagFn );
if( m_worldSpace)
{
m_localMatrix.setToIdentity();
m_localMatrixInv.setToIdentity();
}
else
{
// Inherit any transform to the parent
MDagPath transformPath = nodePath;
transformPath.pop();
MFnTransform transformFn( transformPath );
m_localMatrix = transformPath.inclusiveMatrix();
m_localMatrixInv = transformPath.inclusiveMatrixInverse();
}
return stat;
}