PDA

View Full Version : texture info- uv map ?



markschum
12-27-2007, 11:16 AM
Hi all,

I am trying to do a script to automate the adding of a uvmap to all surfaces so the uv info will be exported when saving an obj file.
I am starting with getting the current settings .

The script I am using does not seem to get the name of the uvmap from the texture though. It returns (nil) :thumbsdow

Here is the code :

@version 2.2
@warnings
@script modeler

// global values go here

main
{
meshobj = Mesh(0);
surfnames = Surface(meshobj);
foreach(s,surfnames)
{
t = Surface(s).getTexture(SURFCOLR);
if (t)
{
l=t.firstLayer();
p = l.getValue(TXLRPROJECT);
q = l.getValue(TXLRVMAP);
info(s,p,q);
}
else
{
info(s, "No texture");
}
}
info(msg);
vmap = VMap(VMTEXTURE);
if (vmap)
{
info("vmap:", vmap.name);
}

}


when run I get surface name, 5,(nil) in the info message if a texture exists
and I get the uv map name at the end .

I was thinking that getValue(TXLRVMAP) should return the map name or
a vmap obj but I get (nil)


Any suggestion ?


thanks

markschum
12-30-2007, 12:01 PM
:( anyone at all ? :(


:grin:

LightFreeze
01-05-2008, 08:24 PM
you can pick this apart if you want, the bit your looking for is

vmns;
vmap = VMap(VMTEXTURE);
while(vmap && vmap.type == VMTEXTURE)
{
vmns+=vmap.name;
vmap = vmap.next();
}
if(vmns.size() == 0)
{
info("No UV Maps Found");
return;
}