X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_mesh.py;h=dbb3a269fcdab5f711bab6920da3f6f9b696e1ff;hb=7533ecca549e09eab5ef229292de8908370c395c;hp=18ae856a927ce8f28b70a45c51ab4ed5b9cfda00;hpb=820d8ff86b911f1119b8cde03839687176b9b1ee;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index 18ae856a..dbb3a269 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -35,11 +35,11 @@ class VertexCache: class MeshExporter: def __init__(self): self.use_strips = True - self.use_degen_tris = True + self.use_degen_tris = False self.max_strip_len = 1024 - self.optimize_cache = False + self.optimize_cache = True self.cache_size = 64 - self.export_lines = True + self.export_lines = False self.export_uv = "UNIT0" self.tbn_vecs = False self.tbn_uvtex = "" @@ -194,6 +194,15 @@ class MeshExporter: def export(self, context, out_file): if self.compound: objs = context.selected_objects + check = objs + while check: + children = [] + for o in check: + for c in o.children: + if c.compound: + children.append(c) + objs += children + check = children else: objs = [context.active_object] @@ -303,7 +312,7 @@ class MeshExporter: fmt.append("VERTEX3") out_file.begin("vertices", *fmt) normal = None - uvs = [None]*(max(u[0] for u in texunits)+1) + uvs = {} tan = None bino = None group = None @@ -312,7 +321,7 @@ class MeshExporter: out_file.write("normal3", *v.normal) normal = v.normal for i, u in texunits: - if v.uvs[i]!=uvs[i]: + if v.uvs[i]!=uvs.get(i): if u.unit==0 or force_unit0: out_file.write("texcoord2", *v.uvs[i]) else: @@ -356,7 +365,7 @@ class MeshExporter: out_file.end() if self.export_lines and mesh.lines: - out_file.write("batch", "LINES") + out_file.begin("batch", "LINES") for l in mesh.lines: out_file.write("indices", l.vertices[0].index, l.vertices[1].index) out_file.end()