Fenix Animator
Fenix Animator

Reputation: 13

Deselect key of the current frame located on the timeline

Of the keys that are selected, deselect only those that are in the current animation frame.

The code selects the current key and one before and one after the current time, I just need to deselect the one that is currently located on the timeline and I don't know how to do it.

Here is a video example of how I want it to be deselected. enter image description here

keyA = mc.currentTime(q = True)
ttA = mc.findKeyframe(t = (keyA,keyA), w = "previous")
ttB = mc.findKeyframe(t = (keyA,keyA), w = "next")

cmds.selectKey(animation='objects',add=False,t=(ttA,ttB))   

Upvotes: 0

Views: 94

Answers (1)

Fenix Animator
Fenix Animator

Reputation: 13

Here is the answer, the solution

import maya.cmds as mc 
keyA = mc.currentTime(q = True) 
mc.selectKey(animation = 'objects', k = True,time = (keyA,keyA), rm = True)

Upvotes: 0

Related Questions