Example usage of MDGContext:

import maya.OpenMaya as om
atTime10 = om.MDGContext(om.MTime(10))
import maya.OpenMaya as om
atTime10 = om.MDGContext(om.MTime(10))

selList = om.MSelectionList()
selList.add("pCube1.translateX")
plug = om.MPlug()
selList.getPlug(0, plug)
print "Value now: ", plug.asDouble()
print "Value at time 10:", plug.asDouble(atTime10)

...course, this isn't in a plugin, but I think the basic idea is the
same.

As for printing out more human readable names... I don't know of a way
that works for all nodes / attributes / whatever, but:

For an MObject: MObject.apiTypeStr() will give it's api type
For an MFnDependencyNode (or inherited class): MFnDependencyNode.name
() will give the maya name of the node
For an MPlug: .name(), .partialName(...), and .info() can all return
useful human-readable info
For an MFnAttribute(): .name(), .shortName() give the attribute name

- Paul

On Feb 21, 6:26 pm, Todd Widup <todd.wi...@gmail.com> wrote:
> Hi all,
>
> so I am finally starting to take a stab at writing a plugin and ran into a
> small block, mainly MDGContext.  Anyone have advice on it, like a small
> sample chunk of how it works.
>
> Also, someone told me that in the c++ api, there is a way to print an api
> function that would print it's real node/attr/whatever, rather than the
> pointer.  Is there anything like this for the PythonAPI?
>
> Thanks
> -todd
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to