Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How can I register the different processes for each panel obtained by getPanel, timeSliderClearKey and cmds.cutKey(sl = True), into one hotkey?

How can I register the different processes for each panel obtained by getPanel, timeSliderClearKey and cmds.cutKey(sl = True), into one hotkey?

amaterasu-qbb
Collaborator Collaborator
300 Views
1 Reply
Message 1 of 2

How can I register the different processes for each panel obtained by getPanel, timeSliderClearKey and cmds.cutKey(sl = True), into one hotkey?

amaterasu-qbb
Collaborator
Collaborator

TimeSlider doesn't allow me to clear a key by selecting Translate, Rotate, Scale, or X, Y, or Z. That's why I need to call timeSliderClearKey. In the graph editor, I need to call cmds.cutKey(sl = True).

timeSliderClearKey;
import maya.cmds as cmds

cmds.cutKey(sl = True)

So I guess I can use Python command and pymel, but how do I change the hotkey process in getPanel?

 

Thanks,

0 Likes
301 Views
1 Reply
Reply (1)
Message 2 of 2

amaterasu-qbb
Collaborator
Collaborator

It doesn't work, but I created a concept. I will try to make it work from now on.

 

 

import maya.cmds as cmds
import pymel.core as pm

activePanel = cmds.getPanel(wf = True)

# To delete animation keys in Graph Editor.
if cmds.modelEditor(activePanel, q = True):
    cmds.cutKey(an = "keys", cl = True)

# To delete animation keys in Time Slider.
else:
    pm.timeSliderClearKey()

 

I got this error message,

 

// Error: activePanel = cmds.getPanel(wf = True)
// Error: Line 4.13: Syntax error

 

Any feedback is welcome.