Channelbox deselect attributes... looking for a plan

Channelbox deselect attributes... looking for a plan

dg3duy
Collaborator Collaborator
340 Views
2 Replies
Message 1 of 3

Channelbox deselect attributes... looking for a plan

dg3duy
Collaborator
Collaborator
import maya.cmds as cmds

# We store the current selection in a variable
currentSelection = cmds.ls(selection=True)

# deactivate render
cmds.refresh(suspend=True)

# Go to vertex mode
cmds.ConvertSelectionToVertices()

# Deselect the currently selected object
cmds.select(clear=True)

# We select the previously selected object again.
cmds.select(currentSelection)

# activate render
cmds.refresh(suspend=False)

Deactivate selection of attributes in the channelbox

This code when deselecting the object automatically deselects the selected attributes in the channelbox, but if I run the script continues to maintain the selection of the attributes, how is it possible if the code is written to deselect the object?🤔

0 Likes
Accepted solutions (1)
341 Views
2 Replies
Replies (2)
Message 2 of 3

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

I'm not quite sure why the channelbox keeps the selection in this case, but if you want to deselect all attributes in the channelbox, you can use this command:

cmds.channelBox("mainChannelBox", e= True, s= "")

 

I hope it helps!

Message 3 of 3

dg3duy
Collaborator
Collaborator

Excellent! thank you very much, it works very well!