Alternative to usersetup.mel in Maya modules

Hi everyone!

Yesterday I learned that there is another way of executing scripts on start-up besides usersetup.py and usersetup.mel. If you create a Maya Module (for example “TestModule”) and add a mel file in the scripts folder caller “_load.mel” (so “TestModule_load.mel”) it will be execute as on start-up like a usersetup.mel. The Maya BonusTools work that way. I did not find any documentation on that, so I thought I’d share it here and see if anybody else has seen this or might have more info on that.
I already posted this in the Tech-Artist Slack channel and we found that this might be a potential security issue. So I’d thought to post it here as well so it gets some exposure.

Cheers,
Fabian

PS: If that would be an official documented feature I would actually kinda like it, since it would not interfere with the usersetup.mel and would make more sense naming wise inside a Maya module.

2 Likes

Maya modules are the main way that packages (like bonus tools, Bifrost, so many…) are distributed, since each one can have it’s own unique userSetup.mel/.py that don’t conflict with any others.

It’s how I manage my studio’s Maya tools, and makes it easy to fold in anything else from the internets / other studios.

Official Maya docs:
https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__developer_Maya_SDK_MERGED_Distributing_Maya_Plug_ins_Maya_module_paths_folders_and_html

I have notes on them here:
http://mayamel.tiddlyspot.com/#[[Understanding%20Maya%20Modules%20and%20Pacakges]]

3 Likes

I think the main purpose of the post was to inform about the seemingly undocumented “feature” of Maya modules to execute a file matching the module_name + _load.mel on startup as userSetup does.
This could be important for security features for example.

3 Likes

Yeah, as someone who has been using maya modules to package up studio code since forever, I had no idea this feature existed.

1 Like

I think the main purpose of the post was to inform about the seemingly undocumented “feature” of Maya modules to execute a file matching the module_name + _load.mel on startup as userSetup does.
This could be important for security features for example.

LOL, I totally missed that: I think I read ‘Maya Module’ (instead of mel script), and my brain went that direction.

I learned something today too! :slight_smile:

1 Like

Hehe, I totally understand :slight_smile: