MAYA - First maya plugin in C++



I recently started playing around with C++ the Maya API.
I am not new to Maya, so it hasn't been that difficult to begin this process. The hardest part was probably to change my mindset from Python to C++, and try to find the equivalent functions from one to the other.
Another difficulty I found was to move the gizmo from my first Legacy Viewport implementation (which by the way, it was fairly straight forward) to the Viewport 2.0 classes, which are way wider but less intuitive.

The plugin consists of 3 classes:
  • The Locator Node (shape and transform), which for a given vertex index, a meshShape and a transform node, it outputs the world space transforms of the vertex, and draws a gizmo with the pivot point axis. This transform is calculated by getting the average normal of the vertex and casting a look at function. It takes the Y axis as UP vector so there is an arbitrary roll there, but this can be fixed with a transform rotation offset.
  • The Viewport 2.0 DrawOverride Class, which just draws the 3 lines that represent the pivot point in object space.
  • The Command Class, which essentially passes on the selected object and index to the main class (DG Node Class). It also creates the connections in the DG which are:
    • Out mesh from mesh node to the inMesh of the Plugin DG node.
    • World transform matrix from the mesh to the inMatrix of the Plugin DG node.
    • The out values of the Locator Shape into the Locator Transform.

What was left to do:
  • Adding the offset for the roll and passing the world scale.
  • Getting programatically the world space matrix from the meshShape node istead of getting it from its world mesh plug. I already did this, but it wasn't being called dirty if the mesh was moved. I thing that if I set the meshIn attribute as  setAffectsWorldSpace, this can be fixed.
Anyhow I will add an update in the future and perhaps translate it into a python plugin.
Thanks for reading,




No hay comentarios:

Publicar un comentario

Season 4 of Talking Tom and Friends Finale is here!!

We have finally launched the last episode for this season! I am very happy to be working with such an amazing team with people coming...