PDA

View Full Version : HELP! on change Vmap Name



zyhsu
05-06-2004, 06:08 PM
Hi!
Can somebody tell me how to use L-Script to change V-map name
in modeler, I can not find related command in modeler L-script
command list!
Thanks!!

allankiipli
05-20-2004, 07:43 AM
I would like to know this also.
And this too: How to determine the currently selected weightmap
or morph.
Is it possible with LScript at all.
When i write something like this:
main
{
vmap = VMap(VMWEIGHT);
info (vmap.name);
}

i get the name of first vmap of type 'Weight'.
But it ignores any try to rename it for instance:

rename (vmap, "NewWeight");

or

vmap.name="NewWeight";

evenflcw
05-20-2004, 11:01 PM
Frome the LScript 2.6 release notes:


The currently selected Weight, Texture or Morph vertex map can now be acquired in Modeler by providing an index value of zero (0) to the VMap() constructor when specifying one of the three vertex map types:

vmap = VMap(VMWEIGHT,0) || error("Select a Weight map so I have something to do!");

To rename or copy I think you unfortunatly might have create a new map and "copy" the values from each point over to the new map. To delete, setting each points value to nil should work.

allankiipli
05-21-2004, 07:39 AM
Thanks evenflcw!

zyhsu
05-23-2004, 08:42 AM
evenflcw:
Thanks a lot!
Z.Y.Hsu

zyhsu
06-21-2004, 09:23 AM
evenflcw:

I follow your suggestion to write a script to change existing vmap name:

main
{

vmapObj = VMap("p1");
info(vmapObj);
selmode(DIRECT);
editbegin();
pntCnt = pointcount();
for(pnt = 1; pnt <= pntCnt; pnt++)
{
if(vmapObj.isMapped(points[pnt]))
{
values = vmapObj.getValue(points[pnt]);
}
vmapObj = VMap("p2");
vmapObj.setValue(points[pnt],values);
}
editend();
}

(where "p1" and "p2" is existing vmap)

But it is not work, Please tell me why?
Thanks!!

faulknermano
06-21-2004, 06:50 PM
main
{


selmode(USER);
editbegin();
pntCnt = pointcount();
vmapObj = VMap(VMWEIGHT,"p1");
for(pnt = 1; pnt <= pntCnt; pnt++)
{
if(vmapObj.isMapped(points[pnt]))
{
values = vmapObj.getValue(points[pnt]);

vmapObj2 = VMap(VMWEIGHT,"p2");
if(values)
vmapObj2.setValue(points[pnt],values);
}
}
editend();
}


(assuming that "p1" and "p2" are existing vmaps... the problem with your script is that you did not specify what kind of vmap "p1" and "p2" were, that is VMWEIGHT. also, if, for example, "p2" does not exist, you must _create_ the vmap. if you create, you must specify the number of 'elements' the vmap has in the third argument to VMap():



myvmap = VMap(VMWEIGHT,"p2",1);