View Full Version : export layer to file?
steveblake 09-18-2006, 08:54 AM I'm looking for a quick way to run through some large scenes and export each layers contents individually as a file named after that layer...
I've was thinking this would be easy in mel, but am completely stumped..
|
|
Segmoria
09-18-2006, 01:24 PM
I wrote the following simple script for you that saves the contents of each layer into a different file. You can study it and adjust it according to your needs, but I guess these are more or less the commands you will have to use.
{
string $saveToPath = "C:/test/";
string $currentLayers[] = `ls -typ displayLayer`;
for ($item in $currentLayers)
{
if ($item != "defaultLayer")
{
string $itemsInLayer[] = `editDisplayLayerMembers -q ($item)`;
select -r $itemsInLayer;
file -typ "mayaBinary" -es ($saveToPath + $item);
}
}
}
Hope this helps!
steveblake
09-18-2006, 03:25 PM
works great - I think you just saved me about 6 hours today!
thankyou!!
steveblake
09-18-2006, 05:47 PM
hmm... is there anything I can do to prevent this type of error:
"Error: More than one object matches name: blah:blah_blah"
Segmoria
09-18-2006, 06:48 PM
When exactly does that error occur? Give me some more details about what you have in your scene, and layers please.
steveblake
09-18-2006, 10:12 PM
actually the script runs through the scene(s) fine, creating files from layers as it should, until it comes to a duplicate object as far as I can tell.
I was thinking that one answer may be to delete the layer and objects once it has has it's contents saved out...
Meanwhile I'll check this again just to be sure.
Segmoria
09-19-2006, 01:03 PM
Well I tried adding dublicate objects in the same layer or even another, but I can't seem to "replicate" this error you mention, the script evaluates as expected. Maybe you wanna post the scene in which you have the problem, so I can try and see more into it.
steveblake
09-20-2006, 07:20 PM
Thanks again for your help on this - actually I ended up doing by hand...
- not sure I'll have time to experiment further, If I do I'll be sure to post.
cheers!
CGTalk Moderation
09-20-2006, 07:20 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-2012, Jelsoft Enterprises Ltd.