Open mottosso opened 2 years ago
Hi @mottosso
Usually, I launch Maya with a simple .bat to setup my environment (Like ultra-simple env manager. You know better than me that part 😅 ). I mainly use it to have several mGear versions depending on the project.
Something like this:
set MAYA_MODULE_PATH=C:\projectB\env\mgear_XXX_folder
set MGEAR_SHIFTER_CUSTOMSTEP_PATH=C:\projectB\build\custom_steps
set MGEAR_SHIFTER_COMPONENT_PATH=C:\projectB\build\components
set PYTHONDONTWRITEBYTECODE=1
start "" "C:\Program Files\Autodesk\Maya2020\bin\maya.exe"
Anyway, I am going to research your proposal and see what I can do. I guess option 1 is totally doable, not sure about option 2
Also let you know that we are planning to remove pymel dependency, but that is planned towards the end of the year or next year 😝
Anyway, I am going to research your proposal and see what I can do
It would literally be an empty shell of this.
Without a doIt()
or anything, just the initialize()
and uninitialize()
calls. In fact, you might not even need the command or anything, just literally those two functions in a plain Python file, somewhere on MAYA_PLUGIN_PATH. A single module, compatible with all Maya versions, nothing to compile.
That's where you'd install/uninstall the mGear menu, and is triggered whenever the user loads the plug-in via the plug-in manager or Python. It would replace your userSetup.py script altogether.
Also let you know that we are planning to remove pymel dependency, but that is planned towards the end of the year or next year 😝
Lovely. :) That, and the compiled solvers, are the only two things standing in the way of complete adoption on my end.
On a related node, for myself and anyone wanting to control the appearance of mGear in their Maya menu, I made this.
from maya.OpenMayaUI import MQtUtil
from PySide2 import QtWidgets
import shiboken2
def show_mgear(visible=True):
pointer = MQtUtil.mainWindow()
maya_win = shiboken2.wrapInstance(int(pointer), QtWidgets.QMainWindow)
menu = maya_win.menuBar()
for action in menu.actions():
if action.text() == "mGear":
action.setVisible(visible)
show_mgear(True)
show_mgear(False)
This could potentially be the "uninstall" option, considering the cost of loading PyMEL has already been paid at that point. It would achieve the effect of an uninstall, without having to incorporate support for actually unloading modules.
Thanks @mottosso !
Heya @miquelcampos, one of the things that complicate my use of mGear is that I haven't found a way to let Maya not load mGear. It's either installed on disk, and has a menu and loaded plug-ins in Maya, or I need to delete/move it on disk.
I'm searching for an mGear plug-in in the Plug-in Manager where I can choose whether or not to enable it.
The two main reasons for needing it unloaded are (1) PyMEL makes Maya take 2-3x longer to start, and I restart a lot. In the tens of times per day, due to my plug-in development habits. And (2) screenshots and videos of the Maya UI cannot include the mGear menu, so as to not distract the viewer from what the screenshot or video is about.
So, there are two separate but related things I'd like to propose.
For (1), startup could be moved from
userSetup.py
into an actual plug-in; that could be a Python plug-in. That plug-in could simply contain exactly whatuserSetup.py
contains at the moment, with the added benefit of appearing in the Plug-in Manager, where the user can control whether or not to load (and auto-load on startup).For (2), it isn't as important for my use case. But it would involve an opposite of an install; deleting the menu, unload of plug-ins. I expect this to involve more work if it hasn't been taking into account from the start, but it would save me from having to restart Maya between using and not using mGear, which would ultimately make me use mGear more. Less friction.