PDA

View Full Version : replace with Null



titane357
07-03-2008, 09:49 AM
Hello :D

I try to "make" a script to replace loads objects with nulls...

My base is Blochi's script.
Here is it :


@version 2.3
@warnings
@script generic

generic
{
curScene = Scene();
currTime = 0;
objList = curScene.getSelect(MESH);

if(objList)
{
{
for(i = 1; i <= size(objList); i++)
{
NULLNAME = "NULL_0" + i ;
v = objList.getPosition(currTime);
AddNull(NULLNAME);
SelectByName(NULLNAME);
Position(v.x,v.y,v.z);
}
}
}
}


But this don't work : how can I get object position ?
If I know for position, I can extend this to scale and rotation ...
I would like to copy name of the mesh, too...

If somebody can help !!! :heart: I have search on forums, scripts and docs...but :(

dpont
07-03-2008, 10:23 AM
@version 2.3
@warnings
@script generic

generic
{
curScene = Scene();
currTime = 0;
objList = curScene.getSelect(MESH);

if(objList)
{
for(i = 1; i <= size(objList); i++)
{
NULLNAME = "NULL_0" + i ;
SelectItem(objList[i].id);
ReplaceWithNull(NULLNAME);
}
}
}

//End of Lscript

Denis.

titane357
07-03-2008, 10:37 AM
c'est pas gentil de se moquer, denis !
Thank you very much, works great ! can you give me an exemple line to get object position in my list , so I can play and try another scripts ? Thanks.

dpont
07-03-2008, 11:03 AM
When you get the item id,
item = objList[i].id;
You can get what you want,
pos = item.Position(t);
or
rot = item.Rotation(t);
where t is the time,
result pos or rot is a vector coded like <x,y,z>,
you can get each channel by typing , pos.y or pos.z
Then read the doc...

Denis.

adamredwoods
07-03-2008, 11:06 AM
objList[i].getPosition(time);

or

objList[i].getWorldPosition(time);

adamredwoods
07-03-2008, 11:08 AM
to set:
SelectItem(objList[i].id);
Position(<x,y,z>);
Rotation(<h,p,b>);

titane357
07-03-2008, 11:10 AM
Thanks adamredwoods and denis, now I can "play" a bit !! :D

Blochi
07-04-2008, 08:48 PM
wow, I feel honored ....
This does sound like a cool script.
Some other ideas:
- you could rename each one with a Prefix "NULL_"
- somehow remember the original object path so you can write an antidote script to revert them all back.

Blochi