Step one: Give the Cube an Edge Split modifier and apply it. Now you have a mesh with 6 separate faces. If you have a mesh with less pronounced angles, you might need to select all faces and hit CTRLE 'Mark Sharp'.
Step two: Go into edit mode and hit P for seParate and choose 'By loose parts'.
Step three, optional: in object mode, select all the new objects and in the tools, use 'set origin to geometry'. All faces have the object origin moved into their middle. Depends on what you want to do.
I recommend saving before trying this with a mesh that has lots of faces. Separate can take quite some time and has no indicator whether it's still working.
P.S.: I scaled the object centers of the right Suzie's faces to illustrate the effect. If I hadn't, it would look identical to the left Suzie.
I eventually came up with a script. It uses the active object as its source.
import bpy
targetName = "new-object" # name for the new objects
def createNewObj(verts, faces):
global targetName
newMesh = bpy.data.meshes.new(targetName)
newMesh.from_pydata(verts, [], faces)
newMesh.update()
obj = bpy.data.objects.new(targetName, newMesh)
scene = bpy.context.scene
scene.objects.link(obj)
def iterateFaces(sourceName):
obj = bpy.data.objects[sourceName]
mesh = obj.data
verts = mesh.vertices
faces = mesh.polygons
total = len(faces)
counter = 0
for a in faces:
newFace = [list(range(len(a.vertices)))]
newVerts = []
for b in a.vertices:
newVerts.append(verts[b].co)
createNewObj(newVerts, newFace)
counter += 1
if counter % 100 == 0:
print(counter,"/", total, "done")
if counter % 100 != 0:
print(total,"/", total, "done")
print("Separation finished.")
if bpy.context.active_object.type == 'MESH':
sourceName = bpy.context.active_object.name
iterateFaces(sourceName)
else:
print("The selected object isn't a mesh")