Hey Michael,
I copied some UVs into a new UV map and tried the same method and to
highlight what was happening I am selecting the UVs.
For the 2nd UV set however the method looks like it fails, when I select
the UVs it selects almost all the verts in the map.
I amended the code to give me the additional vert count i.e. verts only on
seams adn the output for the 2nd map is 166 which is not correct.
Can you replicate this error also?
Code and screenshot is below:
import pymel.core as pm
import maya.OpenMaya as OM
from itertools import izip
sel = pm.ls(sl=True)[0]
selName = str(sel.nodeName())
mSelList = OM.MSelectionList()
OM.MGlobal.getActiveSelectionList(mSelList)
sel = OM.MItSelectionList(mSelList)
path = OM.MDagPath()
sel.getDagPath(path)
fnMesh = OM.MFnMesh(path)
vertCount = OM.MIntArray()
vertList = OM.MIntArray()
uvCounts = OM.MIntArray()
uvIDs = OM.MIntArray()
#uvSet='map1'
set2 = 'uvSet'
tempSets = ['map1', 'uvSet']
additional = 0
#for uvSet in tempSets:
fnMesh.getVertices(vertCount, vertList)
#fnMesh.getAssignedUVs(uvCounts, uvIDs, uvSet)
fnMesh.getAssignedUVs(uvCounts, uvIDs, set2)
vertUVIDs = [set() for _ in range(fnMesh.numVertices())]
for vID, uvID in izip(vertList, uvIDs):
vertUVIDs[vID].add(uvID)
totalVertCount = sum(len(s) for s in vertUVIDs if len(s)>1)
additional += totalVertCount
print additional
totes = [i for i in vertUVIDs if len(i) > 1]
for i in totes:
for j in i:
pm.select('{0}.map[{1}]'.format(selName, j), add=True)
[image: Inline images 1]
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/ec93bf53-ff47-41f5-868e-4912c73b8cc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.