PDA

View Full Version : Save layers as objects automatically



mats4d_
04-20-2005, 09:31 AM
Hello,

I have a quick question, I searched the threads but couldnt find anything on it.

Is there a way to do a save layers as objects for ALL the layers in one object automatically instead of going one by one? I looked for plugins for this but couldnt find anything.

Thanks !

Matt

Teedo
04-20-2005, 09:49 AM
I'm not sure if you mean saving each layer as a different object or saving all the layers in the object into one object? but if you have every layer you want in the object in the foreground and then File-Save layers as object then itll put all the layers into one.
I have a feeling you meant the first thing tho :(

bcicio
04-20-2005, 02:12 PM
Don't know how you could automatically save out all of the layers as independent objects. Wouldn't you have to give them each a different file name, anyway?

faulknermano
04-20-2005, 09:15 PM
try this:



@warnings 0

main
{
m = Mesh(0);
mfn = m.filename;
if(mfn == nil)
error("No active object.");
(d,p,f,e) = split(mfn);
fullLayers = lyrdata();

for(i=1;i<=fullLayers.size();i++)
{


thisLayer = fullLayers[i];
ln = m.layerName(thisLayer);
if(ln == nil)
myFile = string(d,p,f,"_",i,e);
else
myFile = string(d,p,f,"_",ln,i,e);

lyrsetfg(thisLayer);
copy();
new();
paste();
save(myFile);
close();
}
}



note: the script will suffix your object filename with "_layerName ", where "layerName" is the layer name (duh!). if your layer is unnamed, it will suffix it with the layer number.

it will save the objects in the same directory as your original object. feel free the change the script to suit your needs, though.

hopefully that's what you're looking for.

mats4d_
04-21-2005, 01:27 AM
Thanks Faulkner !

I will try the script, sounds like it might work



bcicio : thats correct , I was looking for a way or a plugin that would save them sequentially, xx_1.lwo , xx_2.lwo, xx_3.lwo - which is what Faulkner posted I think

Tnx

Matt -

pearlwaterdrops
06-18-2006, 07:18 PM
faulknermano - hello;

regarding mesh.layerName() method

I do not see this metod mentioned in the Lscript Reference(pdf) and it is not being recognized by modeler;

can you tell me anything about this method?

thanks

dsdsdsdsd

faulknermano
06-19-2006, 12:26 AM
hi, it is recognised in modeler. try this:




m = Mesh(0);
myName = m.layerName(1); // get layer 1 name
info(myName);


remember that method is for Mesh Object Agents, and that you to specify a layer index to that method before it returns anything valid.


PS: for a more complete documentation, look at the release notes. this my current reference:

http://thespread.ghostoutpost.com/LSCRIPT_DOCS.zip