private void buildMeshNodes() { MItDependencyNodes it = new MItDependencyNodes(MFn.Type.kMesh); while (!it.isDone) { // Get the dag node of the mesh. MFnDagNode dagNode = new MFnDagNode(it.thisNode); // Create a new mesh. MayaMesh meshNode = new MayaMesh(); // Add the mesh to the all meshes list. allMeshes.Add(meshNode); // Configure the mesh node meshNode.name = dagNode.fullPathName; dagNode.getPath(meshNode.mayaObjectPath); meshNode.id = allMeshes.Count - 1; // The first parent of a mesh is the source transform, even with instances. meshNode.sourceXForm = pathXformMap[(new MFnDagNode(dagNode.parent(0))).fullPathName]; // Set the source Xform to know it's a source for an instance (its mesh). meshNode.sourceXForm.isSourceXform = true; // If the mesh has more than one parent, it has been instanced. We need to know this for computing local positions. meshNode.isInstanced = dagNode.isInstanced(); // Add the map to the dictionary to search by name. pathMeshMap[meshNode.name] = meshNode; it.next(); } }
private void buildMeshNodes() { MItDependencyNodes it = new MItDependencyNodes(MFn.Type.kMesh); while( !it.isDone ) { // Get the dag node of the mesh. MFnDagNode dagNode = new MFnDagNode(it.thisNode); // Create a new mesh. MayaMesh meshNode = new MayaMesh(); // Add the mesh to the all meshes list. allMeshes.Add(meshNode); // Configure the mesh node meshNode.name = dagNode.fullPathName; dagNode.getPath(meshNode.mayaObjectPath); meshNode.id = allMeshes.Count - 1; // The first parent of a mesh is the source transform, even with instances. meshNode.sourceXForm = pathXformMap[(new MFnDagNode(dagNode.parent(0))).fullPathName]; // Set the source Xform to know it's a source for an instance (its mesh). meshNode.sourceXForm.isSourceXform = true; // If the mesh has more than one parent, it has been instanced. We need to know this for computing local positions. meshNode.isInstanced = dagNode.isInstanced(); // Add the map to the dictionary to search by name. pathMeshMap[meshNode.name] = meshNode; it.next(); } }