Created
August 20, 2022 09:23
-
-
Save Roumenov/d35831dade973d0233b2bb0b3ceaf9f4 to your computer and use it in GitHub Desktop.
iterate visibility layers and turn them off(seems to make a difference for performance when running batch ops on scenes). Haven't profiled so who knows, but things that crashed now don't. Practical heuristic ๐
This file contains 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 pymel.core as pm | |
layers = pm.ls(type="displayLayer") | |
for item in layers: | |
if 'defaultLayer' in item.name(): | |
pass | |
else: | |
current_viz = item.getAttr("visibility") | |
print(item, current_viz) | |
if item.hasAttr('visibility'): | |
item.setAttr('visibility', False) | |
# for SOME reason, the button doesn't update itself when you change the layer value, lolll | |
#i thought this flipped that but now it's not working, will check back on never, maybe wrong attr name | |
#item.layerButton(edit=True, layerVisible=on) | |
item.setAttr('visibility',0,0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment