It's a trade off, but you can always hide those details in a utility module
or something.
# utils.py
import maya.api.OpenMaya as om2
def asSelectionList(iterable):
selectionList = om2.MSelectionList()
for each in iterable:
selectionList.add(each)
return selectionList
def asDagPaths(iterable):
selectionList = asSelectionList(iterable)
for i in xrange(selectionList.length()):
yield selectionList.getDagPath(i)
# foo.py -- usage code
import maya.api.OpenMaya as om2
import maya.cmds as cmds
import utils # utility module
for meshPath in utils.asDagPaths(cmds.ls(type='mesh')):
fnMesh = om2.MFnMesh(meshPath) # got it!
--
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/CAPamJi8%2BpW4xWfsoUkk%2BDyE7mRutd39HFJKBs7fQYNbiE0mtdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.