PDA

View Full Version : saving objects from Layout?



oxygen_77
05-05-2003, 08:11 PM
Hey,

I'm trying to save multiple objects from Layout to a single .lwo file layer while keeping their transformed positions and rotations. If anyone has an example of something similar in a current LScript it would be very helpful. If not, could someone offer any suggestions about how to go about doing this? I'm pretty sure it could be done by writing bytes to the .lwo file, but I'm not sure where within a .lwo file to write this info. Thanks in advance for any help!

faulknermano
05-06-2003, 09:33 AM
not sure how to save _per layer_. but you can use SaveTransformed(). this will save transform the object.. if it is a multilayered object, then it will save it as a multilayer.

oxygen_77
05-06-2003, 09:35 AM
faulknermano,

Thanks for the reply, but I am already using savetransformed() and I just finished a separate LScript for modeler that does what I needed. I had just hoped to be able to do it all from one LScript within Layout, but using two is no real problem...

faulknermano
05-07-2003, 06:05 AM
good to know.

yes, sometimes it's an _itch not to be able to do it from one place. but my philosophy is, as long as you get it done, it's done. :D

Lightsurfer
05-22-2003, 09:25 AM
Hi, I'm triing to do the same thing, but I've got problems with savetransformed() command I don't know why but it doesn't save anithing!
No error, no warning!
could someone post the syntax of this command and some links to a good reference LScript site?

Thanks
Maurizio

oxygen_77
05-22-2003, 09:28 AM
Here's one that I have.
-----------------------------------------------------------------

var sName = "Save Transformed Objects";
var sVer = "v0.1.0";

@version 2.2
@warnings
@script generic
@strict

var objFile = "*.lwo";

generic
{
var selected = Scene().getSelect();
if(selected[1].isMesh() == false){
error("Please select some objects.");
return;
}
@if version < 2.3
objFile = getfile(sName+" "+sVer,objFile,getdir("Objects"));
@else
objFile = getfile(sName+" "+sVer,objFile,getdir("Objects"),false);
@end
return if objFile == nil;
objFile = split(objFile);
var nums = CountWithoutPostNumbers(objFile[3]);
if(nums > 0){
objFile[3] = strleft(objFile[3],nums);
}
var cnt = size(selected);
var i,j = 1;
for(i = cnt;i >= 1;i--){
var sel = selected[i];
if(sel.pointCount() == 0) continue;
SelectItem(sel.name);
//info(sel.name);
SaveTransformed(objFile[1]+objFile[2]+objFile[3]+
strright("00"+string(j),3)+objFile[4]);
j++;
}
}

CountWithoutPostNumbers: name
{
var i,l = size(name);
for(i = l;i >= 1;i--){
if(name[i] < "0" || name[i] > "9") break;
}
return i;
}

Lightsurfer
05-22-2003, 11:16 AM
thanks a lot!