PDA

View Full Version : add a prefix to selected objects names



littleloud
05-21-2008, 07:57 AM
hey all,

i think i'm slowly starting to get my head around scripting (with more than a little help from you guys) :)

how would i go about scripting adding a user imputed prefix to the name of all selected null objects?

an example would be great, i'm kinda a pull things apart to see how they work kinda guy

thanks a bunch

n

walfridson
05-23-2008, 07:28 AM
Here you go

@script generic
@name "addprefix"
@warnings


generic
{
reqbegin("Add prefix");
reqsize(290,120);
c1 = ctlstring("Prefix","");
ctlposition(c1,15,5);
return if !reqpost();
prefix = getvalue(c1);
selected=Scene().getSelect();
SelectItem(selected[1].id);
for(i=1;i<=selected.size();i++)
{
AddToSelection(selected[i].id);
Rename(prefix + Mesh(selected[i].id).name);
}

}