Created
November 19, 2018 22:11
-
-
Save hotcakesdeluxe/54438b12e6ebad1ce9fd882f5862d184 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
import maya.OpenMaya as OpenMaya | |
def getVertices(mesh): | |
mc.select(mesh) | |
selList = OpenMaya.MSelectionList() | |
OpenMaya.MGlobal.getActiveSelectionList(selList) | |
meshObj = OpenMaya.MObject() | |
selList.getDependNode(0,meshObj) | |
meshFn = OpenMaya.MFnMesh( meshObj ) | |
meshVtxCount = OpenMaya.MIntArray() | |
meshVtxArray = OpenMaya.MIntArray() | |
meshFn.getVertices(meshVtxCount,meshVtxArray) | |
vtxList = [] | |
for i in range(meshVtxArray.length()): | |
vtxList.append(meshVtxArray[i]) | |
print len(vtxList) | |
return vtxList | |
getVertices("pCubeShape1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment