Last active
February 15, 2024 21:28
-
-
Save Onefabis/27556bbcfb5d2810a728b931dfa5f247 to your computer and use it in GitHub Desktop.
Convert UV shells to hard edges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.api.OpenMaya as om2 | |
import maya.cmds as mc | |
sel = om2.MSelectionList() | |
sel = om2.MGlobal.getActiveSelectionList() | |
for s in range( sel.length() ): | |
dp, comp = sel.getComponent( s ) | |
mItVtx = om2.MItMeshPolygon( sel.getDagPath(s) ) | |
uvsCount = om2.MFnMesh(sel.getDagPath(s)).numUVs() | |
dag = sel.getDagPath(s).extendToShape() | |
shapeUVIDs = om2.MFnMesh(dag).getUvShellsIds() | |
for n in range(shapeUVIDs[0]): | |
faces = mc.polyListComponentConversion( [ dag.partialPathName() + '.map[%i]' %x for x,v in enumerate(shapeUVIDs[1]) if v == n ], fuv=1, tf=1 ) | |
edges = mc.polyListComponentConversion( faces, ff=1, te=1, bo=1 ) | |
mc.polySoftEdge( edges, a=0, ch=1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment