View Full Version : extracting UVs with Python API
07-20-2007, 06: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-20-2007, 07:03 PM
this might help....it gets the vertex ids of edge 0 using MFnMesh.....it 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()
amesh = om.MFnMesh(objDag)
print x.getInt2ArrayItem( y, 0, 0 )
print x.getInt2ArrayItem( y, 0, 1 )
07-20-2007, 07:08 PM
yep, just did some reading on MScriptUtil. . .that was exactly what i was looking for. Thanks!
07-20-2007, 08: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.
07-20-2007, 08: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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.