SHARE
TWEET

Untitled

a guest Jun 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bpy
  2.  
  3. arm = bpy.data.objects['Armature']
  4. obj = bpy.data.objects['Cube']
  5.  
  6. obj_verts = obj.data.vertices
  7. obj_group_names = [g.name for g in obj.vertex_groups]
  8.  
  9. for bone in arm.pose.bones:
  10.     if bone.name not in obj_group_names:
  11.         continue
  12.  
  13.     gidx = obj.vertex_groups[bone.name].index
  14.  
  15.     bone_verts = [v for v in obj_verts if gidx in [g.group for g in v.groups]]
  16.  
  17.     for v in bone_verts:
  18.         for g in v.groups:
  19.             if g.group == gidx:
  20.                 w = g.weight
  21.                 print('Vertex',v.index,'has a weight of',w,'for bone',bone.name)
  22.      
  23. vc f f f
  24.      
  25. f position/uv/norm/skel position/uv/norm/skel position/uv/norm/skel
  26.      
  27. #Solid red
  28. vc 1.0 0.0 0.0
  29. #Solid green
  30. vc 0.0 1.0 0.0
  31.      
  32. #Bone 1 influences this vertex 100 percent, there are no others
  33. vc 1.5 0.0 0.0
  34. #50 percent influenced by bone 1, 25 percent by bone 2, and 25 percent by bone 3
  35. vc 1.25 2.125 3.125
  36.      
  37. f A/B/C/A
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top