PDA

View Full Version : Faster way to access vertex maps



Ilkka
10-16-2012, 01:12 AM
Hi,

Is there any other way to access weight maps in a modeler lscript than the getValue/setValue/isMapped methods in vertex map object agent? If you have lots of weight maps and vertices, these functions are really slow. Basically what I'd like to do is read all weight map information into memory and clear the weightmaps.

My code for reading the vertex maps looks like this (I do this for every vertex):


vmapObj = VMap(VMWEIGHT);
weightmaps = 0;
while (vmapObj && vmapObj.type == VMWEIGHT) {
if(vmapObj.isMapped(point)) {
value = vmapObj.getValue(point);
if (value[1]!=0) {
weightmaps++;
weightmapValue[weightmaps] = number(value[1]);
weightmapName[weightmaps] = vmapObj.name;
}
}
vmapObj = vmapObj.next();
}


And this is how I clear the maps (again, for every vertex):


vmapObj = VMap(VMWEIGHT);
while (vmapObj && vmapObj.type == VMWEIGHT) {
if(vmapObj.isMapped(points[i])) {
vmapObj.setValue(points[i], 0);
}
vmapObj = vmapObj.next();
}


Both are dead slow. Is there anything I can do to speed them up?

Sensei
10-16-2012, 03:38 AM
Both are dead slow. Is there anything I can do to speed them up?

Write C/C++ plugin.

Ilkka
10-16-2012, 04:41 AM
Write C/C++ plugin.
That's what I was afraid of...

Thanks for the answer!