hey guys,
right now I write a script to send the meshdata of my objects over tcp to another program. It works quite good but there are a few problems.
first I want to ask you if there is a better way to get all the mesh-data. right now I do it that way:
def getMeshData(self,obj):
temp = {}
vertices = []
normals = []
indices = []
if obj.data.is_editmode:
bm = bmesh.from_edit_mesh(obj.data)
else:
bm = bmesh.new()
bm.from_mesh(obj.data)
bmesh.ops.split_edges(bm,edges=bm.edges, verts=bm.verts)
bmesh.ops.triangulate(bm,faces=bm.faces)
for vert in bm.verts:
vertices.append(vert.co[0])
vertices.append(vert.co[2])
vertices.append(vert.co[1])
normals.append(vert.normal[0])
normals.append(vert.normal[2])
normals.append(vert.normal[1])
for face in bm.faces:
for vert in face.verts:
indices.append(vert.index)
temp = {'vertices':vertices, 'normals':normals, 'indices':indices}
second: If I do it this way and tab into edit mode and back to object mode my object gets splitted edges and triangulated. but I thought If I use bmesh the original objects doesnt get changed. what do I get wrong here?
thank you for your help in advance
cheers