Script to turn off a bunch of stuff in the viewport


#1

I’m trying to figure out how to turn off a bunch of stuff in the viewport in one click/shelf button. Tried copying and pasting from the Script Editor but it doesn’t work. Could someone help me? Thanks in advance!!

modelEditor -e -controllers 0 -nurbsSurfaces 0 -cv 0 -hulls 0 -subdivSurfaces 0 -planes 0 -joints 0 -ikHandles 0 -deformers 0 -dynamics 0 -particleInstancers 0 -fluids 0 -hairSystems 0 -follicles 0 -nCloths 0 -nParticles 0 -nRigids 0 -dynamicConstraints 0 -locators 0 -dimensions 0 -pivots 0 -textures 0 -strokes 0 -pluginShapes 0 -clipGhosts 0 -grid 0;


#2

If OP still needs it (or someone else):

import pymel.core as pmc

modelPanel = pmc.getPanel(wf=True)  # gets active panel
edits = {'cv':1, 'pm':0, 'nc':0, 'ca':0}    # all desired edits go here - keys are valid flags (values: 0 means Off, 1 means On)

pmc.modelEditor(modelPanel, e=True, **edits)    # apply edits to active panel

Regards,
Darko