I am currently scripting a tool to flip and mirror objects using a base mesh as a reference (similar to abSymMesh, but aiming for faster performance), and I need to manipulate vertex positions.
Initially, I attempted to use
xform and iterated over all the vertices, but I found this approach to be somewhat slow for objects with more than 6000 vertices.
I considered using
setAttr because I’ve previously used it for transferring weights, and it allowed me to input a list of vertices and weights efficiently. However, I encountered issues when trying to apply it to the positions of vertices.
Therefore, I decided to leverage the Maya API 2.0, which has worked quite well. However, I am facing challenges with implementing undo functionality, as it does not work “out of the box” with the
As I am relatively new to Maya and scripting within it, I realize I may be lacking some foundational knowledge. From what I have read, it appears that I need to create a command using
MpxCommand to encapsulate my code for moving vertices. Is this correct, or is there a simpler approach I am overlooking?
Additionally, how can I ensure that this operates correctly within a single Python file? Because I have also come to understand that a command needs to be initialized when Maya starts.
Thank you in advance for any guidance or suggestions you can provide.