Created
July 12, 2016 18:13
-
-
Save Onefabis/d5d926029f42c9f6a549fcd82e52e676 to your computer and use it in GitHub Desktop.
The script can toggle reference<=>default state of visible layers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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