Results 1 to 3 of 3

Thread: Faster way to access vertex maps

  1. #1
    Registered User
    Join Date
    Nov 2011
    Location
    Finland
    Posts
    4

    Faster way to access vertex maps

    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):
    Code:
    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):
    Code:
    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?

  2. #2
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,897
    Quote Originally Posted by Ilkka View Post
    Both are dead slow. Is there anything I can do to speed them up?
    Write C/C++ plugin.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Location
    Finland
    Posts
    4
    Quote Originally Posted by Sensei View Post
    Write C/C++ plugin.
    That's what I was afraid of...

    Thanks for the answer!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •