AlignUVWMapGizmoOnAverageNormal
This script has 2 goals:
1) It is a tutorial for people learning Maxscript
2) It also help artists save time when setting UVs on meshes or patches.
How to use it ?
One object and only one should be selected - then select somes faces on this object.
And click on the button on the script UI and it will add a UVWMap modifier to the selected faces of your object and it will align the gizmo on the average normal of the selected faces.
To make you save time to understand whitout too much headache what I am doing in this script - you need to know the following:
- We get the selected faces array from the selected node.
- We compute the average normal of the selected faces.
- From this average normal - we build a pure rotation matrix (no translation and no scale - just a rotation).
- Then we add a UVWmap modifier to the selected node.
- Finally this rotation matrix is set into the gizmo transform of the UVWMap.
- And the magick comes to life - well - of course - if no bug has appeared from here. :-)
- The heart of this script is the 'AddUVWMapAnddoTheStuff' function - at this end of it.
We have choosen on purpose not to do the fit operation after the gizmo has been aligned because it will complicates the script with Bounding boxes calculation. It will be done in another version of this script.
Comments
try
this..
Rivanoor Bren
https://rivanoor.info
dead link
The link is dead. Where can this script be downloaded?
Excellent!
Excellent script! Glad it still works with 2012.