Created
April 12, 2016 12:36
-
-
Save Onefabis/d39e364e8eb2a2e31e76f5097241e1bb to your computer and use it in GitHub Desktop.
Toggle all visible layers in 'layer editor' to Referenced/None state
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
layers = cmds.ls( type='displayLayer') | |
global chLayViz | |
#Checks if 'chLayViz' variable exists and if not - assign 'None' | |
try: | |
chLayViz | |
except NameError: | |
chLayViz = None | |
# Assign toggle value to 'chLayViz' var | |
if chLayViz == 0 : | |
chLayViz = 1 | |
elif chLayViz == 1 or chLayViz == None : | |
chLayViz = 0 | |
# Check all visible layers and toggle the 'Referenced' state | |
for l in layers[1:]: | |
if cmds.getAttr( l + '.visibility') == True: | |
if chLayViz == 1: | |
cmds.setAttr( l + '.displayType', 2) | |
elif chLayViz == 0: | |
cmds.setAttr( l + '.displayType', 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment