WHAT THIS MEL SCRIPT DOES
Maya allows you to select and snap verts to the grid, but only one at a time or as groups relative to one pivot point. This tool allows you to snap all selected verts of a mesh (or multiple) to your grid in 3D space at once. You can select entire objects, as well as individual faces, edges, or groups of verts at a time and snap their verts to the nearest grid position. You can do this on all axis at once, or specifically snap just in the XYZ directions if needed. This can be useful if you're using the grid for pixel-perfect UVing, or need to precisely align many verts to a grid all at once.
Note: This MEL script was made and tested on Maya 2023.1. It may or may not work in earlier or later versions. I am also unsure if it's guaranteed to work in Maya LT, but I made it in MEL instead of Python for that specific reason so fingers crossed!
- Drag the snapVertsToGrid.mel script to your Maya scripts folder e.g. /Documents/Maya/2023/scripts/
- Open Maya, then the Script Editor (Windows > General Editors > Script Editor)
- Type in "source snapVertsToGrid.mel" (without the "") and hit the run button (the > icon at the top), and it should find the script if that's where your Maya is set to look for scripts.
- Type in "openVertsToGridWindow" (without the ""), highlight the text, then middle-mouse drag it onto your shelf. Or just run it from the Script Editor if desired.
- (Optional) If you dragged it onto your shelf, right click and edit the new button and add the included "SnapVertsToGrid_ShelfIcon.png" icon. I'd also recommend under the 'Command' menu having both "source snapVertsToGrid.mel;" and "openSnapVertsToGridWindow;" lines included.
HOW TO USE
Video demo on ArtStation blog post ↗️
Input current grid settings (found in 'Display > Grid'), select the object(s), individual face(s), vert(s), or edge(s), then hit the corresponding button to snap your verts to the nearest grid position along the specified axis.
That's it! Hope it helps!