class ObjectExporter:
def __init__(self):
self.show_progress = True
- self.use_strips = True
- self.use_degen_tris = False
- self.use_textures = True
self.export_all = False
self.collection = False
self.shared_resources = True
- self.export_lods = True
def compute_bounding_sphere(self, obj):
p1 = max(((v.co, v.co.length) for v in obj.data.vertices), key=lambda x:x[1])[0]
def collect_object_lods(self, obj):
lods = [obj]
- if self.export_lods:
- lods += sorted([c for c in obj.children if c.lod_for_parent], key=(lambda l: l.lod_index))
- for i, l in enumerate(lods):
- if i>0 and l.lod_index!=i:
- raise Exception("Inconsistent LOD indices")
+ lods += sorted([c for c in obj.children if c.lod_for_parent], key=(lambda l: l.lod_index))
+ for i, l in enumerate(lods):
+ if i>0 and l.lod_index!=i:
+ raise Exception("Inconsistent LOD indices")
return lods
def create_mesh_exporter(self):
from .export_mesh import MeshExporter
mesh_export = MeshExporter()
- mesh_export.use_strips = self.use_strips
- mesh_export.use_degen_tris = self.use_degen_tris
return mesh_export
def create_material_exporter(self):
from .export_material import MaterialExporter
material_export = MaterialExporter()
- material_export.use_textures = self.use_textures
return material_export
def create_material_atlas_exporter(self):
progress.pop_task()
- def export_object_resources(self, context, obj, resources, progress, material_atlass=None):
- if material_atlass is None:
- material_atlass = {}
+ def export_object_resources(self, context, obj, resources, progress, material_atlases=None):
+ if material_atlases is None:
+ material_atlases = {}
lods = self.collect_object_lods(obj)
if not all(atlas_flags) or key_mismatch:
raise Exception("Conflicting settings in object materials")
- if material_atlas_key in material_atlass:
- material_atlas = material_atlass[material_atlas_key]
+ if material_atlas_key in material_atlases:
+ material_atlas = material_atlases[material_atlas_key]
else:
material_atlas = create_material_atlas(context, l.data.materials[0])
- material_atlass[material_atlas_key] = material_atlas
+ material_atlases[material_atlas_key] = material_atlas
tech_name = "{}.tech".format(material_atlas.name)
if tech_name not in resources: