Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Created July 12, 2016 18:13
Show Gist options
  • Save Onefabis/d5d926029f42c9f6a549fcd82e52e676 to your computer and use it in GitHub Desktop.
Save Onefabis/d5d926029f42c9f6a549fcd82e52e676 to your computer and use it in GitHub Desktop.
The script can toggle reference<=>default state of visible layers
import maya.cmds as cmds
layers = cmds.ls( type='displayLayer')
global chLayViz
try:
chLayViz
except NameError:
chLayViz = None
if chLayViz == 0 :
chLayViz = 1
elif chLayViz == 1 or chLayViz == None :
chLayViz = 0
for l in layers[1:]:
try:
if cmds.getAttr( l + '.visibility') == True:
if chLayViz == 1:
cmds.setAttr( l + '.displayType', 2)
elif chLayViz == 0:
cmds.setAttr( l + '.displayType', 0)
except:pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment