Join our discord community

Forum breadcrumbs - You are here:ForumPrism: Generalmaya script path append
Please or Register to create posts and topics.

maya script path append

PreviousPage 2 of 3Next

You're right, I meant .\

I guess I was confused by the example, where they used a different hierarchy and ..\ (https://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_GUID_130A3F57_2A5D_4E56_B066_6B86F68EEA22_htm)

However, I have a .mll file in the same directory as the .mod file, one in the directory above and one in a sub-directory called plug-ins. None of them get found when using .\ or ..\ in the .mod file.

I'm not sure what would be the problem then, I attempted to reproduce your hierarchy myself and maya still find the .mll :

I found the problem. You set the environment variable in Windows, and then it also works for me. But I don't like the idea to create persistent variables on the system. I'd like to keep Prism as portable and lightweight as possible and so I try to avoid persistent environment variables, registry entries etc.

I tried to add the module file path to the environment variable in python, in the userSetup.py in the Maya preference folder:

import os
os.environ["MAYA_MODULE_PATH"] += ";C:\\Workspace\\Project\\MayaPlugin\\TestPlugin"

With absolute paths in the .mod file this works fine, but not with relative paths.

Ha, well, hmm, my only guess is that when you append the MAYA_MODULE_PATH from prism to maya, it is possible that the 'relative path' of the .mod file become the location of the .exe of the app, that only a guess, but try put the plug-ins directory where maya.exe is located.

do you set the environement variable directory in maya while it running ? or before via the windows command line ?

When I but the .mll in C:\Program Files\Autodesk\Maya2018\bin\plug-ins it works, but this directory is also an official plugin directory, so it doesn't matter if I have a .mod file somewhere or not. I set the environment variable in the userSetup.py. This script gets automatically loaded by Maya during startup. (https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Scripting/files/GUID-C0F27A50-3DD6-454C-A4D1-9E3C44B3C990-htm.html)

I will append the directory in the  Prism project to the MAYA_SCRIPT_PATH and the MAYA_PLUG_IN_PATH variable, without using a .mod file. This works fine. If someone wants to add more Maya plugin paths for the Prism project, I can provide a Prism plugin which can be placed in the project directory.

Most of the maya plugin existing rely on being a hierarchised as maya module, the simple plugin I proved may be fine to be placed in the plug-ins folder of maya, but bigger plugin like yeti or ornatrix, even some plugin I did in the past, require to be hierarchised the way a module is meant to be, and using a .mod also provide functionnality for defining a plugin for different maya version.

 

I'll try make some test when I have to time regarding setting up the env var at runtime.

Thanks, let me know when you find a way to change it during runtime. Until then users would need to set the variable manually in the windows settings if they have a module like you described.

In the rare case that someone needs it I could provide a Prism plugin, which sets a persistent environment variable automatically when the Prism project gets loaded, but I guess not everyone want that.

Hi Richard,

the solution is pretty simple : just use Maya.env file

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-EnvVar/files/GUID-8EFB1AC1-ED7D-4099-9EEE-624097872C04-htm.html

That's definitely better than setting the variable in the system, but you still have to restart Maya to have the changes to the env file take effect.

Are there any free or demo modules which have a this kind of complex structure, which I could use for testing?

Did you try using the rehash; function? Sometimes it makes it so that you son’t need to restart the program.

PreviousPage 2 of 3Next