View Full Version : converting linux reference path without altering the file?
02 February 2011, 09:46 AM
Trying to figure this out. Right now we are working on Maya linux files which their reference path looks like this.
A.ma , referencing objects from //linux/project/scene/B.ma
B.ma , referencing objects from //linux/project/scene/C.ma
Since most of our Maya license are on Windows, the path needs conversion to this.
Running python scripts to go through files and convert them will be easy but because the files are being synced with another company, their paths need to remain in linux format. I tried to come up with a solution for this, and wondering if it is possible to.
Open the file with a script.
The script checks for the linux formatted reference path, and all child path down the hierarchy.
Maps all paths to their appropriate windows formatted paths *without* altering the original file.
When the file is saved, it still uses its original linux formatted paths.
Is this possible to achieve this with Mel/Python script? Or will I need a fully-compiled plug in to get this to work? I can imagine having separate scripts for open and save, but then there's no stopping the animators from doing their usual ctrl+s.
Greatly appreciate any suggestions.
02 February 2011, 10:19 AM
I'm pretty sure you never need to do anything as extreme as this... doesn't setting your projects appropriately solve this very issue?
02 February 2011, 10:40 AM
The projects were set up for us by the other company, and part of the requirement is that we need to keep the format as is. Setting up projects might cause all those paths to change so we haven't tried that.
The references are all in absolute path, //pipe/projects...
And we match that by mounting the drive to //pipe/ on our Fedora workstations.
For Windows workstations the same drive is mapped to Z:\projects\...
An easy solution probably is to duplicate the folder and make 1 of them into windows format. And have a script to sync the files back and forth. But given the size of the project I would like to avoid doing that.
02 February 2011, 11:16 AM
AFAIK Maya stores all paths in /x/y/z absolute format, even on a windows box. It puts a double-slash in where the project root is, so for example, if you are running on linux, and you set your Maya project to:
then create a scene under this project root and save it, in the saved file it will store the absolute path as something like:
now, on your windows box you open Maya and set your Maya project to:
then open the original Maya file it will effectively ignore everything below the // and instead use z:/Projects/
I'm not sure I've explained this well, or even completely correctly, but I'm sure this is how it's essentially supposed to work.
At the office I work on scenes in W:\data\games\project\scenes\ but I take those scenes home and put them in: F:\Nathan\work\ and all the file paths still work fine as my project is set to these folders on each Maya. (of course I'm using a Windows PC in both cases, but the theory should be the same).
I hope this is somehow relevant to your case Panupat...
02 February 2011, 11:33 AM
The double slash is very interesting... I'll have to give that a shot. Thanks Nathan.
I'm still a little worry that Maya might mess with the slash/backslash. Because the files are buried pretty deep under many sub directories.
Let's see how it does.
02 February 2011, 11:58 AM
Digging deeper into the files I found out that the files are not really at the same level. For example
will have files referencing to this folder /linux/ModelLibraries/assets/......
We are not allowed to make any direct changes to the /linux/ModelLibraries/assets/...... folder. What would be my best approach for this? Should I put the double slash after /linux// and set my projects at Z:\ ?
02 February 2011, 01:11 PM
hmm, yes, that does look like a potential problem. I'd say that was very bad practice as it ruins the whole point of projects and the interchangeability of files.. pretty stupid if you know you are passing them to someone else... but yeah, setting the project root lower down should hopefully get around this.. I think? this is now making my brain hurt! :D :cry:
02 February 2011, 03:21 PM
Aw Nathan >.> I appreciate your help, thank you very much.
So setting the project to Z:\ and adding double slash seem to work, all reference files are linked properly (but need to add absolute path to the textures as well)
There are still an issue with saving. normal save works but Maya won't allow us to do a save-as. I already left my office, will take a look at the error message tomorrow
02 February 2011, 03:21 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.