]> git.tdb.fi Git - libs/gl.git/commitdiff
Simplify exporter creation
authorMikko Rasa <tdb@tdb.fi>
Sat, 16 Oct 2021 08:12:29 +0000 (11:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 16 Oct 2021 10:41:09 +0000 (13:41 +0300)
Since options are no longer set as instance variables, the helper
functions feel unnecessary.

blender/io_mspgl/export_material.py
blender/io_mspgl/export_object.py

index 69782b64cbb4cd7c3edf4fb3ebcd8064313141d3..792ab2903576ba4a10518fef480c06cb5cc49ac9 100644 (file)
@@ -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
index 6e91df8db2d0a0b8bf302576c0624486744945f1..040f5302f060536c708c0bb9a0300a3c12444317 100644 (file)
@@ -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