I have a problem with the following code.
there are 4 objects this script creates.
the problem is, each time a new object is created,
the old object is replaced.
here is the relevant part of the code.
def make_teapot(FileName, Resolution): FileNames = [None, teapot, teaspoon, teacup, onepatch] FileName = FileNames[FileName] Patches = read_indexed_patch_file(FileName) Raw = patches_to_raw(Patches, Resolution) Verts, Faces = raw_to_indexed(Raw) create_mesh(Verts, Faces, "Teapot") Blender.Window.RedrawAll() # =========================== # === Create Blender Mesh === # =========================== def create_mesh(verts, faces, objname, norms=, uvs=): me = Blender.Mesh.New(objname) me.verts.extend(verts) me.faces.extend(faces) # # if norms: # for i in range(len(norms)): # me.verts[i].no = Blender.Mathutils.Vector(norms[i]) # me.vertexUV = 1 # me.verts[i].uvco = Blender.Mathutils.Vector(uvs[i]) # for face in me.faces: # face.smooth = 1 scn = Blender.Scene.GetCurrent() for ob in scn.objects: if ob.name.find(objname) == 0: scn.objects.unlink(ob) ob = scn.objects.new(me, objname)
so how would I change this to create a new object, without replacing the old, each time the script is run?