krathjen/studiolibrary

Studio Library can only be launched once per maya session

Opened this issue · 0 comments

This app doesnt maintain its own window reference in maya. So if you run this code twice, it breaks with a "C++ internal object already deleted".
On Maya 2023.

import studiolibrary
studiolibrary.main()

To get around this, I store the window ref from studiolibrary.main() in a module-level global variable, and our launch method checks if that var is valid and calls "window.show()" instead.

window = None
def launchSL():
    global window
    if window is not None:
        window.show()
    import studiolibrary
    window = studiolibrary.main()

Your documentation acts like this isn't required, very strange.