View Full Version : storing paths as variables
06-01-2007, 08:04 PM
As my scenes become more complex I am starting to visit the idea of using variables in reference paths. I am trying to gain a directional understanding of when to use what type. The "workspace" seems like a good way to hold paths under a "project", that way you could move the project without breaking everything... does this sound right? Is anyone extensively using the workspace?
Are the use of Environmental variable more suited towards global/system locations (ie Scripts, Plugin, etc...) vs. project assets (ie. $ref_hand, $ref_finger, etc...)
Currently I am setting reference paths as relative... but the moment you ref the ref, the relative path tries to resolve against the upper most file... which often is in a different location.
Also - is anyone using optionVars is this area?
06-04-2007, 09:46 AM
Using the workspace.mel file is a good idea for project management, but I find it mostly useful for shot-specific file-associations such as shot-specific sourceimages for textures and image planes, render output and such. It's not really useful in the context of large-scale project with many shots (unless you keep them all in a singular maya database, which isn't impossible, but would be a nightmare to manage).
It might be possible to use variables to indicate the top root of your reference files as well, so you could change that variable when you needed to change the location of your project database, keeping referencing links intact. This would require you to use absolute paths though. Although I wouldn't know how to implement it this way. :p Some drawbacks, though, is that secondary file associations such as file texture paths would be affected as well (unless you use relative paths).
One other option is based more on methodology. Have all you shot specific project files saved out in maya ascii. When changing the location of your project database since all information pertaining to a shot file is in readable and editable format (such as file references, you should be able to find them as a line starting either with "file -r" or "file -rdi"), you can have a script which goes through a list of files and parses the reference file paths from one location to another. You could do this within maya, or within an external script or text editing application. For your asset files with file textures you could either save them as well in maya ascii and have the same script parse through all the sourcimage data (drawback being that referenced ascii file take longer to load), or have a mel batch script open every asset file and change the paths for all sourceimages.
06-04-2007, 04:58 PM
Well, over the weekend I took the time to start implementing environmental variables... however, my direction was to try and create a scriptJob that would run a script everytime a scene is opened.
The script basically:
-parses through the scene path to determine the name of the project
-looks for a standard file containing the project ENV variables
-then executes the files to load the current project ENV variables
However, the scriptJob appears to run AFTER the scene is opened, so the path variable do not get loaded until after you get an erroneous first attempt... I also haven't tried this approach through the command line render, but I anticipate problems there too.
But, I do think that I know have the proper file path storage structure... its just a matter of being able to intelligently set those ENV variable PRIOR to the scene attempting to find the file references. I was hoping to do this automatically but... we'll see... if not then I guess having to "set" the project, in some sort of manual form, will lead me to explore the workspace possibilities.
06-04-2007, 04:58 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.