本文整理汇总了C++中MFnDagNode::parentCount方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDagNode::parentCount方法的具体用法?C++ MFnDagNode::parentCount怎么用?C++ MFnDagNode::parentCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDagNode
的用法示例。
在下文中一共展示了MFnDagNode::parentCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMeshNode
// --------------------------------------------------------------------------------------------
MStatus polyModifierCmd::processMeshNode( modifyPolyData& data )
// --------------------------------------------------------------------------------------------
{
MStatus status = MS::kSuccess;
// Declare our function sets. Use MFnDagNode here so
// we can retrieve the parent transform.
//
MFnDagNode dagNodeFn;
// Use the DAG path to retrieve our mesh shape node.
//
data.meshNodeShape = fDagPath.node();
dagNodeFn.setObject( data.meshNodeShape );
// ASSERT: meshNodeShape node should have a parent transform!
//
MStatusAssert( (0 < dagNodeFn.parentCount()),
"0 < dagNodeFn.parentCount() -- meshNodeshape has no parent transform" );
data.meshNodeTransform = dagNodeFn.parent(0);
data.meshNodeDestPlug = dagNodeFn.findPlug( "inMesh" );
data.meshNodeDestAttr = data.meshNodeDestPlug.attribute();
return status;
}
示例2: processReference
// --------------------------------------
void ReferenceManager::processReference ( const MObject& referenceNode )
{
MStatus status;
MFnDependencyNode referenceNodeFn ( referenceNode, &status );
if (status != MStatus::kSuccess) return;
#if MAYA_API_VERSION >= 600
MString referenceNodeName = MFnDependencyNode( referenceNode ).name();
Reference* reference = new Reference();
reference->referenceNode = referenceNode;
mReferences.push_back ( reference );
// Get the paths of the root transforms included in this reference
MObjectArray subReferences;
getRootObjects ( referenceNode, reference->paths, subReferences );
uint pathCount = reference->paths.length();
// Process the sub-references first
uint subReferenceCount = subReferences.length();
for (uint i = 0; i < subReferenceCount; ++i)
{
MObject& subReference = subReferences[i];
if ( subReference != MObject::kNullObj ) processReference ( subReference );
}
// Retrieve the reference node's filename
MString command = MString("reference -rfn \"") + referenceNodeFn.name() + MString("\" -q -filename;");
MString filename;
status = MGlobal::executeCommand ( command, filename );
if (status != MStatus::kSuccess || filename.length() == 0) return;
// Strip the filename of the multiple file token
int stripIndex = filename.index('{');
if (stripIndex != -1) filename = filename.substring(0, stripIndex - 1);
// Avoid transform look-ups on COLLADA references.
int extLocation = filename.rindex('.');
if (extLocation > 0)
{
MString ext = filename.substring(extLocation + 1, filename.length() - 1).toLowerCase();
if (ext == "dae" || ext == "xml") return;
}
// Check for already existing file information
// Otherwise create a new file information sheet with current node names
for ( ReferenceFileList::iterator it = mFiles.begin(); it != mFiles.end(); ++it )
{
if ((*it)->filename == filename)
{
reference->file = (*it);
break;
}
}
if ( reference->file == NULL ) reference->file = processReferenceFile(filename);
// Get the list of the root transform's first child's unreferenced parents.
// This is a list of the imported nodes!
for (uint j = 0; j < pathCount; ++j)
{
MDagPath path = reference->paths[j];
if (path.childCount() > 0)
{
path.push ( path.child(0) );
MFnDagNode childNode ( path );
if (!childNode.object().hasFn(MFn::kTransform)) continue;
uint parentCount = childNode.parentCount();
for (uint k = 0; k < parentCount; ++k)
{
MFnDagNode parentNode(childNode.parent(k));
if (parentNode.object() == MObject::kNullObj || parentNode.isFromReferencedFile()) continue;
MDagPath parentPath = MDagPath::getAPathTo(parentNode.object());
if (parentPath.length() > 0)
{
ReferenceRootList::iterator it =
reference->reroots.insert( reference->reroots.end(), ReferenceRoot() );
(*it).index = j;
(*it).reroot = parentPath;
}
}
}
}
#endif
}