ScriptSpot

Script

Auto Align UVWMap

By obaida · Credited author: Obaida · 2022-06-16

Version
1.4
Date updated
2022-09-11
Votes
2
Download
Download
Description

3dsMax Script for applying UVW Map Modifier Depending on Selected Edge or Longest Edge of each Face .

UPDATE 1.4 :

  • Fix UV Modifier Alignment .

  • Set Coordinate system to Local (getting wrong result on other coordsystems) .

UPDATE 1.3 :

  • Improve the Function of Grouping Faces by Angle .

UPDATE 1.2 :

  • New UI .
  • Improved Function Speed .
  • Add CheckBox to Get UV Rotation from Selected Edges .
  • Add Max Angle Value to Detect Polys with Same UV Modifier .

UPDATE 1.1 :

  • Lock Max UI for Better Performance , (Thanks to Barigazi) . 

  • Add Progress Bar .

  • Normal Execute will keep all the UVW Map Modifiers . 

  • AltExexute will Collapse the UVW/EditPoly Modifiers .

IMPORTANT NOTE : The script not made to deal with heavy objects , so please save your work before using it .

Videos

Tags: align, edges, rotation, edit poly, normal, UVW modifier

Comments (6)

Fix for regular polygon & group

dangtiendung · 2023-03-30

I realized when the object contains regular polygons, the script doesn't work properly because vx will coincide with vz, and vy = [0,0,0] (due to cross vx vz). Try with a box of size 200x200x200, you will understand what I mean.

I'm fixing this by ajust the vz if it coincide the vx:
if vx == vz then (t = vz.x; vz.x = vz.y; vz.y = vz.z; vz.z = t)

And I realized the script will also not work when selecting group, if Collapse UVW Modifiers is not enabled, because the select command. I think you should still leave obj = copy sel in both cases, if Collapse UVW Modifiers is turned off, then copy all modifiers from obj to sel in the end.

Your ideas are interesting anyway, I like it. Well worth the 5 bucks. :) 

obaida · 2023-08-11

First of all, thanks for using the script
Actually, I'm Glad I was able to pull the 5 bucks from you! :)
Second, about the Error/Request
The Script has 2 ways to be applied.
First by edge length, Second by Selecting Edges.
so, pick your favorite!
Thanks for the comment and Best Regards.

barigazy · 2022-06-19

Nice job man (+1). I played with your code a bit.
A faster solution will be with single Unwrap modifier, but your concept is OK for simple geometries.
Anyway ... avoid declaring local variables inside "for-loop" because they are always local inside brackets. I added "UNDO" fn and windows.sendmessage which decreases a bit of time.
I tested this on six “frame” object (like 2nd object on your video) and this is the result:

-> your code
time:17.464 memory:233392L
-> optimized code
time:15.248 memory:185452L

Of course it can be optimized more ;)
Keep up good work

Attachments

obaida · 2022-06-20

Thanks barigazy for the advice and the optimize , I appreciate that , you did a lot for this community , keep it up to :) .
btw , the script you share throwing error and max freeze .

barigazy · 2022-06-21

Predefined "GetFaceDegree" fn makes error. BTW ... only viewport and command panel are frozen but not MXS EDITOR and Listener
In these situations, when max freeze, just run this line alone

 windows.sendmessage (windows.getmaxhwnd()) 0x000B 1 1 

Here is the corrected code. Also, I added test scene code at the beginning

Attachments

obaida · 2022-06-22

Thanks for the fix .