Can't lock attrEnumOptionMenu ?


#1

Hello ,

So I have created an AE Template and wrote additional python code that makes it possible to “grey out” certain attributes depending on whether a checkbox is true or false.
My python code works, except when the attribute to be locked is a drop down enumerated menu (attrEnumOptionMenu). Does anyone know why locking this type of attribute does not grey it out in the UI?

Below I have pasted some python code. The lockIPD() function works and - depending on the value of the “deep_Reflections” checkbox - locks/unlocks the “IPD” attribute perfectly , which is a float field value. The lockRenderGlass() function however does not lock/unlock the “glass_Rendering_Type” attribute (or at least the drop down menu does not get greyed out in the UI) even though it is very similar to the previous function. What am I missing?

example python code:

import maya.cmds as cmds
node = cmds.createNode(‘MyMayaCameraNode’)

def lockIPD():
value = cmds.getAttr(’{}.deep_Reflections’.format(node))
print(value)
if(value == False) :
cmds.setAttr(’{}.IPD’.format(node), lock=True)
else :
cmds.setAttr(’{}.IPD’.format(node), lock=False)

def lockRenderGlass():
value = cmds.getAttr(’{}.glass_Rendering’.format(node))
print(value)
if(value == False) :
cmds.setAttr(’{}.glass_Rendering_Type’.format(node), 0)
cmds.setAttr(’{}.glass_Rendering_Type’.format(node), lock=True)
value = cmds.getAttr(’{}.glass_Rendering_Type’.format(node))
print(value)
else :
cmds.setAttr(’{}.glass_Rendering_Type’.format(node), lock=False)
value = cmds.getAttr(’{}.glass_Rendering_Type’.format(node))
print(value)

cmds.scriptJob(attributeChange=[’{}.glass_Rendering’.format(node), lockRenderGlass] )
cmds.scriptJob(attributeChange=[’{}.deep_Reflections’.format(node), lockIPD] )

Thank you