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
    • Recent
    • Tags
    • Users
    • Login

    add current selection to vertexmap

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 307 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 21/05/2015 at 12:37, xxxxxxxx wrote:

      i got an object with an vertex map tag on it. now ich want to apply a value to a selected point. how?

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

        On 22/05/2015 at 01:24, xxxxxxxx wrote:

        Hello,

        this script converts a weight map to a point selection.
        Hope this helps!

        Edit:
         the other way round could be done by using SetAllHighlevelData("the array with your selection")

        Best wishes
        Martin

          
        import c4d, time  
        from c4d import gui  
          
          
          
        def main() :  
            
          #validate object and weighttag  
          if not op:return  
          if not op.IsInstanceOf(c4d.Opolygon) :return  
          pwtag = op.GetTag(c4d.Tvertexmap)  
          if not pwtag: return  
          
            
          #get weight data  
          weightarray = pwtag.GetAllHighlevelData()  
            
          #deselect points  
          selPoints = op.GetPointS()  
          selPoints.DeselectAll()  
            
          pointcount = op.GetPointCount()  
          t = time.time()  
            
          #Set the PointWeights to Selection   
          for i in xrange(pointcount) :  
              if weightarray[i]>0.5:        
                  selPoints.Select(i)  
          
          
          t1 = time.time() - t  
          print "converted to selection piece by piece in  "+ str(t1) + " sec"  
                
          
                
          c4d.EventAdd()  
          
        if __name__=='__main__':  
          main()  
          
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 29/05/2015 at 07:45, xxxxxxxx wrote:

          Hello Pyr,

          was your question answered?

          Best wishes,
          Sebastian

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