When getting the dag path via python to pass it to an OpenMaya
function, this seems to be the way it's done:

### get dag of selected object
import maya.OpenMaya as api

def nameToDag( name ):
  sel = api.MSelectionList()
  sel.add( name )
  node = api.MDagPath()
  sel.getDagPath( 0, node )
  return node

objectName = selected()[0].longName()
dag = nameToDag( objectName )
###

And then I can use that with other OpenMaya modules like so:

meshFn = api.MFnMesh()
meshFn.setObject( dag )

...it works, but is this really the best way to do this? Is there any
way to pass the path directly to the MFnMesh object? Is there any
shortcut with Pymel?

Thanks!
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to