CAWeightTag.TransferWeightMap Hows it work?



  • On 30/11/2017 at 23:10, xxxxxxxx wrote:

    Hello,

    I am trying to utilize CAWeightTag.TransferWeightMap in my python plugin, and I can't tell if it isn't working or if I am just doing something stupid.

    Here's my line of code:

    wt.TransferWeightMap(self.doc, wt, sourceID, targID, 0, pointCount)

    So wt, is my weight tag, self.doc is basically doc, sourceID and targID are ID's I obtained by doing wt.FindJoint.

    This is within a loop that goes through and tries to copy weight maps from the source joint to the target.

    It runs without any errors, so I don't know what I am doing wrong here. I also tried using c4d.NOTOK for the last two arguments. the SDK isn't very clear on how to use this, or if this will even work the way I am thinking.

    I've also tried not using wt as an argument, and instead creating a new weight tag and adding joints in there, but am having no luck.

    Could anyone shed some light on how this is supposed to work and/or maybe present an example file? Your help would be greatly appreciated.



  • On 01/12/2017 at 03:10, xxxxxxxx wrote:

    Hello,

    it appears that there are a few issues with TransferWeightMap() in the Python API. So I'm afraid this function is currently not usable. You may have to go a little bit more low level and copy the weights manually using GetWeight()/SetWeight().

      
    # loop through all points  
    pointCount = polyObject.GetPointCount()  
      
    for pointIndex in xrange(pointCount) :  
       
      weight = weightTag.GetWeight(jointIndex, pointIndex)  
        
      print("Point: " + str(pointIndex) + " : " + str(weight))  
    

    best wishes,
    Sebastian



  • On 01/12/2017 at 07:03, xxxxxxxx wrote:

    Thats what I was afraid of.

    Going point by point to set weights across many joints to transfer maps from one to another is very slow and inefficient.

    That is too bad. I guess I will continue to try and work thru learning c++ so it can be faster.


Log in to reply