X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_mesh.py;h=2a8dbe0057062411541507d1faf6fad0509e9812;hb=8bf70f4d445cf63386ad7aafc5b3ebdbd8369939;hp=16f9514a97402443cadd8bb12d2ce1ca6e2170ee;hpb=86721a55699193e63c76e8a0a7b0ced0416c1cce;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index 16f9514a..2a8dbe00 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -4,51 +4,6 @@ import bpy import mathutils class MeshExporter: - def __init__(self): - self.show_progress = True - self.use_strips = True - self.use_degen_tris = False - self.export_all = False - - def join_strips(self, strips): - big_strip = [] - - for s in strips: - if big_strip: - # Generate glue elements, ensuring that the next strip begins at - # an even position - glue = [big_strip[-1], s[0]] - if len(big_strip)%2: - glue += [s[0]] - - big_strip += glue - - big_strip += s - - return big_strip - - def export_to_file(self, context, out_fn): - if self.export_all: - objs = [o for o in context.selected_objects if o.type=="MESH"] - else: - objs = [context.active_object] - - from .util import Progress - - path, base = os.path.split(out_fn) - base, ext = os.path.splitext(base) - - progress = Progress(self.show_progress and context) - for i, obj in enumerate(objs): - if self.export_all: - out_fn = os.path.join(path, obj.data.name+ext) - - progress.push_task_slice(obj.data.name, i, len(objs)) - resource = self.export_mesh(context, obj, progress) - - resource.write_to_file(out_fn) - progress.pop_task() - def export_mesh(self, context, mesh_or_obj, progress): from .mesh import Mesh, create_mesh_from_object @@ -117,12 +72,8 @@ class MeshExporter: statements.append(st) - if self.use_strips: - strips = mesh.vertex_sequence - if self.use_degen_tris: - strips = [self.join_strips(strips)] - - for s in strips: + if mesh.use_strips: + for s in mesh.vertex_sequence: st = Statement("batch", Token("TRIANGLE_STRIP")) for i in range(0, len(s), 32): st.sub.append(Statement("indices", *(v.index for v in s[i:i+32])))