Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ...
- elemtypes = ["BALL", "CAPSULE", "PLANE", "ELLIPSOID", "CUBE"]
- # Create metaball data, then assign it to a metaball object.
- mbdata = bpy.data.metaballs.new("SphereData")
- mbdata.render_resolution = 0.075
- mbdata.resolution = 0.2
- mbobj = bpy.data.objects.new("Sphere", mbdata)
- bpy.context.scene.objects.link(mbobj)
- # Add a material to the metaball.
- mat = bpy.data.materials.new(name = "SphereMaterial")
- mat.diffuse_color = (0.0, 0.5, 1.0)
- mbobj.data.materials.append(mat)
- for i in range(0, latitude):
- # ...
- for j in range(0, longitude):
- # ...
- # Add a metaelement to the metaball.
- # See elemtypes array above for possible shapes.
- mbelm = mbdata.elements.new(type = elemtypes[3])
- mbelm.co = pt
- mbelm.radius = 0.15 + sz * abssinphi * 1.85
- # Stiffness of blob, in a range of 1 .. 10.
- mbelm.stiffness = 1.0
- # Set some metaelements to have a repulsive, rather than attractive force.
- if i % 7 == j % 3:
- mbelm.use_negative = True
- for f in range(0, fcount):
- # ...
- # Update location.
- vecrotate(twopi * fprc, axis, pt, rotpt)
- mbelm.co = rotpt
- mbelm.keyframe_insert(data_path = "co")
- currframe += fincr
Add Comment
Please, Sign In to add comment