Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Is it possible to hide and restore windows in Maya?

Is it possible to hide and restore windows in Maya?

michaelhubbard
Contributor Contributor
335 Views
0 Replies
Message 1 of 1

Is it possible to hide and restore windows in Maya?

michaelhubbard
Contributor
Contributor
Does Maya offer any support for restoring open windows after they have been closed?

What I am trying to do is create a "clean" save that does have any open windows, but I do not want to disturb the artist workflow by saving off an entirely different scene and then reverting back to the original (and taking a lot of loading time), or by destroying all their open windows when they click save.

I was hoping that setting the windows visible attribute to False and then switching it back to True would give me this result, but Maya destroys the window once it's visibility is set to False.

For example, the code below would hopefully just quickly toggle the visibility of the window, but once it is set visible=False it is gone for good.

Is there another way to store the current windows that are open in Maya and retrieve that state again?

def get_user_windows():
'''
Get the non-builtin windows as a list.
'''
all_windows = cmds.lsUI(windows=True)
builtin_windows =

return

user_windows = get_user_windows()

for user_window in user_windows:
cmds.window(user_window, edit=True, visible=False)

# Running this immediately and the window does not turn visible
# Running this after an idle cycle and you get runtime error "Object not found"
for user_window in user_windows:
cmds.window(user_window, edit=True, visible=True)
Game Programmer/Technical Artist: http://michaelhubbard.ca
0 Likes
336 Views
0 Replies
Replies (0)