Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    CAWeightTag.TransferWeightMap Hows it work?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 399 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post