You could also use pymel , the AnimCurve class is just  derived from  
openMaya code anyway. Apologies for using your example code Marcus : )

import pymel.core as pm

pm.select("pCube1_translateY")
animCurve = pm.selected()[0]

for index in range(animCurve.numKeys()):
    frame = animCurve.getTime(index)
    value = animCurve.getValue(index)

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


On Friday, 16 October 2020 at 19:35:46 UTC+1 Marcus Ottosson wrote:

> Indeed it does, if you wanted to find those tangent type values you can 
> find those there too.
>
> Here's the documentation page for that particular so-called "function set".
>
> - 
> https://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__py_ref_class_open_maya_anim_1_1_m_fn_anim_curve_html
>
> On Fri, 16 Oct 2020 at 18:23, Blackwell ST <gavin...@gmail.com> wrote:
>
>>
>> Omg, thank you so much. I need to look into this Maya.API module more. 
>> Seems to have more options than maya.cmds
>> On Friday, October 16, 2020 at 12:39:45 AM UTC-5 Marcus Ottosson wrote:
>>
>>> 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 <gavin...@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_m...@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_m...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/0db677cf-7e4a-47e4-990c-2756f6231abdn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/0db677cf-7e4a-47e4-990c-2756f6231abdn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
-- 
*MILK <http://www.milk-vfx.com/>** VISUAL EFFECTS**
*

Threeways House,




40-44 Clipstone Street London, W1W 5DW

Tel: *+44 (0)20 3697 8448*

* *

This message is intended solely for the addressee and may contain 
confidential and/or legally privileged information. Any use, disclosure or 
reproduction without the sender’s explicit consent is unauthorized and may 
be unlawful. If you have received this message in error, please notify Milk 
VFX immediately and permanently delete it. Any views or opinions expressed 
in this message are solely those of the author and do not necessarily 
represent those of Milk VFX. 

By engaging in professional correspondence 
with Milk VFX, we may store your contact information for future reference. 
This is in line with Milk’s Privacy policy which can be found here. 
<http://www.milk-vfx.com/wp-content/uploads/2018/05/Milk-VFX-Privacy-Policy-May-2018.pdf>
 
Milk Visual Effects is a registered limited company: 0844 1256. The 
registered company address is Threeways House, 40-44 Clipstone Street, 
London, W1W 5DW.

-- 
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/77cdb321-a12a-4651-9078-0e5605acc77bn%40googlegroups.com.

Reply via email to