I can switch off NURBS view in a specific window with
modelEditor -e -nurbsCurves $b modelPanel3;
where modelPanel3 is the viewport of choice.
How do I do that for all viewports currently visible? Is there a what to get an to return such information as an array or do you have to loop through a number and see if the view port visibility is true?
I'll answer my own question then:
To loop through the viewports
# import python maya commands
import maya.cmds as cmds
# Create a list of ALL viewports
viewports = cmds.getPanel( all = True)
# Get the current viewport
vp = cmds.getPanel( withFocus = True) # current viewport
current = cmds.modelEditor( vp, q = True, nurbsCurves = True)
for view in viewports:
if 'modelPanel' in view:
# check to see if the item in lists is a viewport
# is one of the model panels.
# The list is quite big and we only need up to four
print view # prints the current viewport
#Swap the NURBS visibility around
cmds.modelEditor( view, edit = True, nurbsCurves = not(current))
I hope that helped me as much as it did you. Yes it did. Thanks