本文整理汇总了C++中MFnDagNode::name方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDagNode::name方法的具体用法?C++ MFnDagNode::name怎么用?C++ MFnDagNode::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDagNode
的用法示例。
在下文中一共展示了MFnDagNode::name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findForcedNodes
// ------------------------------------------------------------
void SceneGraph::findForcedNodes()
{
MStatus status;
if ( mExportSelectedOnly )
{
MSelectionList selectedItems;
MGlobal::getActiveSelectionList ( selectedItems );
uint selectedCount = selectedItems.length();
MDagPathArray queue;
for ( uint i = 0; i < selectedCount; ++i )
{
MDagPath selectedPath;
status = selectedItems.getDagPath ( i, selectedPath );
if ( status == MStatus::kSuccess ) queue.append ( selectedPath );
}
while ( queue.length() > 0 )
{
MDagPath selectedPath = queue[queue.length() - 1];
queue.remove ( queue.length() - 1 );
// Queue up the children.
uint childCount = selectedPath.childCount();
for ( uint i = 0; i < childCount; ++i )
{
MObject node = selectedPath.child ( i );
MDagPath childPath = selectedPath;
childPath.push ( node );
queue.append ( childPath );
}
// Look for a mesh
if ( selectedPath.node().hasFn ( MFn::kMesh ) )
{
// export forced nodes in path
addForcedNodes ( selectedPath );
}
}
}
else
{
for ( MItDag dagIt ( MItDag::kBreadthFirst ); !dagIt.isDone(); dagIt.next() )
{
MDagPath currentPath;
status = dagIt.getPath ( currentPath );
if ( status == MStatus::kSuccess )
{
MFnDagNode node ( currentPath );
String nodeName = node.name().asChar();
if ( currentPath.node().hasFn ( MFn::kMesh ) )
{
// export forced nodes in path
addForcedNodes ( currentPath );
}
}
}
}
}
示例2: IsVisible
bool IsVisible(MFnDagNode& node)
{
MStatus stat;
if (node.isIntermediateObject())
return false;
bool visibility = true;
MFnDependencyNode depFn(node.object(), &stat);
if (!stat)
MGlobal::displayInfo("Problem getting dep from " + node.name());
if (!getBool(MString("visibility"), depFn, visibility))
MGlobal::displayInfo("Problem getting visibility attr from " + node.name());
if (!visibility)
return false;
getBool(MString("overrideVisibility"), depFn, visibility);
if (!visibility)
return false;
return true;
}
示例3: doIt
MStatus testSelectAddAttribute::doIt( const MArgList& args )
{
MDagPath node;
MObject component;
MSelectionList list;
MFnDagNode nodeFn;
MGlobal::getActiveSelectionList( list );
for ( unsigned int index = 0; index < list.length(); index++ )
{
list.getDagPath( index, node, component );
nodeFn.setObject( node );
cout<<nodeFn.name().asChar( ) << "is selected" << endl;
}
return MS::kSuccess;
}
示例4: myMCurve
void
exportCurve(MFnDagNode & theDagNode, WorldBuilderBase & theParentTransform, SceneBuilder & theSceneBuilder) {
MAKE_SCOPE_TIMER(CurveExporter_exportCurve);
if (theDagNode.isIntermediateObject()) {
return;
}
string myCurveName = string(theDagNode.name().asChar());
DB(AC_TRACE << "Exporting curve: " << myCurveName << endl);
MFnNurbsCurve myMCurve(theDagNode.object());
DB(
cerr << "Number of cvs: " << myMCurve.numCVs() << endl;
cerr << "Number of spans: " << myMCurve.numSpans() << endl;
cerr << "Number of knots: " << myMCurve.numKnots() << endl;
cerr << "Degree: " << myMCurve.degree() << endl;
cerr << "Length: " << myMCurve.length() << endl;
for (double d = 0.0; d <= 1.0; d += 0.1) {
MPoint myPoint;
myMCurve.getPointAtParam(d, myPoint);
cerr << "Point at param " << d << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl;
}
int myCvCount = myMCurve.numCVs();
for (int i = 0; i < myCvCount; ++i) {
MPoint myPoint;
myMCurve.getCV(i, myPoint);
cerr << "CV " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl;
}
int myKnotCount = myMCurve.numKnots();
for (int i = 0; i < myKnotCount; ++i) {
double knotParam;
knotParam = myMCurve.knot(i);
MPoint myPoint;
myMCurve.getPointAtParam(knotParam, myPoint);
cerr << "Point at knot# " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl;
}
)
示例5: isExcluded
// ------------------------------------------------------
bool SetHelper::isExcluded ( const MDagPath& dagPath )
{
MFnDagNode dagNode ( dagPath );
if ( dagNode.name() == "world" )
return false;
bool bContainedInSet = false;
for ( unsigned int i = 0; i < SetHelper::setObjects.size(); ++i )
{
# if MAYA_API_VERSION < 600
MObject o = SetHelper::setObjects[i];
# else
MObject o = SetHelper::setObjects[i].object();
# endif
MFnSet currentSet ( o );
if ( isMemberOfSet ( dagPath, currentSet ) )
{
bContainedInSet = true;
break;
}
}
if ( setMode == kExcluding )
{
return bContainedInSet;
}
else if ( setMode == kIncludeOnly )
{
return !bContainedInSet;
}
else
{
return false;
}
}
示例6: IterateSelection
void IterateSelection()
{
unsigned int i;
MSelectionList list;
MDagPath dagpath;
MFnDagNode fnnode;
MGlobal::getActiveSelectionList(list);
for(i = 0; i < list.length(); i++)
{
list.getDagPath(i, dagpath);
fnnode.setObject(dagpath);
cout << fnnode.name().asChar() << " of type " << fnnode.typeName().asChar() << " is selected" << endl;
cout << "has " << fnnode.childCount() << " children" << endl;
//Iterate the children
for(int j = 0; j < fnnode.childCount(); j++)
{
MObject childobj;
MFnDagNode fnchild;
childobj = fnnode.child(j);
fnchild.setObject(childobj);
cout << "child " << j << " is a " << fnchild.typeName().asChar() << endl;
//MFn::Type type = fnchild.type()
//if(fnchild.type() == MFn::kMesh)
//DumpMesh(dagpath);
//DumpMesh2(dagpath);
IterateWorldMeshesInSelection();
}
}
}
示例7: getIsExportNode
// --------------------------------------------------------------------
bool SceneGraph::getIsExportNode (
const MDagPath& dagPath,
bool& isForced,
bool& isVisible )
{
// Does this dagPath already exist? If so, only recurse if FollowInstancedChildren() is set.
MFnDagNode dagFn ( dagPath );
String dagNodeName = dagFn.name().asChar();
bool isSceneRoot = dagPath.length() == 0;
// Ignore default and intermediate nodes (history items)
bool isIntermediateObject = dagFn.isIntermediateObject();
if ( ( dagFn.isDefaultNode() && !isSceneRoot ) || isIntermediateObject )
{
return false;
}
MString nodeName = dagPath.partialPathName();
if ( nodeName == MString ( NIMA_INTERNAL_PHYSIKS ) )
{
// Skip this node, which is only used
// by Nima as a work-around for a Maya bug.
return false;
}
// If we are not already forcing this node, its children
// check whether we should be forcing it (skinning of hidden joints).
isForced = isForcedNode ( dagPath );
DagHelper::getPlugValue ( dagPath.node(), ATTR_VISIBILITY, isVisible );
bool isInstanced = dagPath.isInstanced();
uint instanceNumber = dagPath.instanceNumber();
if ( !isForced )
{
// Check for visibility
if ( !ExportOptions::exportInvisibleNodes() && !isVisible )
{
// Check if the visibility of the element is animated.
AnimationSampleCache* animationCache = mDocumentExporter->getAnimationCache();
if ( !AnimationHelper::isAnimated ( animationCache, dagPath.node(), ATTR_VISIBILITY ) )
{
return false;
}
}
else if ( !isVisible && !ExportOptions::exportDefaultCameras() )
{
// Check for the default camera transform names.
if ( nodeName == CAMERA_PERSP || nodeName == CAMERA_TOP || nodeName == CAMERA_SIDE || nodeName == CAMERA_FRONT ||
nodeName == CAMERA_PERSP_SHAPE || nodeName == CAMERA_TOP_SHAPE || nodeName == CAMERA_SIDE_SHAPE || nodeName == CAMERA_FRONT_SHAPE )
return false;
}
}
isForced &= !isVisible;
if ( !isForced )
{
// We don't want to process manipulators
if ( dagPath.hasFn ( MFn::kManipulator ) || dagPath.hasFn ( MFn::kViewManip ) ) return false;
// Check for constraints which are not exported
//if ( !ExportOptions::exportConstraints() && dagPath.hasFn ( MFn::kConstraint ) ) return false;
if ( dagPath.hasFn ( MFn::kConstraint ) ) return false;
// Check set membership exclusion/inclusion
if ( SetHelper::isExcluded ( dagPath ) ) return false;
}
return true;
}
示例8: edgeIter
//.........这里部分代码省略.........
{
for( j=0; j < ballUCoords.length(); j++ )
{
newUCoords.append( ballUCoords[j] );
newVCoords.append( ballVCoords[j] );
}
}
for( j=0; j < ballFvUVIDs.length(); j++ )
{
newFvUVIDs.append( uvOffset + ballFvUVIDs[j] );
}
}
uvOffset = newUCoords.length();
// Generate rods
int nRods = 0;
MItMeshEdge edgeIter( dagPath );
for( ; !edgeIter.isDone(); edgeIter.next(), nRods++ )
{
p0 = edgeIter.point( 0, MSpace::kWorld );
p1 = edgeIter.point( 1, MSpace::kWorld );
// N.B. Generate the uv coordinates only once since they
// are referenced by all rods
genRod( p0, p1,
radius.value(), segs, nRodPolys,
rodVerts, rodPolyCounts, rodPolyConnects,
nRods == 0, rodUCoords, rodVCoords,
rodFvUVIDs );
vertOffset = newVerts.length();
// Add the rod to the mesh
nNewPolys += nRodPolys;
for( i=0; i < rodVerts.length(); i++ )
newVerts.append( rodVerts[i] );
for( i=0; i < rodPolyCounts.length(); i++ )
newPolyCounts.append( rodPolyCounts[i] );
for( i=0; i < rodPolyConnects.length(); i++ )
newPolyConnects.append( vertOffset + rodPolyConnects[i] );
// First rod
if( nRods == 0 )
{
// Add rod's uv coordinates to the list
for( i=0; i < rodUCoords.length(); i++ )
{
newUCoords.append( rodUCoords[i] );
newVCoords.append( rodVCoords[i] );
}
}
// Set the face-vertex-uvIDs
for( i=0; i < rodFvUVIDs.length(); i++ )
{
newFvUVIDs.append( uvOffset + rodFvUVIDs[i] );
}
}
objTransform = meshFn.create( newVerts.length(), nNewPolys, newVerts,
newPolyCounts, newPolyConnects,
newUCoords, newVCoords,
MObject::kNullObj, &stat );
if( !stat )
{
MGlobal::displayError( MString( "Unable to create mesh: " ) + stat.errorString() );
return stat;
}
objTransforms.append( objTransform );
meshFn.assignUVs( newPolyCounts, newFvUVIDs );
meshFn.updateSurface();
// Rename transform node
dagFn.setObject( objTransform );
dagFn.setName( "molecule" );
// Put mesh into the initial shading group
dagMod.commandToExecute( MString( "sets -e -fe initialShadingGroup " ) + meshFn.name() );
}
// Select all the newly created molecule meshes
MString cmd( "select -r" );
for( i=0; i < objTransforms.length(); i++ )
{
dagFn.setObject( objTransforms[i] );
cmd += " " + dagFn.name();
}
dagMod.commandToExecute( cmd );
return dagMod.doIt();
}
示例9: extractFaces_Func
bool tm_polyExtract::extractFaces_Func( MSelectionList &selectionList, MStringArray &node_names)
{
MStatus status;
MObject meshObj;
status = selectionList.getDependNode( 0, meshObj);
if(!status){MGlobal::displayError("tm_polyExtract::extractFaces_Func: Can't find object !");return false;}
MFnMesh meshFn( meshObj, &status);
if(!status){MGlobal::displayError("tm_polyExtract::extractFaces_Func: Non mesh object founded !");return false;}
MDagPath meshDagPath_first, meshDagPath;
selectionList.getDagPath( 0, meshDagPath_first);
MObject multiFaceComponent;
MIntArray inputFacesArray;
inputFacesArray.clear();
inputFacesArray.setSizeIncrement( 4096);
MFnComponentListData compListFn;
compListFn.create();
for (MItSelectionList faceComponentIter(selectionList, MFn::kMeshPolygonComponent); !faceComponentIter.isDone(); faceComponentIter.next())
{
faceComponentIter.getDagPath(meshDagPath, multiFaceComponent);
if(!(meshDagPath_first == meshDagPath))
{
MGlobal::displayError("tm_polyExtract::extractFaces_Func: Different meshes faces founded !");
return false;
}
if (!multiFaceComponent.isNull())
{
for (MItMeshPolygon faceIter(meshDagPath, multiFaceComponent); !faceIter.isDone(); faceIter.next())
{
int faceIndex = faceIter.index();
#ifdef _DEBUG
infoMStr += faceIndex;
infoMStr += " ";
#endif
inputFacesArray.append( faceIndex);
compListFn.add( multiFaceComponent );
}
}
}
if( inputFacesArray.length() == 0)
{
MGlobal::displayError("tm_polyExtract::extractFaces_Func: No faces founded !");
return false;
}
#ifdef _DEBUG
MGlobal::displayInfo( infoMStr);
#endif
meshFn.setObject( meshDagPath_first);
meshObj = meshFn.object();
// MDagModifier dagModifier;
MFnDagNode meshDagNodeFn;
MFnDependencyNode depNodeFn;
meshDagNodeFn.setObject( meshDagPath_first);
MString meshName = meshDagNodeFn.name();
MObject outMesh_attrObject = meshDagNodeFn.attribute( "outMesh");
// ----------------------------------- duplicate shape
MObject duplicated_meshObjectA;
MObject duplicated_meshObjectB;
MObject inMesh_attrObjectA;
MObject inMesh_attrObjectB;
/*
MStringArray commandResult;
MSelectionList selList;
MGlobal::executeCommand( "duplicate " + meshDagNodeFn.name(), commandResult, 1, 1);
selList.add( commandResult[0]);
selList.getDependNode( 0, duplicated_meshObjectA);
meshDagNodeFn.setObject( duplicated_meshObjectA);
meshDagNodeFn.setName( meshName + "_tA");
duplicated_meshObjectA = meshDagNodeFn.child(0);
meshDagNodeFn.setObject( duplicated_meshObjectA);
meshDagNodeFn.setName( meshName + "_sA");
inMesh_attrObjectA = meshDagNodeFn.attribute( "inMesh");
meshDagNodeFn.setObject( meshDagPath_first);
selList.clear();
MGlobal::executeCommand( "duplicate " + meshDagNodeFn.name(), commandResult, 1, 1);
selList.add( commandResult[0]);
selList.getDependNode( 0, duplicated_meshObjectB);
meshDagNodeFn.setObject( duplicated_meshObjectB);
meshDagNodeFn.setName( meshName + "_tB");
duplicated_meshObjectB = meshDagNodeFn.child(0);
meshDagNodeFn.setObject( duplicated_meshObjectB);
meshDagNodeFn.setName( meshName + "_sB");
inMesh_attrObjectB = meshDagNodeFn.attribute( "inMesh");
*/
duplicated_meshObjectA = meshDagNodeFn.duplicate();
meshDagNodeFn.setObject( duplicated_meshObjectA);
meshDagNodeFn.setName( meshName + "_tA");
duplicated_meshObjectA = meshDagNodeFn.child(0);
meshDagNodeFn.setObject( duplicated_meshObjectA);
meshDagNodeFn.setName( meshName + "_sA");
inMesh_attrObjectA = meshDagNodeFn.attribute( "inMesh");
meshDagNodeFn.setObject( meshDagPath_first);
//.........这里部分代码省略.........