Looking for a MEL script to change grid size in Maya by powers of 2. Its annoying to go through this manually every time I want to change the grid size when working on modular sets. Anyone know of one? Im pretty useless when it comes to programming it myself.
Replies
Then, here's the MEL code for shelf button 1:
//turn off undo
undoInfo -stateWithoutFlush false;
//query current grid divisions
int $gridDivs = `grid -q -divisions`;
//calculate new divisions
$gridDivs = $gridDivs * 2;
//query current grid spacing
int $gridSpacing = `grid -q -spacing`;
//set new divisions
grid -spacing $gridSpacing -divisions $gridDivs;
//turn undo back on
undoInfo -stateWithoutFlush true;
Here's the MEL code for shelf button 2:
//turn off undo
undoInfo -stateWithoutFlush false;
//query current grid divisions
int $gridDivs = `grid -q -divisions`;
//calculate new divisions
$gridDivs = $gridDivs / 2;
//query current grid spacing
int $gridSpacing = `grid -q -spacing`;
//set new divisions
grid -spacing $gridSpacing -divisions $gridDivs;
//turn undo back on
undoInfo -stateWithoutFlush true;