Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Filtering key ticks in Maya timeline via script

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
andy.lathamCJTQT
445 Views, 6 Replies

Filtering key ticks in Maya timeline via script

andy.lathamCJTQT
Contributor
Contributor

Hey!

 

If you select an object in Maya and highlight an attribute in the channel box, key ticks will be displayed on the timeline only for that attribute. I'd like to achieve the same result with a script (i.e. not needing to highlight the attribute in the channel box), but I can't find any way to do it. I can select the appropriate animation node and see just those key ticks, but I want to retain control of the object itself in the viewport at the same time.

 

Does anyone know how to achieve this?

 

Thanks!

Filtering key ticks in Maya timeline via script

Hey!

 

If you select an object in Maya and highlight an attribute in the channel box, key ticks will be displayed on the timeline only for that attribute. I'd like to achieve the same result with a script (i.e. not needing to highlight the attribute in the channel box), but I can't find any way to do it. I can select the appropriate animation node and see just those key ticks, but I want to retain control of the object itself in the viewport at the same time.

 

Does anyone know how to achieve this?

 

Thanks!

6 REPLIES 6
Message 2 of 7
Kahylan
in reply to: andy.lathamCJTQT

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

This is a python script that highlights an attribute by name in the channelbox:

 

import maya.cmds as mc

def selChannelInBox(c = ""):
    sel = mc.ls(selection = True)[-1]
    mc.channelBox("mainChannelBox", e = True, s ="{0}.{1}".format(sel, c))
    
selChannelInBox(c = "ty")

 

I hope this helps!

 

 

 

0 Likes

Hi!

 

This is a python script that highlights an attribute by name in the channelbox:

 

import maya.cmds as mc

def selChannelInBox(c = ""):
    sel = mc.ls(selection = True)[-1]
    mc.channelBox("mainChannelBox", e = True, s ="{0}.{1}".format(sel, c))
    
selChannelInBox(c = "ty")

 

I hope this helps!

 

 

 

Message 3 of 7
andy.lathamCJTQT
in reply to: Kahylan

andy.lathamCJTQT
Contributor
Contributor

Thanks so much for this! It's exactly what I was looking for! 🙂

0 Likes

Thanks so much for this! It's exactly what I was looking for! 🙂

Message 4 of 7

andy.lathamCJTQT
Contributor
Contributor

Actually, could anyone explain how the "s" flag in channelBox() works? It isn't mentioned in the documentation for some reason! @Kahylan 

 

I'm trying to work out how to select multiple channels.

0 Likes

Actually, could anyone explain how the "s" flag in channelBox() works? It isn't mentioned in the documentation for some reason! @Kahylan 

 

I'm trying to work out how to select multiple channels.

Message 5 of 7
Kahylan
in reply to: andy.lathamCJTQT

Kahylan
Advisor
Advisor

The select Flag was introduced with the interface change from Maya 2015 to 2016, so it's not in the 2011 doc that first shows up on google.

 

https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/channelBox.html

 

To select multiple attributes you just need to insert a list of strings with attribtue names instead of a single attribute name in the s flag

0 Likes

The select Flag was introduced with the interface change from Maya 2015 to 2016, so it's not in the 2011 doc that first shows up on google.

 

https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/channelBox.html

 

To select multiple attributes you just need to insert a list of strings with attribtue names instead of a single attribute name in the s flag

Message 6 of 7
andy.lathamCJTQT
in reply to: Kahylan

andy.lathamCJTQT
Contributor
Contributor

Thanks @Kahylan!

Thanks @Kahylan!

Message 7 of 7
brentmc
in reply to: andy.lathamCJTQT

brentmc
Autodesk
Autodesk

Hi,

The -s/-select flag selects the attribute in the channel box.

Ooops, I see @Kahylan has already answered. What they said! 🙂

Brent McPherson
Principle Engineer

Hi,

The -s/-select flag selects the attribute in the channel box.

Ooops, I see @Kahylan has already answered. What they said! 🙂

Brent McPherson
Principle Engineer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report