Go to: Synopsis. Return value. Flags. Python examples.
dimWhen(
string string
, [clear=boolean], [false=boolean], [true=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
dimWhen is undoable, NOT queryable, and NOT editable.
This method attaches the named UI object (first argument) to the named condition (second argument) so that the object will be dimmed when the condition is in a particular state.This command will fail if the object does not exist. If the condition does not exist (yet), that's okay --- a placeholder will be used until such a condition comes into existence.
The UI object should be one of two things, either a control or a menu item.
None
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
clear(c)
|
boolean
|
![]() |
||
|
||||
false(f)
|
boolean
|
![]() |
||
|
||||
true(t)
|
boolean
|
![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # Create a window with a menu item and button that will dim if # there are no objects selected in the scene. # window = cmds.window(menuBar=True, title='dimWhen Example') cmds.menu( label='Edit' ) menuItem = cmds.menuItem(label='Delete Selection', command='cmds.delete()') cmds.columnLayout(adjustableColumn=True) button = cmds.button(label='Delete Selection', command='cmds.delete()') # Create a few buttons to create some objects, select all the objects in # the scene, and clear the selection. # cmds.button(label='Create Objects', command='cmds.sphere(); cmds.cone(); cmds.cylinder();') cmds.button(label='Select All', command='cmds.select(all=True)') cmds.button(label='Select Nothing', command='cmds.select(clear=True)') # Add the dim conditions. # cmds.dimWhen( 'SomethingSelected', button, false=True ) cmds.dimWhen( 'SomethingSelected', menuItem, false=True ) cmds.showWindow( window )