I was wondering if anyone knows if it is possible to query a maya file for things lige referencing or specific object attributes with out loading the file.
I need to know what references are in a heavy file and I would like to avoid loading it if possible...
I also need to find out what file nodes are there and the file they point to...
As you can probably guess this is for collecting all assets from a file and backing them up...
yes! there are 3 ways. One if you saved out as ma. then you could directy parse the files contents using external apps (this is te reason is suggest to save out as ma ALLWAYS know i do).
in newer mayas (6.5+) its possible to use the load no references option wich makes opening the file much quiker.
and you can do it via the api, if you for example wanted a commandline tool that takes care of this for you.
oh edity and ps mayabatch -archive filename.ma/mb can be of some use here too!
I found the one with loading no references by myself.. And that will give me a scene where I can see all the ref files so that one is good.
Now the only one is the textures...
We are not using maya Ascii so I cannot do it that way...
I will look into the -archive one....
My other option is doing a pre/post render mel script that loads the entire file and does the magic and the hides everything before rendering a black frame.
Then it will run on the farm and the load times are not a problem...
well you should consider the ascii files. Not only do they offer some benfits but also certain versioning databases (cvs) like the ascii format much better as it can easier track chhanges in files and thus use slightly less diskspace whan you save many iterated versions of slightly alltered files to the database. The database can also track this quite easily, wich makes archiving the project easy even if the assets were splintered wich they usualy arent in my case.
I would estimate that my disk usage is about 25% less than if id use mb files (altough the individual mb file is smaller), also finding the right vesrion is sligltly easier thisway. Also the benfit of being able to track every users changes meks life easier!
Plus this sort of task is WAY simpler and faster, as is cartain type of code injecting. Tough id rather do that in the mi/rib stage.
I didn't know if you got the 'file' portion of your question taken care of, but you might try the -exactType "type" to get all "file" DAG nodes?
string $allFiles[] = ls -et "file";
That should put a listing of all "file" DAG nodes into $allFiles[] for you. If you're looking for a list of the filenames (?textures?) themselves, you might try:
... where "ReferenceMasterFile.mb" would be the path to the file that contains the references you wish to list out. This will open the .mb without actually loading the reference files themselves, and will put each reference file into one position of the $aReferenceFileList[] array.