pymel gathers a lot of api info behind the scenes.  the names of these
methods are still in flux, but they are useful for prototyping:


PyNode('persp').__apimdagpath__()
# Result: <maya.OpenMaya.MDagPath; proxy of <Swig Object of type 'MDagPath
*' at 0x7ffa3b555640> > #
p=PyNode('persp')
p.__apimdagpath__()
# Result: <maya.OpenMaya.MDagPath; proxy of <Swig Object of type 'MDagPath
*' at 0x13dc560> > #
p.__apimobject__()
# Result: <maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *'
at 0xd530a50> > #


-chad



On Fri, Jul 24, 2009 at 6:28 PM, pjrich <[email protected]> wrote:

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