Maya – Set mesh select state
I found this to be very useful when working with rigs and animators. This will either make all mesh selectable, or not selectable.
from maya import cmds
def mesh_select_state(state=False):
if state is False:
display_type = 2
elif state is True:
display_type = 0
for mesh in cmds.ls(type="mesh"):
try:
cmds.setAttr(mesh + ".overrideEnabled", 1)
cmds.setAttr(mesh + ".overrideDisplayType", display_type)
except Exception as error:
print "Couldn't override mesh '{}' because of {}".format(mesh, error)
# To make all mesh selectable set state=True
# To make all mesh NOT selectable, run func without args or state=False
mesh_select_state(state=True)
Some truly fantastic information, Glad I discovered this.