mgear-dev / mgear4

mGear v.4.x.x (python 3 ready) https://mgear4.readthedocs.io
MIT License
259 stars 91 forks source link

Optional directory for custom components #380

Closed mattdeform closed 5 months ago

mattdeform commented 5 months ago

Adding an optional directory for custom components so as to not clutter the mgear root directory. I left previous component search (via module location) in place. If there is a pre-existing or preferred way of doing this do let me know, I was just patching for my own needs and figured it might help others if not already implemented.

To use:

Screenshot 2024-01-18 161234
miquelcampos commented 5 months ago

Hi @matthewleeanimator Thanks for the PR! But we already have an environment variable to add any number of custom component folders 😅 the variable is MGEAR_SHIFTER_COMPONENT_PATH you can set it on your Maya environment, using a .bat launcher or any other method of your choice Also is possible to add multiple directories using ;

for example a .bat file launcher

@ECHO OFF

set ANIM_PICKER_PATH=C:\your path to picker
set MAYA_MODULE_PATH=C:\datawork\repo\mgear4\release
set MGEAR_SHIFTER_COMPONENT_PATH=C:\path_to_component_folder_1;C:\path_to_component_folder_2
set MGEAR_SHIFTER_CUSTOMSTEP_PATH=C:\Custom_step_folder
set MGEAR_PROJECT_NAME=PROJECT_NAME (This is optional and will show the name of the project in the mGear menu like this: "mGear(Project_X)")
set PYTHONDONTWRITEBYTECODE=1  (avoid the creation of .PYC files)

rem Run Maya with this enviroment
start "" "C:\Program Files\Autodesk\Maya2022\bin\maya.exe"
mattdeform commented 5 months ago

Hi @miquelcampos, ah great, thanks for the heads up!