Can't lock attrEnumOptionMenu ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2018
Can't lock attrEnumOptionMenu ?

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))
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))
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 ))
else :
cmds.setAttr('{}.glass_Rendering_Type'.format(node ), lock=False)
value = cmds.getAttr('{}.glass_Rendering_Type'.format(node ))

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

Thank you
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:50 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.