View Full Version : extracting UVs with Python API

07 July 2007, 05:16 PM
has anyone had any luck extracting UVs via the Python API using any of the methods in MItMesh(Vertex, FaceVertex, or MeshPolygon), or MFnMesh? My stumbling block currently seems to be trying to find the python equivalent of a float2. . .

07 July 2007, 06:03 PM
this might gets the vertex ids of edge 0 using is similar, but not the same.

# I am not using an iterator yet, just querying vert ids for edge 0

#create a pSphere

import maya.OpenMaya as om

pArray = [0, 0]

x = om.MScriptUtil()


y = x.asInt2Ptr()

sel = om.MSelectionList()



objDag = om.MDagPath()

sel.getDagPath(0, objDag)

amesh = om.MFnMesh(objDag)


print x.getInt2ArrayItem( y, 0, 0 )

print x.getInt2ArrayItem( y, 0, 1 )

07 July 2007, 06:08 PM
yep, just did some reading on MScriptUtil. . .that was exactly what i was looking for. Thanks!

07 July 2007, 07:34 PM
just a quick note for anyone else doing this sort of work, you need the 8.5 service pack 1 for some fixes to MScriptUtil that make accessing your array items possible.

CGTalk Moderation
07 July 2007, 07:35 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.