vrnAutoMap (Maya MEL Script)

File

----------------------------------------------------------------
vrnAutoMap.mel - MEL Script
----------------------------------------------------------------
DESCRIPTION:

Automatically creates oriented UVs for the selected meshes and a UV layout for

all the objects in the current selection for a single texture sheet.

Recommended usage: Quick and dirty one click UVs

Use the "switch" argument as necessary depending on desired function (see USAGE below).

What the script does:

1. Flattens the object with a Planar Projection on the current UV set.

2. All hard edges are converted to UV cuts.

3. Unfolds everything selected.

4. Orients all selected UV shells (Requires Maya 2017 Update 4 or newer)

5. Applies Layout UVs.

PS: Final UVs might need readjusting depending on soft/hard edge placement and final texture resolution and UV shell spacing. The script calls the UV Layout command with the latest UV Layout options set up by the user.

----------------------------------------------------------------
INSTALLATION:

1. Copy to My Documents/maya//scripts

2. If you plan on using this as a shelf button, feel free to copy the icon vrnAutoMap.png to

My Documents/maya//prefs/icons

3'. Restart Maya

or

3". Type "rehash" (without quotes) in the Script Editor and press the number keypad Enter button.

----------------------------------------------------------------
USAGE:

IMPORTANT: If you are upgrading to v1.2, please note the change in arguments for the main function!

Call the function with these three arguments:

vrnAutoMap(x,y,z) replace x, y, z as follows:


x:First argument controls how soft/hard edges are handled.

x=0

Script will use existing soft/hard edges. $angle is ignored.

x=1

Script will add soft/hard edges by $angle from a "promptDialog". Default value is 55 degrees.

Use this if your mesh does not have soft/hard edges.

Pro Tip: After running this use the new "3D Cut and Sew UV Tool" in Maya 2018 to cut, sew and unfold any remaining issues with your mesh. Make sure to check out the tool options to check out the specific shortcuts for this tool!


y: Second argument controls the texel resolution of the final pack in px/Unit as available in the UV Toolkit

y=0

Script will ignore map size and will pack everything and fill the 0-1 UV space.

y<>0

Will scale all shells to desired texel density and then pack to the lower left side of the 0-1 UV space.


z: Last argument is the map size, as available in the UV Toolkit. 

If y=0, this is ignored.

Otherwise set as desired, preferably a power of 2.

Pro Tip: After running this script use the new "3D Cut and Sew UV Tool" in Maya 2018 to cut, sew and unfold any remaining issues with your mesh. Make sure to check out the tool options to check out the specific shortcuts for this tool ;)

----------------------------------------------------------------

Detailed tutorial:

http://vrntech.ro/blog/n7n7/maya-mel-quick-uvs-script-vrnautomap

----------------------------------------------------------------REQUIREMENTS:
Maya 2017 Update 4 and up.

----------------------------------------------------------------

VERSION HISTORY:

0.1 - 31 aug 2017 

  • initial internal version


0.2 - 12 dec 2017 

  • added 2018 version


1.0 - 12 jan 2018 

  • rewrote to eliminate errors
  • simplified readme section
  • initial public release!


1.1 - 12 feb 2018

  • fixed Maya 2017 error


1.2 - 5 jul 2018

  • fixed more Maya 2017 errors
  • added inputs to control final map resolution

----------------------------------------------------------------CONTACT INFO:
Valentin Nadolu

vrntech.ro

You can use the script for personal or/and commercial work.

If you do find it useful, please give me credit in your work where possible!

----------------------------------------------------------------

Extended Use License
$0
License: Extended Commercial License
Stock Assets

For use on an unlimited number of commercial projects with no limits on sales or views.

Learn More
Files (3)
vrnAutoMap_V1
7z /
3.2 KB
vrnAutoMap_V1.1
7z /
3.2 KB
vrnAutoMap_V1.2
7z /
3.6 KB