本文整理汇总了C++中MDagPath::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagPath::isVisible方法的具体用法?C++ MDagPath::isVisible怎么用?C++ MDagPath::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagPath
的用法示例。
在下文中一共展示了MDagPath::isVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extractPolygons
void extractPolygons(Model* model) {
MStatus stat;
MItDag dagIter(MItDag::kBreadthFirst, MFn::kInvalid);
for (; !dagIter.isDone(); dagIter.next()) {
MDagPath dagPath;
stat = dagIter.getPath(dagPath);
if (!stat) { continue; };
MFnDagNode dagNode(dagPath, &stat);
if (dagNode.isIntermediateObject()) continue;
if (!dagPath.hasFn( MFn::kMesh )) continue;
if (dagPath.hasFn( MFn::kTransform)) continue;
if (!dagPath.isVisible()) continue;
MFnMesh fnMesh(dagPath);
MStringArray UVSets;
stat = fnMesh.getUVSetNames( UVSets );
// Get all UVs for the first UV set.
MFloatArray u, v;
fnMesh.getUVs(u, v, &UVSets[0]);
MPointArray vertexList;
fnMesh.getPoints(vertexList, MSpace::kObject);
MFloatVectorArray meshNormals;
fnMesh.getNormals(meshNormals);
unsigned instanceNumber = dagPath.instanceNumber();
MObjectArray sets;
MObjectArray comps;
fnMesh.getConnectedSetsAndMembers( instanceNumber, sets, comps, true );
//printMaterials(dagPath);
unsigned int comlength = comps.length();
for (unsigned int compi = 0; compi < comlength; compi++) {
SubMesh submesh;
MItMeshPolygon itPolygon(dagPath, comps[compi]);
unsigned int polyCount = 0;
for (; !itPolygon.isDone(); itPolygon.next()) {
polyCount++;
MIntArray polygonVertices;
itPolygon.getVertices(polygonVertices);
int count;
itPolygon.numTriangles(count);
for (; count > -1; count--) {
MPointArray nonTweaked;
MIntArray triangleVertices;
MIntArray localIndex;
MStatus status;
status = itPolygon.getTriangle(count, nonTweaked, triangleVertices, MSpace::kObject);
if (status == MS::kSuccess) {
VertexDefinition vertex1;
VertexDefinition vertex2;
VertexDefinition vertex3;
{ // vertices
int vertexCount = vertexList.length();
{
int vertexIndex0 = triangleVertices[0];
MPoint point0 = vertexList[vertexIndex0];
vertex1.vertex.x = (float)point0.x;
vertex1.vertex.y = (float)point0.y;
vertex1.vertex.z = (float)point0.z;
}
{
int vertexIndex0 = triangleVertices[1];
MPoint point0 = vertexList[vertexIndex0];
vertex2.vertex.x = (float)point0.x;
vertex2.vertex.y = (float)point0.y;
vertex2.vertex.z = (float)point0.z;
}
{
int vertexIndex0 = triangleVertices[2];
MPoint point0 = vertexList[vertexIndex0];
vertex3.vertex.x = (float)point0.x;
vertex3.vertex.y = (float)point0.y;
//.........这里部分代码省略.........