PDA

View Full Version : Layout: rename surfaces



Wilfrick
09-14-2013, 05:49 PM
Hi,

I have a lot of scenes.
Each scene has a lot of simple objects (for example: obj_01, obj_02, etc.).
Each object has only 1 surface, but the name is "default" (or other name, but all objects have the same surface name).
So in surface panel I see all separated objects with the same surface name.

No problems if I stay in lightwave, I assign the textures (1 each object) and no problems.... but I need to export all the scenes in a 3drealtime program (shockwave).
If the objects have the same surface name, the 3drealtime applications see only 1 surface!

So, I need to rename all the surfaces.
click, click, click... I spend a lot of hours.

Is there a script, or plug, that can auto-rename the surfaces in layout? Maybe can assign the same object name to surface, not very important, but I need that all the objects have the surfaces with different name.

I found some plugs for modeler, but I really need to do the rename in layout because the objects must be separated (I create the objects from clone and savetransformed, I assign each name and I make a bake render for each object and the textures have the same name of objects so I can't wrong to assign them... if I make some "mass-rename" in modeler (maybe by save a fbx scene and build layers) I lose the object names and it will be impossible to assign the right textures... so I must stay in layout with all separate objects like I created....... and there are a lot of different groups of objects, if I get a little mistake with names I must rebuild the scene from begin.... so, please don't say me to export in modeler and reimport in layout only for surfaces rename, it is a big risk).

Sorry for my bad english, I hope you can understand what I ask.
Thankyou
bye

nickdigital
09-14-2013, 08:52 PM
If you found a uncompiled lscript for Modeler, you might be able to repurpose the code for Layout.

faulknermano
09-14-2013, 10:26 PM
This script will rename _all_ surface names of _all_ meshes with this formatting: <object name>_<original_surfacename>. Script accounts for multi-layered objects by storing original paths.

This script _does not_ save objects; you have to do that yourself after the renaming.

Might need more testing, but seems to work well enough on some of my scenes here.





generic
{

m = Mesh();

while(m)
{
mfile = m.filename; // fullpath
if(flist.contains(mfile))
{
m = m.next();
continue;
}
else
flist[flist.size()+1] = mfile;

s_mfile = split(mfile);

surflist = Surface(m);
surflist.pack(); surflist.trunc();

for(i=1;i<=surflist.size();i++)
{
srf = surflist[i];
newsurfname = s_mfile[3]+"_"+srf;
str = string("Surf_SetSurf \"",srf,"\" \"",s_mfile[3],"\"");
//~ info(str);
CommandInput(str);
str = string("Surf_Rename \"",newsurfname,"\"");
CommandInput(str);
}


m = m.next();
}

}

Wilfrick
09-15-2013, 05:02 AM
This script will rename _all_ surface names of _all_ meshes with this formatting: <object name>_<original_surfacename>. Script accounts for multi-layered objects by storing original paths.
(...)
[/code]

WOW... it works exactly like I need!!!!!

REALLY THANKYOU!!!!!!!!!!!!!!!!!!!

inkpen3d
09-15-2013, 06:28 AM
Also, FYI, if you open the Surface Editor and click on the top left drop-down "Edit by" menu you will see that you have the options of either editing surfaces on a per object basis (the default) or by scene. If you choose the by scene option then all objects with the same surface name will be treated as a single surface.

Tip 1: Whilst in the by object mode, right click on the surface name of the object whose surface properties you want to propagate, then switch to the by scene mode and then right-click/paste the properties onto the chosen surface name.
Tip 2: The "Filter by" drop-down menu is useful if you have a large number of surfaces.
Tip 3: The right-click menu has a whole bunch of paste options that allow you, for example, to paste just the Shaders properties.

Hope that helps.

Regards,
Peter