What's a good strategy to let Maya load my modules which are always located in different places?

43 views
Skip to first unread message

yaoyansibase

unread,
Sep 27, 2017, 5:56:34 AM9/27/17
to python_inside_maya
Hi all,
I'm going to use GitLab CI to build and test my maya plugin project. Here is the detail of my system:
My project locates at the directory e:\dev\myproject on my local machine.
I set a environment variable MAYA_MODULE_PATH=e:\dev\myproject\moduls
The module file is e:\dev\myproject\moduls\plugin0.mod, its content is:
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any e:\dev\myproject\plugin0
...

The plugins project will be located at a different directory on each GitLab Runner machine.
For example, on Runner0 the directory COULD BE c:\GitLab-Runner\builds\00000000\group0\myproject, and on Runner1 the direcory COULD BE c:\GitLab-Runner\builds\11111111\group0\myproject.


The problem is that I can't find a convinent way to let Maya load the plugins on each Runner machine. Here are some ideas in my mind, but I'm not satisfied with them. Could you give any suggestion?

Idea1:
On each Runner, set environment variable MAYA_MODULE_PATH= c:\moduls
On Runner0, modify the content of file c:\moduls\plugin0.mod to
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any c:\GitLab-Runner\builds\00000000\group0\myproject\plugin0
...
On Runner1, modify the content of file c:\moduls\plugin0.mod to
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any c:\GitLab-Runner\builds\11111111\group0\myproject\plugin0
...

If I add another Runner2, I have to modify c:\moduls\plugin0.mod on Runner2 by hand, which is inconvient.
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any c:\GitLab-Runner\builds\22222222\group0\myproject\plugin0
...


Idea2:
On each Runner, set environment variable MAYA_MODULE_PATH= c:\moduls 
Modify the content of file c:\moduls\plugin0.mod to
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any $(ProjectRoot)\plugin0
...

On Runner0, set an environment variable ProjectRoot= c:\GitLab-Runner\builds\00000000\group0\myproject 
On Runner1, set an environment variable ProjectRoot= c:\GitLab-Runner\builds\11111111\group0\myproject 

If I add another Runner2, I only have to set environment variable MAYA_MODULE_PATH= c:\moduls and ProjectRoot= c:\GitLab-Runner\builds\22222222\group0\myproject

But, it seems that Maya mod file can't parse environment variable at all.


Cheers
Yao
















Michael Boon

unread,
Sep 27, 2017, 7:32:51 PM9/27/17
to Python Programming for Autodesk Maya
I have no experience with GitLab
Can you put your module into your ProjectRoot, and use relative directories inside the module? Then just change the MAYA_MODULE_PATH for each runner?

yaoys

unread,
Sep 27, 2017, 11:30:04 PM9/27/17
to Python Programming for Autodesk Maya
Hi, Michael. Thanks for your reply. It works! Yes, using relative directory in module path is a good idea.
Maya document demostrates this usage, but it is a shame that I forgot it.


Now the whole solution is:
- Put my modules under my project, e.g.
My project locates at the directory e:\dev\myproject
on my local machine.
The modules locates at
e:\dev\myproject\modules

Modify e:\dev\myproject\moduls\plugin0.mod:
+ MAYAVERSION:2016 PLATFORM:win64 plugin0 any ../plugin0
...
Set a environment variable MAYA_MODULE_PATH=e:\dev\myproject\modules

On Runner0, set environment variable MAYA_MODULE_PATH=c:\GitLab-Runner\builds\00000000\group0\myproject\modules,
On Runner1, set environment variable MAYA_MODULE_PATH=c:\GitLab-Runner\builds\11111111\group0\myproject\modules,
On Runner2, set environment variable MAYA_MODULE_PATH=c:\GitLab-Runner\builds\22222222\group0\myproject\modules,

Reply all
Reply to author
Forward
0 new messages