API to the rescue!

from maya.api import OpenMaya as om, OpenMayaAnim as oma

sel = om.MSelectionList()
sel.add("pCube1_translateY")
mobj = sel.getDependNode(0)

fn = oma.MFnAnimCurve(mobj)
for index in range(fn.numKeys):
    # Input == Time, which is returned in MTime format.
    # This converts it to a more familiar frame number
    frame = om.MTime(fn.input(index)).value

    # Values may also need to be converted to UI units, in this case
    # they are `kDistance` which is the same in both API and (default) UI unit
    value = fn.value(index)

    print("%s: %s" % (frame, value))

Some more examples of usage here:

   -
   
https://github.com/mottosso/cmdx/blob/def2bc9b46f996bc5f745565bc6adc58b3444551/cmdx.py#L1938
   - https://github.com/mottosso/cmdx#time


On Thu, 15 Oct 2020 at 22:15, Blackwell ST <gavincr...@gmail.com> wrote:

> Been stuck on this problem for a few days. I'm trying to figure out a way
> to query an "animCurveUL" node's values within "Anim Curve Attributes".[image:
> Curve.jpg]
>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/01d6edc9-e6a9-401b-b571-2a6572923b3an%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/01d6edc9-e6a9-401b-b571-2a6572923b3an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODtHeuizdKLs8%2BD2DcTbSfMKUdZxhkPc6jg2AWWG%2BEfDg%40mail.gmail.com.

Reply via email to