Hey all. So I'm currently working on lightmap UVs for a brick wall (where each brick is modeled) and there's a lot of verts for me to snap manually. Was wondering if anyone knows a faster way to, or a script that will snap all of the selected verts to their closest grid intersection?
Replies
MacroScript CrankshaftTools_UVSnapper_snapX_macro buttonText:"UV snap X" category:"Crankshaft Tools" tooltip:"UV snap X" autoUndoEnabled:true icon:#("standard", 1) -- use first icon in standard<br>(<br> fn round_to val n =<br> (<br> local mult = 10.0 ^ n<br> (floor ((val * mult) + 0.5)) / mult<br> )<br> <br> on execute do<br> (<br> mod_unwrap = $.modifiers[#Unwrap_UVW]<br> if(mod_unwrap!=undefined)then <br> (<br> local gridSize = mod_unwrap.unwrap2.getGridSize()<br> if(mod_unwrap.getTVSubObjectMode() == 3) then<br> (<br> mod_unwrap.faceToVertSelect()<br> )<br> else if(mod_unwrap.getTVSubObjectMode() == 2) then<br> (<br> mod_unwrap.edgeToVertSelect()<br> )<br> <br> vArray = mod_unwrap.getSelectedVertices()<br> for vVar in vArray do<br> (<br> oldPos = mod_unwrap.getVertexPosition 0 vVar<br> --print oldPos.x<br> snappedX = (round_to (oldPos.x / gridSize) 0 ) * gridSize<br> --print snappedX<br> mod_unwrap.setVertexPosition 0 vVar [snappedX, oldPos.y, 0]<br> )<br> )<br> redrawViews()<br> )<br>)<br><br><br>MacroScript CrankshaftTools_UVSnapper_snapY_macro buttonText:"UV snap Y" category:"Crankshaft Tools" tooltip:"UV snap Y" autoUndoEnabled:true icon:#("standard", 1) -- use first icon in standard<br>(<br> fn round_to val n =<br> (<br> local mult = 10.0 ^ n<br> (floor ((val * mult) + 0.5)) / mult<br> )<br> <br> on execute do<br> (<br> mod_unwrap = $.modifiers[#Unwrap_UVW]<br> if(mod_unwrap!=undefined)then <br> (<br> local gridSize = mod_unwrap.unwrap2.getGridSize()<br> if(mod_unwrap.getTVSubObjectMode() == 3) then<br> (<br> mod_unwrap.faceToVertSelect()<br> )<br> else if(mod_unwrap.getTVSubObjectMode() == 2) then<br> (<br> mod_unwrap.edgeToVertSelect()<br> )<br> <br> vArray = mod_unwrap.getSelectedVertices()<br> for vVar in vArray do<br> (<br> oldPos = mod_unwrap.getVertexPosition 0 vVar<br> --print oldPos.y<br> snappedY = (round_to (oldPos.y / gridSize) 0 ) * gridSize<br> --print snappedX<br> mod_unwrap.setVertexPosition 0 vVar [oldPos.x, snappedY, 0]<br> )<br> )<br> redrawViews()<br> )<br>)Try this macroscript. It's help to snap selected vertices to nearest vertical or horizontal grid lines.
Your help is super appreciated but I don't know what I'm doing :P
Exactly. Also I find it handy to have such commands in quad menu.