PDA

View Full Version : problems with renamesurface()


tcg3j
11-04-2005, 03:27 PM
Hello, I'm trying to write a Modeler script to rename all surfaces to a unique name. The renamesurface() function is not giving me the results I expect. When I run the script, I at least one surface renamed with garbage characters. If there are multiple objects, open in Modeler, the results are even more "off". I'm using LightWave 8.3. My code is embedded below.

Thanks in advance for any help.

Tim


@warnings
@version 2.3
@script modeler
@name "RenameSurfaces"

main
{

// get currently selected object
obj = Mesh(0);
// get list of object's surface names
surfNames = Surface(obj);

//debug();

if(surfNames != nil)
{
for(i=1; i <= size(surfNames); i++)
{
renamesurface(surfNames[i], string("tempSName", i) );
}

/*
surfNames = Surface(obj);
for(i=1; i <= size(surfNames); i++)
{
renamesurface(surfNames[i], string("surface", i) );
}
*/
info("Rename complete.");
}
else
{
info("No surfaces found.");
}
}

tcg3j
11-08-2005, 10:17 AM
After closer examination, the script does work correctly when only one object is loaded. If there are multiple objects loaded that share some of the same surface names, the rename will malfunction. Also, if the Surface Editor is open, one of the surface names will appear to be corrupted, but it's only in Surface Editor's display.

So, in short, the quick solution is close all other objects and close Surface Editor. :)

Tim