X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_object.py;h=f01972351549dcb60ba5bc8c45ff140180498008;hb=5fdcff1c3b9560b251c694175176e3e8a4f38723;hp=b911ed362bb242bc84f7f040a7ac25b90ac3e99a;hpb=84269f7b598673b06757313d70934a1747045b69;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_object.py b/blender/io_mspgl/export_object.py index b911ed36..f0197235 100644 --- a/blender/io_mspgl/export_object.py +++ b/blender/io_mspgl/export_object.py @@ -28,6 +28,7 @@ class ObjectExporter: self.srgb_colors = True self.textures = "REF" self.separate_mesh = False + self.shared_mesh = True self.separate_tech = False self.external_tech = True self.shared_tech = True @@ -68,9 +69,8 @@ class ObjectExporter: out_file.begin("level_of_detail", i) objs = [l] - same_mesh = (l.data.name==prev_mesh) - if i==0 or not same_mesh: - mesh = self.export_object_mesh(context, out_file, i, objs, progress) + if i==0 or l.data.name!=prev_mesh: + mesh = self.export_object_mesh(context, out_file, l, objs, progress) prev_mesh = l.data.name same_tech = True @@ -88,15 +88,21 @@ class ObjectExporter: if i>0: out_file.end() - def export_object_mesh(self, context, out_file, lod_index, objs, progress): + def export_object_mesh(self, context, out_file, lod, objs, progress): from .export_mesh import MeshExporter mesh_export = MeshExporter() for k, v in self.__dict__.items(): setattr(mesh_export, k, v) + lod_index = 0 + if lod.lod_for_parent: + lod_index = lod.lod_index + if self.separate_mesh: from .outfile import open_output path, name = external_name(out_file, ".mesh", lod_index) + if self.shared_mesh: + name = lod.data.name+".mesh" mesh_out = open_output(os.path.join(path, name)) mesh = mesh_export.export(context, mesh_out, objs, progress) out_file.write("mesh", '"{}"'.format(name))