From 3e4e6a2c15b5a61f6e713e12290cd10e82b20513 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 16 Oct 2021 11:12:29 +0300 Subject: [PATCH] Simplify exporter creation Since options are no longer set as instance variables, the helper functions feel unnecessary. --- blender/io_mspgl/export_material.py | 9 ++------- blender/io_mspgl/export_object.py | 25 ++++++------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 69782b64..792ab290 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -50,14 +50,9 @@ def create_technique_resource(material, resources): return tech_res class MaterialExporter: - def create_texture_exporter(self): - from .export_texture import TextureExporter - texture_export = TextureExporter() - return texture_export - def export_technique_resources(self, material, resources): - from .export_texture import SamplerExporter - texture_export = self.create_texture_exporter() + from .export_texture import SamplerExporter, TextureExporter + texture_export = TextureExporter() sampler_export = SamplerExporter() from .material import Material diff --git a/blender/io_mspgl/export_object.py b/blender/io_mspgl/export_object.py index 6e91df8d..040f5302 100644 --- a/blender/io_mspgl/export_object.py +++ b/blender/io_mspgl/export_object.py @@ -24,32 +24,19 @@ class ObjectExporter: return lods - def create_mesh_exporter(self): - from .export_mesh import MeshExporter - mesh_export = MeshExporter() - return mesh_export - - def create_material_exporter(self): - from .export_material import MaterialExporter - material_export = MaterialExporter() - return material_export - - def create_material_atlas_exporter(self): - from .export_material import MaterialAtlasExporter - material_atlas_export = MaterialAtlasExporter() - return material_atlas_export - def export_object_resources(self, context, obj, resources, material_atlases, progress): if material_atlases is None: material_atlases = {} lods = self.collect_object_lods(obj) + from .export_mesh import MeshExporter + from .export_material import MaterialAtlasExporter, MaterialExporter from .mesh import create_mesh_from_object - from .material import create_material_atlas - mesh_export = self.create_mesh_exporter() - material_export = self.create_material_exporter() - material_atlas_export = self.create_material_atlas_exporter() + from .material import Material, create_material_atlas + mesh_export = MeshExporter() + material_export = MaterialExporter() + material_atlas_export = MaterialAtlasExporter() for i, l in enumerate(lods): lod_index = l.lod_index if l.lod_for_parent else 0 -- 2.45.2