Andrew
unread,Aug 25, 2008, 1:28:36 PM8/25/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to python_inside_maya
Hey all, so I'm building a polygon surface exporter with which I need
to extract info for each face vertex. I am trying to do this using
MItMeshFaceVertex, however it doesn't recognize changes to the mesh
such as changing the vertices positions, even if I save the scene and
reload it. It does recognize the changes once I do something like Poke
Face or Split Poly Tool. In contrast, getting positions using
MItMeshPolygon or MFnMesh works all the time, which I don't understand
why this is different.
This is my first project using the API, so any insight as to what's
going on would be very helpful. I'm running this test with a simple
poly plane in the scene:
cmds.polyPlane(w=1,h=1,sx=1,sy=1)
#---------------------------------------------
import maya.OpenMaya as om
selList = om.MSelectionList()
om.MGlobal.getActiveSelectionList( selList )
sel_iter = om.MItSelectionList( selList, om.MFn.kMesh )
node = om.MDagPath()
sel_iter.getDagPath( node )
point_list = []
vertFaceIter = om.MItMeshFaceVertex( node )
while not vertFaceIter.isDone():
point_list.append( vertFaceIter.position( om.MSpace.kTransform ) )
vertFaceIter.next()
print ['%.1f, %.1f, %.1f'%(p.x,p.y,p.z) for p in point_list ]
pointArray = om.MPointArray()
polyIter = om.MItMeshPolygon( node )
polyIter.getPoints( pointArray, om.MSpace.kTransform )
print ['%.1f, %.1f, %.1f'%(p.x,p.y,p.z) \
for p in [pointArray[i] for i in xrange(pointArray.length())] ]
pointArray = om.MPointArray()
meshFn = om.MFnMesh( node )
meshFn.getPoints( pointArray, om.MSpace.kTransform )
print ['%.1f, %.1f, %.1f'%(p.x,p.y,p.z) \
for p in [pointArray[i] for i in xrange(pointArray.length())] ]