Dynamic Environment Variables

Dynamic Environment Variables

Anonymous
Not applicable
2,108 Views
4 Replies
Message 1 of 5

Dynamic Environment Variables

Anonymous
Not applicable

Before I create an idea on the Feedback forums (which is overflowing to say the least) I wanted to ask a few questions to clarify my issues.

 

Does Maya have any environment variables that can be changed and used while the application is open? I'm in the process of writing a tool that allows for project based environment variables, but I was hoping there would be a way to hook directly into the current Maya system without having to write to Maya.env.

 

I know this is a broad question, but I'll give an example to clarify:

 

Maya uses relative paths in a few areas, one of which being File (read) nodes. So instead of hardcoding the path to the texture, you can just use 'sourceimages/texture.ext' and it'll know what's up. However, there are some things in Maya that aren't capable of utilizing this feature, one of which is file referencing. For those of us on team based projects NOT working off of central servers, this is a sizeable issue. In order to have references work cross-platform and cross-machine, I had to use a hacky solution in the Maya.env file of each machine where I would set a variable like 'FILM=path/to/project/root'. Then in the reference editor I would remove the entire path up to the root directory and replace it with this variable, ie '$FILM/scenes/path/to/scene'.

 

This worked pretty well, but I was hoping that someday we could see dynamic variables, like $CURRENT_PROJ or self-definable variables without needing to edit the environment file and restarting Maya. This way if I were to change projects and open up a scene file or move a project around to another system, as long as the project was set I wouldn't have to worry about delinked paths. Similar to the $JOB and $HIP of Houdini.

 

As a side note, will there ever be the ability to set a render location that's not /images (or user-defined name) out of the project structure without using overrides from the command line?

0 Likes
2,109 Views
4 Replies
Replies (4)
Message 2 of 5

mspeer
Consultant
Consultant

Hi!

 

All File paths will be saved as relative and absolute paths. So moving projects on the same system is not a problem.

Maybe some platforms use an other path syntax like "\" instead of "/" which may lead to problems.

 

"will there ever be the ability to set a render location that's not /images (or user-defined name) out of the project structure"

Yes, in Project Window just select the folder icon on the right side of "Images", browse for the desired location and hit "Select" or enter the folder path manual. (This will then, of course, become part of the structure)

0 Likes
Message 3 of 5

Anonymous
Not applicable

"All File paths will be saved as relative and absolute paths."

 

-----

File referencing only supports absolute paths and paths with environment variables. Relative path names are not supported when using file referencing. An environment variable can be used as a superior alternative to a relative path as it is explicit and customizable to each user's file structure.

 

Relative path (not supported):

 

scenes/street.ma

Absolute path (supported): C:/projects/cityscene/scenes/street.ma

Environment variable path (supported): $myProject/scenes/street.ma

-----

 

I'm looking to see if there's a way to do this without having to set any variables (which I know isn't possible). Essentially have predefined internal variables (native Maya ones) that allow you to use relative pathing for virtually everything based on the project structure. It would make my life a bit easier than having to explain to every team member how to set these variables themselves.

 

 

"Yes, in Project Window just select the folder icon on the right side of "Images", browse for the desired location and hit "Select" or enter the folder path manual. (This will then, of course, become part of the structure)"

 

Personally I would like to see the ability to not be 'locked' per say to the project settings. Something like this is a rendertime issue, and pretty much every other app I've used handles it as a render setting, not a project setting. Being able to quickly point to a path while working on the render settings rather than opening up the project settings, changing the path (overwriting the workspace.mel), then rendering. Granted this is a minute issue, but probably one of my bigger gripes with the app today. It does its best to keep you in an organized environment, but at the cost of flexibility for those using the app in a 'non-standard' fashion. Personally I'd like to see the workspace.mel file replaced with a workspace.json and allow it to hold per-project environment variables. Considering certain things in 2017 have already moved to JSON, hopefully this is one of the next.

 

It might be a losing request, but dynamic environment variables (not Maya.env) would be very handy. Per-Project variables would be much preferred than global ones.

0 Likes
Message 4 of 5

Anonymous
Not applicable

Embedding putenv and getenv into my code structure might allow me to get around this, along with tweaking the referencing code.

0 Likes
Message 5 of 5

mspeer
Consultant
Consultant

Hi!

 

"File referencing only supports absolute paths"

Yes and No.

 

"Absolute path (supported): C:/projects/cityscene/scenes/street.ma"

will be saved internally as C:/projects/cityscene//scenes/street.ma

"//" relative to project folder.

and therefore moving of projects with references works and file paths can be resolved.

(Just tested today with Maya 2017 update 3)

 

 

"Personally I would like to see the ability to not be 'locked' per say to the project settings"

I agree that it would be nice to have the option to override the default render path in the scene-file, this would be something for "Ideas for Maya".

0 Likes