PDA

View Full Version : Attributes Query


thrischan
12-29-2012, 03:03 AM
Hi everybody,

I'm trying to query some properties from an user defined attribute and the results are confusing to me. For example let's take the "keyable" flag.

Any help clarifying this would be appreciated. Thanks in advance! :D

whisperwing
01-03-2013, 06:56 AM
addAttr and attributeQuery both return if the attribute is keyable by default.
getAttr returns the current keyable setting.

cmds.addAttr("pSphere1", longName = "keyable", keyable=True)
cmds.addAttr("pSphere1.keyable", query=True, keyable=True) # return True
cmds.attributeQuery("keyable", node = "pSphere1", keyable = True) # return True
cmds.getAttr("pSphere1.keyable", keyable = True) # return True


cmds.addAttr("pSphere1", longName = "nonkeyable", keyable=False)
cmds.addAttr("pSphere1.nonkeyable", query=True, keyable=True) # return False
cmds.attributeQuery("nonkeyable", node = "pSphere1", keyable = True) # return False
cmds.getAttr("pSphere1.nonkeyable", keyable = True) # return False
cmds.setAttr("pSphere1.nonkeyable", keyable = True)
cmds.addAttr("pSphere1.nonkeyable", query=True, keyable=True) # return False
cmds.attributeQuery("nonkeyable", node = "pSphere1", keyable = True) # return False
cmds.getAttr("pSphere1.nonkeyable", keyable = True) # return True

thrischan
01-03-2013, 03:06 PM
Hi Whisperwing!

CGTalk Moderation
01-03-2013, 03:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.