Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

userSetup.mel vs userSetup.py?

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
8274 Views, 8 Replies

userSetup.mel vs userSetup.py?

Our studio has a simple userSetup.mel we've been using for several years. A few days ago I decided to convert this simple file to a userSetup.py in order to take advange of some python stuff.  I cannot seem to get the userSetup.py to execute at all. I've removed the mel script, opened permissions, simplified it down to a single 'print' call. It just dosen't execute. Is there something else that needs to be done? I'm under the impression that it just needed to be placed in the right location and named correctly and then it should execute. This hasen't been the case for us.

 

We're running the latest OSX (10.9.4) with Maya 2015 sp2. The script is placed in ~/Library/Preferences/Autodesk/maya/2015-x64/scripts/userSetup.{mel|py}.  

 

mel will execute, python will not. 

8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

It's working well here, but the userSetup.py is also in a folder inside the PYTHONPATH environment variable.

 

I gess maya is looking there to find the file.

 

Best,

Hans

Message 3 of 9
Anonymous
in reply to: Anonymous

Putting 

~/Library/Preferences/Autodesk/maya/2015-x64/scripts on the system PYTHONPATH or in the Maya.env PYTHONPATH doesn't fix the problem. It still won't source a python version of the userSetup file.

Message 4 of 9
Alex.Morano
in reply to: Anonymous

It wont.

You need to bootstrap it with the old usersetup.mel.

This is exactly what I use at the studio:

### userSetup.mel ####
evalDeferred("python(\"import nas.maya.userSetup\")");

I know, totally wonk, but we've been using that for 4+ years, so....
Message 5 of 9
haggi_master
in reply to: Alex.Morano

The problem is that the python userSetup does not execute everything correctly. As much as I know it is exectued, but some elements are not correctly done. e.g. if you try to set an optionVar in the python file, it will not work whereas in the mel script it works. Same happend with UI settings. We has some crashes as well if we tried to load a plugin autmatically in the userSetup.py because it called methods which were not yet correctly defined.

 

So it seems that the python script is executed much earlier in the startup sequence than the mel scripts.

Message 6 of 9
Anonymous
in reply to: haggi_master

It is possible to call all MEL commands in Python and vice-versa. Could you please check the following link for more information?

http://download.autodesk.com/us/maya/2010help/index.html?url=Using_Python_in_Maya_Communicating_betw...

Message 7 of 9
haggi_master
in reply to: Anonymous

This was true before Maya2014. From Maya2013 to Maya2014 the startup process has obviously changed. You can test it by setting an option var in the userSetup.py. It has no effect in 2014, but works fine in 2013.

Message 8 of 9
Anonymous
in reply to: haggi_master

The optionVar is working fine in Maya 2014/Maya 2015 on MacOS/Windows if we use it in userSetup.py script . I am using the following machine.

 

----------- output of  uname -a --------------

Darwin banc02kd1zcfft1m.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64

------------------------------------------------

I have attached the screenshot of both Win64 userSetup.py and MacOS userSetup.py both are executing optionVar without any error and after Maya 2014/2015 is launched, I can check the value of those variables. Please refer the screen shot. 

 

Message 9 of 9
haggi_master
in reply to: Anonymous

You are completly right. Maybe this behaviour has changed in a service pack, what is great. As we switched to 2014 we had problems with out environment and could pin it down to some non working optionVars if set in the python script. What does not work in 2014 userSetup.py - at least here - is modifying any UI like loading AETemplates or adding a menu to the main menu bar. These worked in 2013 - or in the mel script for 2014.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report