Dashboard_avatar
May 10, 2012
Post id: 310019 Report Item

Hello, I'm trying to add an option to turn off attributes in my channel box to a python script. I think i'm doing it correctly, but it doesn't seem to work. It locks them, but does not hide them

this is the script i'm working with. I checked python documentation and it looks like 'cb = false' and 'keyable = 'false' are what are supposed to turn off the visibility in the channel box, but it doesn't do it.

def lockRotate():
    selected = cmds.ls(sl = True)[0]
    cmds.setAttr (str(selected)+'.rotate',keyable = False, cb = False, lock = True)  

lockRotate(): 

Any help would be appreciated, thanks. 


 

Super-milk-chan-adult-swim-10041127-120-91
Jun 11, 2012
Post id: 310166 Report Item

For some reason I could only get the channels to hide if I specifically named each rotation axis. Bug?
















LockRotate

1
2
3
4
5
6
7
8
9


def LockRotate():
selected = cmds.ls(sl = True)
for obj in selected:
cmds.setAttr (obj +'.rotateX',keyable = False, cb = False, lock = True)
cmds.setAttr (obj +'.rotateY',keyable = False, cb = False, lock = True)
cmds.setAttr (obj +'.rotateZ',keyable = False, cb = False, lock = True)
 
LockRotate()
 




 



Dashboard_avatar
Jul 02, 2012
Post id: 310259 Report Item

my guess is that "rotate" is just a parent attribute, it doesn't contain any data itself - it is simply the container for "rotateX", "rotateY" and "rotateZ".

Since the channel box is displaying the individual attributes - X, Y and Z - it makes sense you would have to explicitly hide each one.