View Full Version : Reference Scripts?

10 October 2010, 05:23 AM

Is anyone familiar if there is an existing script that allows me to select a target directory and have it reference every maya file inside that folder?

In the File Texture Manager script on Creative Crash it allows the user to target directories to allow users to repath textures! I was hoping there might be something similiar to this... I have an asset that is scanned into many different files and it's a pain to always have to reference each file one at a time...

Would be nice if I could tell it to march through a folder while I take a break!



10 October 2010, 09:39 AM
you could do this very easily with only a couple of lines of MEL. use the `getFileList` command to get your files, then iterate through them with a for..loop using the `file -r` command to reference them in. in fact, it's so simple here it is:

string $folder = "M:/work/naughty/projectX/models/";
string $files[] = `getFileList -folder $folder -filespec "*.m?"`;
// the *.m? wildcard lets getFileList grab ANY maya file (*.ma or *.mb) you could extend this even further...
for ($file in $files)
file -r ($folder+$file);

It could do with some additional functionality sure, and a UI where you browse for a folder would be good, but this is essentially all it requires.

10 October 2010, 12:47 PM
Thank you, Nathan! :D

CGTalk Moderation
10 October 2010, 12:47 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.