AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Maya select every other edge5/1/2023 ![]() ![]() ![]() MItMeshPolygon.getPoints() # get the position of all the verts MItMeshPolygon.vertexIndex() # get the object-relative indices of a particular vert MItMeshPolygon.getVertices() # get the face-relative indices of the current face's verts Particularly I’d look at the following methods: MItMeshPolygon.index() # get the index of the current face For your use case though, I think MItMeshPolygon is going to be the easiest way to access the data you need. I’ve used this method to process uvs for meshes with 30k+ verts in under 1/8th a second with no issues. ![]() Or, even better, if you can get the lists you need from any of the get functions on MFnMesh, they’re created in C++ and all you have to do is read their data in python. ![]() The difference here is that the iterator doesn’t construct any new lists at all, but rather gives you a handle to each polygon in memory as you’re iterating through the loop, so the overhead is minimal. Instead, use an iterator from the API, like MItMeshPolygon. Adding to existing lists is usually OK, but copying, combining, or removing from lists (not by index) can get heavy because it is actually iterating under the hood. Python in itself is actually pretty fast, but the memory overhead in creating large dynamic lists in every loop iteration is what will cause most of your slowdown. This isn’t too hard to do, but there are a couple important things you need to get right.įirstly, avoid creating large python lists inside of loops when you have large amounts of data to iterate over (like mesh faces). ![]()
0 Comments
Read More
Leave a Reply. |