Hypershade: Remove tab "Projects" on startup

Hypershade: Remove tab "Projects" on startup

BigRoy
Advocate Advocate
387 Views
1 Reply
Message 1 of 2

Hypershade: Remove tab "Projects" on startup

BigRoy
Advocate
Advocate

On most of our machines we've always been having issues with the Hypershade opening tremendously slow - anywhere between 5-40 seconds, but usually in the higher ranges.

 

As is listed in "workarounds" here: https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Hypershade-window-... what works for us is deleting the "Projects" tab.

 

Now what I'd really want to do is in our pipeline, completely destroy and obliterate that Projects tab. We've never used it, we have no need for it in the Hypershade and we absolutely do not want it to introduce any slowdown in the Hypershade at all.

 

So, I'm looking to somehow manipulate Maya on startup to "delete the Projects tab in hypershade" - however the deletion seems pretty obfuscated in mel scripts (with a lot of local procedures too). Which leaves me to the question: How can I easily force delete that tab from a simple script?

 

Eventually I'm looking for something that boils down to as simple as this to add into userSetup.py or alike:

deleteHypershadeTab("Projects")

 

0 Likes
388 Views
1 Reply
Reply (1)
Message 2 of 2

BigRoy
Advocate
Advocate

This deletes any "disk" type tabs in the Hypershade:

 

from maya import cmds


def delete_tab(optionvar: str):
    cmds.optionVar(remove=optionvar)
    for suffix in [
    	"Label",
    	"Type",
    	"DirectoriesVisorName",
    	"FilesVisorName",
    	"RootDirectory",
    	"CurrentDirectory",
    	"DirectoriesShown",
    	"FilesShown",
    	"HypershadeName",
    	"Filter",
    	"IconSize",
    	"ViewOption",
    	"SortOption",
    	"ReverseOption",
	]:
        cmds.optionVar(remove=f"{optionvar}{suffix}")


# Remove all disk type tabs by removing any optionvars about them
keys = set(cmds.optionVar(list=True, category="Hypershade"))
for key in keys:
    if key.startswith("hyperShadeTab") and key.endswith("Type"):
        value = cmds.optionVar(query=key)
        if value != "disk":
            continue
        tab_optionvar = key[:-len("Type")]
        print(f"Deleting HyperShade 'disk' tab: {tab_optionvar}")
        delete_tab(tab_optionvar)

However, after deleting a tab - opening the hypershade errors:

 

// Warning: file: C:/Program Files/Autodesk/Maya2025/scripts/others/hyperShadePanel.mel line 2045: The 'showLineNumbers' flag is obsolete and will be removed in the next version of Maya. Use the Script Editor checkbox to turn on line number display instead.
// Error: file: C:/Program Files/Autodesk/Maya2025/scripts/others/hyperShadePanel.mel line 2045: Unexpected tab type in option var: 0

Then closing the Hypershade AND re-opening it again fixes it...

Still, just another sign that this does not seem trivial.

 

Only workaround for that seems to open+close the Hypershade twice (first one would fail, then second would create the UI correctly.) Essentially running:

mel.eval("HypershadeWindow;")
mel.eval("closeHypershade()")
mel.eval("HypershadeWindow;")
mel.eval("closeHypershade()")

 

0 Likes