Monday, July 14, 2008

MaxScript to the Rescue

Here is the Softimage XSI UV editor:


And here is the 3D Studio Max 9 UV editor:


It's just a matter of taste which one you prefer. The artists in my current project use XSI for UVW unwrapping, but I just like the neater user interface in MAX better.

One thing I like very much from the XSI Texture editor and that I haven't been able to find in Max are these fellows here:


They can be used to collapse UV coordinates in the X and Y axis respectively, and not being able to find this feature in Max was haunting me.

So I set out on a journey to my first MaxScript. Here it is, and as dumb as it may seem, I've already found it very useful.



MacroScript CollapseX category:"CustomUVW" buttonText:"Collapse X"
(
sel_vert = $.Unwrap_UVW.getSelectedVertices()
sel_vert_array = sel_vert as array
if ( 0 < sel_vert_array.count ) then
(
v1 = sel_vert_array[1]
sel_pos = $.Unwrap_UVW.getVertexPosition 0 v1
$.Unwrap_UVW.moveX sel_pos.x
)
)

MacroScript CollapseY category:"CustomUVW" buttonText:"Collapse Y"
(
sel_vert = $.Unwrap_UVW.getSelectedVertices()
sel_vert_array = sel_vert as array
if ( 0 < sel_vert_array.count ) then
(
v1 = sel_vert_array[1]
sel_pos = $.Unwrap_UVW.getVertexPosition 0 v1
$.Unwrap_UVW.moveY sel_pos.y
)
)

MacroScript CollapseZ category:"CustomUVW" buttonText:"Collapse Z"
(
$.Unwrap_UVW.moveZ 0
)



I don't even bother with finding the selection centre, as all I really care about is that they share the same value for the coordinate.

The next step: Add it somewhere in the user interface and rejoice.

2 comments:

rip said...

Search for "Unwrap Tools", i think they do exactly what you want and more.

Pau said...

Downloaded it just now and it looks really great!

Don't really have much time to test it now, but "Unwrap Tools" seems to address most of what I feel is missing in the default max unwrap uvw tools.

Thanks a lot!

BTW, checked your page, some very nice looking projects there.