I do as Janos suggested, worked quite well and pretty fast. We had quite
heavy props from speed tree and it wasn't that bad
def getMeshUVBounds(mapName, mesh):
mesh = pCore.PyNode(mesh)
uList, vList = mesh.getUVs(mapName)
if not uList:
uList = [0]
if not vList:
vList = [0]
return [[min(uList), min(vList)], [max(uList), max(vList)]]
def getMeshUVBoundsAsUDIM(mapName, mesh):
udimMap = range(1001, 1011)
bounds = getMeshUVBounds(mapName, mesh)
minU, maxV = int(math.trunc(bounds[0][0])), int(round(bounds[1][1] + 0.5))
return udimMap[minU] + (10 * (maxV - 1))
def isUDIMOverlappingBoundaries(mapName, mesh):
bounds = getMeshUVBounds(mapName, mesh)
if int(bounds[0][0]) == int(bounds[1][0]) and int(bounds[0][1]) ==
int(bounds[1][1]):
return False
else:
return True
On Friday, 1 May 2015 07:37:06 UTC+1, Chad_Fox wrote:
>
> Hey everyone,
>
> I've been brute force checking UV coords to determine what UDIMs any
> selected object(s) are using, but my simple python query for all UVs and
> checking each of their coords is painfully slow and in some cases unusable
> in scenes my team will be working with.
>
> Do any of you have any snippets of python / python api code that can
> efficiently return a large list of occupied UDIMs from selected object?
>
> Appreciate any help you may be able to offer, thanks!
>
> Chad
>
--
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/31ab4cda-6944-4bd1-9d8a-ef0b5fa2c3a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.