add current selection to vertexmap



  • 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?



  • 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()  
      
    


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

    Hello Pyr,

    was your question answered?

    Best wishes,
    Sebastian


Log in to reply