PDA

View Full Version : extracting UVs with Python API


djtomservo
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. . .

tbaypaul
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()

x.createFromList(pArray,2)

y = x.asInt2Ptr()

sel = om.MSelectionList()

sel.clear()

sel.add("pSphere1")

objDag = om.MDagPath()

sel.getDagPath(0, objDag)

amesh = om.MFnMesh(objDag)

amesh.getEdgeVertices(0,y)

print x.getInt2ArrayItem( y, 0, 0 )

print x.getInt2ArrayItem( y, 0, 1 )

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

djtomservo
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.

CGTalk Moderation
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.