Better Way of Querying Selected Keyframes?

346 views
Skip to first unread message

Wesley Chandler

unread,
Jun 22, 2016, 2:21:01 PM6/22/16
to Python Programming for Autodesk Maya
Hey guys!

Does anyone know a better way of querying selected keyframes in an animation curves for multiple objects?  
My overall objective is to save a variable that has the selection of keyframes stored, that I can later on make edits to.



Currently, I can query the name of the curves and the selected keyframes separately:

curve_names =  cmds.keyframe(q=True, name=True)
selected_index_keys
=  cmds.keyframe(q=True, selected=True)


But if I wanted to do a simple edit to that selection, I can't just affect the selected keyframes:


magically_combined_selection = curve_names + selected_index_keys

cmds
.keyframe(magically_combined_selection , relative=True, timeChange=5)




I feel like there should be an easy way to query selected keyframes that you can just pass through cmds.keyframe to edit as a whole.


Any ideas? =)

Justin Israel

unread,
Jun 23, 2016, 5:37:35 AM6/23/16
to Python Programming for Autodesk Maya
Since the keyframe command will operate on the total selection (all the selected keyframes of all the selected objects), could you just manage the selection list via the selectKey command? You could loop over your mapping of objects to keys and add them to the total selection.

Would that work?

--
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/83f0d5c7-c13b-4915-b1aa-6400f7589c1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wesley Chandler

unread,
Jun 24, 2016, 3:11:15 PM6/24/16
to Python Programming for Autodesk Maya
Hey Justin!

That sounds like a good idea! I'll give it a go!

Cheers!



On Thursday, June 23, 2016 at 5:37:35 AM UTC-4, Justin Israel wrote:
Since the keyframe command will operate on the total selection (all the selected keyframes of all the selected objects), could you just manage the selection list via the selectKey command? You could loop over your mapping of objects to keys and add them to the total selection.

Would that work?

On Thu, Jun 23, 2016 at 6:21 AM Wesley Chandler <heyw...@gmail.com> wrote:
Hey guys!

Does anyone know a better way of querying selected keyframes in an animation curves for multiple objects?  
My overall objective is to save a variable that has the selection of keyframes stored, that I can later on make edits to.



Currently, I can query the name of the curves and the selected keyframes separately:

curve_names =  cmds.keyframe(q=True, name=True)
selected_index_keys
=  cmds.keyframe(q=True, selected=True)


But if I wanted to do a simple edit to that selection, I can't just affect the selected keyframes:


magically_combined_selection = curve_names + selected_index_keys

cmds
.keyframe(magically_combined_selection , relative=True, timeChange=5)




I feel like there should be an easy way to query selected keyframes that you can just pass through cmds.keyframe to edit as a whole.


Any ideas? =)

--
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+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages