Guest User

Untitled

a guest
Feb 25th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. # ...
  2. elemtypes = ["BALL", "CAPSULE", "PLANE", "ELLIPSOID", "CUBE"]
  3.  
  4. # Create metaball data, then assign it to a metaball object.
  5. mbdata = bpy.data.metaballs.new("SphereData")
  6. mbdata.render_resolution = 0.075
  7. mbdata.resolution = 0.2
  8. mbobj = bpy.data.objects.new("Sphere", mbdata)
  9. bpy.context.scene.objects.link(mbobj)
  10.  
  11. # Add a material to the metaball.
  12. mat = bpy.data.materials.new(name = "SphereMaterial")
  13. mat.diffuse_color = (0.0, 0.5, 1.0)
  14. mbobj.data.materials.append(mat)
  15.  
  16. for i in range(0, latitude):
  17. # ...
  18. for j in range(0, longitude):
  19. # ...
  20.  
  21. # Add a metaelement to the metaball.
  22. # See elemtypes array above for possible shapes.
  23. mbelm = mbdata.elements.new(type = elemtypes[3])
  24. mbelm.co = pt
  25. mbelm.radius = 0.15 + sz * abssinphi * 1.85
  26. # Stiffness of blob, in a range of 1 .. 10.
  27. mbelm.stiffness = 1.0
  28.  
  29. # Set some metaelements to have a repulsive, rather than attractive force.
  30. if i % 7 == j % 3:
  31. mbelm.use_negative = True
  32.  
  33. for f in range(0, fcount):
  34. # ...
  35.  
  36. # Update location.
  37. vecrotate(twopi * fprc, axis, pt, rotpt)
  38. mbelm.co = rotpt
  39. mbelm.keyframe_insert(data_path = "co")
  40.  
  41. currframe += fincr
Add Comment
Please, Sign In to add comment