Normal-Based UV Generation with Python (Maya 2020)

Normal-Based UV Generation with Python (Maya 2020)

bendaviesorg
Explorer Explorer
1,326 Views
1 Reply
Message 1 of 2

Normal-Based UV Generation with Python (Maya 2020)

bendaviesorg
Explorer
Explorer

Using Python 2 in Maya 2020, I am currently trying to generate per-face, normal-based UVs. Although Maya's Python documentation lists numerous UV projection functions, there is seemingly no equivalent to the "texNormalProjection" MEL command that Maya uses internally for Normal-Based mapping from the UV Toolkit. Using the eval function with this command is not possible, and returns a recursion error.

 

It's possible to get the normal direction of a face using the cmds.polyInfo function with the faceNormals option, but no clear way to use these values for generation of UV maps for individual faces. I've experimented with plugging these values into the rotational values of polyPlanarProjection, but unfortunately haven't had much luck.

 

Does anyone have any suggestions regarding how to handle the generation of normal-based UV mapping using Python 2 for Maya? Thanks!

0 Likes
1,327 Views
1 Reply
Reply (1)
Message 2 of 2

jmreinhart
Advisor
Advisor

have you tried mel.eval()? 

import maya.mel as mel
mel.eval('texNormalProjection 1 1 ""')
0 Likes