本文整理汇总了C++中MDagPath::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagPath::getPath方法的具体用法?C++ MDagPath::getPath怎么用?C++ MDagPath::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagPath
的用法示例。
在下文中一共展示了MDagPath::getPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writer
//.........这里部分代码省略.........
write_float(0);// translation z
write_float(1);//scale x
write_float(1);//scale y
write_float(1);//scale z
write_float(0);// rotation x
write_float(0);// rotation y
write_float(0);// rotation z
write_float(0);// rotation w
#else
#endif
int pos_objet=0,pos_nouvel_objet;
MString nom_objet_precedent;
// create an iterator to go through all transforms
//MItDag it(MItDag::depth, MFn::kTransform);
MItDag it(MItDag::kDepthFirst, MFn::kTransform);
// keep looping until done
int position_hierarchie=0;
int pos=0;
while(!it.isDone())
{
MString temp;
MDagPath path;
it.getPath(path);
MFnTransform trans(path);
MObject obj=it.item();
MStringArray chemin_split;
MString chemin=path.fullPathName();
chemin.split((char)'|',chemin_split);
pos=chemin_split.length();
//temp=pos;
//MGlobal::displayInfo(temp);
if(obj.apiType()== MFn::kTransform && path.child(0).apiType()== MFn::kMesh){
//MGlobal::displayInfo("Transform trouvé avec child Kmesh");
//écriture du node avec transform
//incrément de la hierarchie
if(pos<position_hierarchie || pos==position_hierarchie){
//MGlobal::displayInfo("fermeture des nodes précédents");
for(int i=position_hierarchie;i>pos-1;i--){
//temp = i;
//MGlobal::displayInfo(temp);
EndChunck();
}//fin for
}//fin if
示例2: exportLights
//---------------------------------------------------------------
void LightExporter::exportLights ( SceneElement* sceneElement )
{
// If we have a external reference, we don't need to export the data here.
if ( !sceneElement->getIsLocal() ) return;
if ( !sceneElement->getIsExportNode () ) return;
// Check if it is a light.
SceneElement::Type sceneElementType = sceneElement->getType();
if ( sceneElementType == SceneElement::LIGHT )
{
// Get the current dag path
MDagPath dagPath = sceneElement->getPath();
// Check if the current scene element isn't already exported.
SceneGraph* sceneGraph = mDocumentExporter->getSceneGraph();
if ( sceneGraph->findExportedElement ( dagPath ) ) return;
// Check if the current element is an instance.
// We don't need to export instances, because we export the original instanced element.
bool isInstance = ( dagPath.isInstanced() && dagPath.instanceNumber() > 0 );
// If the original instanced element isn't already exported, we have to export it now.
if ( isInstance )
{
// Get the original instanced element.
MDagPath instancedPath;
dagPath.getPath ( instancedPath, 0 );
// Check if the original instanced element is already exported.
SceneGraph* sceneGraph = mDocumentExporter->getSceneGraph();
SceneElement* exportedElement = sceneGraph->findExportedElement ( instancedPath );
if (exportedElement == 0)
{
// Export the original instanced element and push it in the exported scene graph.
if (exportLight(instancedPath))
{
SceneElement* instancedSceneElement = sceneGraph->findElement(instancedPath);
SceneGraph* sceneGraph = mDocumentExporter->getSceneGraph();
sceneGraph->addExportedElement(instancedSceneElement);
}
}
}
else
{
// Export the element and push it in the exported scene graph.
if ( exportLight ( dagPath ) )
{
SceneGraph* sceneGraph = mDocumentExporter->getSceneGraph();
sceneGraph->addExportedElement( sceneElement );
}
}
}
// Recursive call for all the child elements
for ( uint i=0; i<sceneElement->getChildCount(); ++i )
{
SceneElement* childElement = sceneElement->getChild ( i );
exportLights ( childElement );
}
}
示例3: writeDagNodes
void maTranslator::writeDagNodes(fstream& f)
{
fParentingRequired.clear();
MItDag dagIter;
dagIter.traverseUnderWorld(true);
MDagPath worldPath;
dagIter.getPath(worldPath);
//
// We step over the world node before starting the loop, because it
// doesn't get written out.
//
for (dagIter.next(); !dagIter.isDone(); dagIter.next())
{
MDagPath path;
dagIter.getPath(path);
//
// If the node has already been written, then all of its descendants
// must have been written, or at least checked, as well, so prune
// this branch of the tree from the iteration.
//
MFnDagNode dagNodeFn(path);
if (dagNodeFn.isFlagSet(fCreateFlag))
{
dagIter.prune();
continue;
}
//
// If this is a default node, it will be written out later, so skip
// it.
//
if (dagNodeFn.isDefaultNode()) continue;
//
// If this node is not writable, and is not a shared node, then mark
// it as having been written, and skip it.
//
if (!dagNodeFn.canBeWritten() && !dagNodeFn.isShared())
{
dagNodeFn.setFlag(fCreateFlag, true);
continue;
}
unsigned int numParents = dagNodeFn.parentCount();
if (dagNodeFn.isFromReferencedFile())
{
//
// We don't issue 'creatNode' commands for nodes from referenced
// files, but if the node has any parents which are not from
// referenced files, other than the world, then make a note that
// we'll need to issue extra 'parent' commands for it later on.
//
unsigned int i;
for (i = 0; i < numParents; i++)
{
MObject altParent = dagNodeFn.parent(i);
MFnDagNode altParentFn(altParent);
if (!altParentFn.isFromReferencedFile()
&& (altParentFn.object() != worldPath.node()))
{
fParentingRequired.append(path);
break;
}
}
}
else
{
//
// Find the node's parent.
//
MDagPath parentPath = worldPath;
if (path.length() > 1)
{
//
// Get the parent's path.
//
parentPath = path;
parentPath.pop();
//
// If the parent is in the underworld, then find the closest
// ancestor which is not.
//
if (parentPath.pathCount() > 1)
{
//
// The first segment of the path contains whatever
// portion of the path exists in the world. So the closest
// worldly ancestor is simply the one at the end of that
//.........这里部分代码省略.........