当前位置: 首页>>代码示例>>C++>>正文


C++ MDagPath::isVisible方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:nkostelnik,项目名称:importer,代码行数:101,代码来源:MayaReader.cpp


注:本文中的MDagPath::isVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。