本文整理汇总了C++中MFnDagNode::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDagNode::setName方法的具体用法?C++ MFnDagNode::setName怎么用?C++ MFnDagNode::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDagNode
的用法示例。
在下文中一共展示了MFnDagNode::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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);
//.........这里部分代码省略.........