Re: [Maya-Python] Re: Getting values from channels on Anim Layers using OpenMaya

20 views
Skip to first unread message

Ian Jones

unread,
Dec 3, 2019, 11:12:29 PM12/3/19
to Python Programming for Autodesk Maya
Sometimes it's helpful to understand what you are trying to do and what you are hoping to achieve along with the specific question, that can open up other solutions.

By the looks of it you're trying to build up a list of animated nodes and a way to query their values over time. While I don't know off the top of my head how I would go about evaluating the curves to get that composited result I would either try and pass the frame information via a context to the plug itself to capture the end result via MPlug.asDouble(MDGContext context) from the attribute directly. However if you're not after any random plug and you're okay with changing the time (even just temporarily) you can query the rotation from the transform in a simpler way: https://gist.github.com/shrtcww/94762de793493830d53ad363f492f217 

Ian 

On Tue, Dec 3, 2019 at 10:00 AM kiteh <kiteh...@gmail.com> wrote:
any insights on this, anyone?

--
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/26ed79a2-3ee2-4cf5-8d68-95796bec338e%40googlegroups.com.

kiteh

unread,
Dec 9, 2019, 8:07:22 PM12/9/19
to Python Programming for Autodesk Maya
Hey Ian, sorry for the late response and thanks for getting back despite I have removed the contents in the post.
In that script link you have provided, it is evaluating at every frame. Is it possible to not do that?

Ian Jones

unread,
Dec 10, 2019, 1:02:30 AM12/10/19
to Python Programming for Autodesk Maya
Anytime, you can grab just a single frame by skipping the calls to om.MGlobal.viewFrame(frame)


That's the bit that changes the frame to evaluate multiple frames.

Ian

On Mon, Dec 9, 2019, 5:07 PM kiteh <kiteh...@gmail.com> wrote:
Hey Ian, sorry for the late response and thanks for getting back despite I have removed the contents in the post.
In that script link you have provided, it is evaluating at every frame. Is it possible to not do that?

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

kiteh

unread,
Dec 10, 2019, 3:05:35 PM12/10/19
to Python Programming for Autodesk Maya
I think I may have made a miscommunication. Should have added in more information.

Given in a typical scene in which I have a locator with its rotational channels being animated in Frame 1-10.

If using the code that you have given, it does derives me the list of rotational values in these 10 frames, however, with the use of `om.MGlobal.viewFrame(frame)`, it also cause the scene/ timeline to scrub from Frame 1 and all the way to Frame 10.

Example output:
{u'|locator1': [(1.0, 1.0, 1.0, 0), (2.0, 2.0, 2.0, 0), ..., (10.0, 10.0, 10.0, 0))


My question would be, if it will be possible for the scene/ timeline to scrub through the 10 frames but at the same time, still outputs the same result as I would be expecting the above example output?
As soon as I removed `om.MGlobal.viewFrame(frame)`, while it still does give me results of the 10 frames, but the values are the same (stemming from frame 1 rotation)

 

Reply all
Reply to author
Forward
0 new messages