I have to reopen this bug.. sorry. Turns out that it was not Shotgun trying to force load the modeling toolkit plugin, it is in fact Maya not respecting plug-in prefs, which force loads the modeling toolkit plugin.. and the paths are being appended by the modeling toolkit plugin (or the plugins it also force loads, which further disregards pluginPrefs.mel).
The reason behind me thinking this was a Shotgun issue is a separate maya issue where a workspace json file that was auto-saved with a Shotgun Panel open and on subsequent boot ups of maya, maya prints an error that shotgun isn't loaded and can't find the panel... (the reason i claim this is also a maya issue is that maya throws this error up even if shotgun is being loaded... looks like the workspace json file is being called and any custom UI is trying to be built before maya boots all the way up).
I had Shotgun support looking at this and they were also running into this bug when they disabled all their plug-ins, cleared their maya cache directories, and booted maya outside of Shotgun Desktop.
Also using a userSetup.py or userSetup.mel would not be a viable work around as those are executed before the modeling toolkit plug-in is force loaded by maya, wherein paths are being appended and not respected in it or other plug-ins that modeling toolkit force loads. This does happen on 2018, 2018.4, and 2018.5.
Steps to reproduce pathing bug from a fresh install of maya:
- boot up maya
- get a return of maya's paths via python or mel:
- Python:
- import os
- msp = os.environ['MAYA_SCRIPT_PATH']
- for pth in msp.split(';'):
- print pth
- MEL:
- string $tmpTkn[];
- tokenize `getenv "MAYA_SCRIPT_PATH"` ";" $tmpTkn;
- print $tmpTkn;
- copy the contents of MAYA_SCRIPT_PATH and add them (separated by ";") to the entry in Maya.env, MAYA_SCRIPT_PATH =
(you might want to add a path entry that stands out so you can easily find it at the end of your entries)
- close Maya
- save Maya.env
- reboot maya
- repeat step 2 and notice that the paths are being appended by the same paths.
Steps to reproduce modeling toolkit persistent plugin bug of a fresh install of maya (2018, 2018.4, 2018.5):
- boot up maya
- go to Windows > Settings and Preferences > Plug-in Manager
- disable all "auto-load" plug-ins
(as a bonus you can try to unload the plug-ins, but you will get the warning about modeling toolkit being unable to be dynamically unloaded)
- Go to File - Save Preferences
- close maya
- open C:\Users\[username]\Documents\maya\[version]\prefs\pluginPrefs.mel and delete ALL lines that autoload a plug-in (ie: evalDeferred("autoLoadPlugin(\"\", \"modelingToolkit\", \"modelingToolkit\")"); )
- save pluginPrefs.mel
- repeat steps 1 & 2 and note that some plug-ins are still loading.
Steps to see when these plug-ins are being force loaded:
- open maya
- open the Script Editor
- in the Script Editor Window enable History > Echo All Commands
- do steps 2-7 for steps to reproduce modeling toolkit persistent plugin bug
- open (or create if it doesn't exist) C:\Users\[username\Documents\maya\[version]\scripts\userSetup.mel
- type a line of MEL script that has an output ( ie: print "This is where my personal stuff used to start up at the end of maya's boot sequence to ensure my scripts were the last to be sourced!!\n"; )
-- you can create a userSetup.py in the appropriate PYTHONPATH, but its output will happen on the maya output window and I presume that executes before userSetup.mel.
- repeat steps 1 & 2 and look for a line that says "autoLoadPlugin("", "modelingToolkit", "modelingToolkit");" and note that it loads after whatever you have set up in userSetup.mel/py.
-- bonus info: If you have any plug-ins set to autoload (including modelingToolkit) in your pluginPrefs.mel file, those plugins get auto loaded towards the end of your boot sequence
Somewhere, modeling toolkit is being force loaded before maya looks at your preferences. That's fine, if it's now required, I don't mind... I'm only slightly annoyed that modeling toolkit force loads other plug-ins, I'm a bit frustrated that one of those plug-ins force loads PyMel.. but whatever is appending paths should absolutely (and used to) happen before Maya.env is read, and whatever is sourcing scripts like dagMenuProc.mel using its explicit default maya path, should (and used to) happen before userSetup.mel/py are executed.. sure, load the stuff in our pluginPrefs.mel after userSetup.mel.. that's on us to manage. But the way it boots those up and appends things now, completely ruins what made maya love-able, it's ability to be customized at boot up so we don't have to have our artists and animators manually run a series of scripts or functions before they can work.