Skip to content

Instantly share code, notes, and snippets.

@rondreas
Last active October 5, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondreas/03d03b09ad13096635696f018103fecc to your computer and use it in GitHub Desktop.
Save rondreas/03d03b09ad13096635696f018103fecc to your computer and use it in GitHub Desktop.
import pymel.core as pm
import maya.mel as mel
# Get current selection
selected = pm.selected()
mel.eval("ConvertSelectionToUVs")
# Unfold, straighten, unfold
pm.u3dUnfold(selected, ite = 1, p = 0, bi = 1, tf = 1, ms = 1024, rs = 0)
mel.eval('texStraightenUVs "UV" 30')
pm.u3dUnfold(selected, ite = 1, p = 0, bi = 1, tf = 1, ms = 1024, rs = 0)
pm.hilite(pm.ls(hilite=True), r=True) # Solves highlighting of UVs by highliging... whatever is highlighted?
# Select the previous selection and convert to UVShell.
pm.select(selected, r=True)
mel.eval("ConvertSelectionToUVShell")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment