]> git.tdb.fi Git - libs/gl.git/commitdiff
Ignore already existing resources in DataExporter
authorMikko Rasa <tdb@tdb.fi>
Sat, 17 Apr 2021 10:25:39 +0000 (13:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 17 Apr 2021 10:31:27 +0000 (13:31 +0300)
blender/io_mspgl/export.py

index 96f39320ec7d35e590840573d7d9b7d75b53df8b..4751468b416a4b1316ae7c089dc3990c09707e0e 100644 (file)
@@ -51,26 +51,33 @@ class DataExporter:
 
                for i, obj in enumerate(objects):
                        progress.push_task_slice(obj.name, i, len(objects))
+                       res_name = None
                        res = None
                        if obj.type=='MESH':
-                               if not object_exporter:
-                                       from .export_object import ObjectExporter
-                                       object_exporter = ObjectExporter()
-                               object_exporter.export_object_resources(context, obj, resources, material_atlases, progress)
-                               res = object_exporter.export_object(obj, resources, progress)
+                               res_name = obj.name+".object"
+                               if res_name not in resources:
+                                       if not object_exporter:
+                                               from .export_object import ObjectExporter
+                                               object_exporter = ObjectExporter()
+                                       object_exporter.export_object_resources(context, obj, resources, material_atlases, progress)
+                                       res = object_exporter.export_object(obj, resources, progress)
                        elif obj.type=='CAMERA':
-                               if not camera_exporter:
-                                       from .export_camera import CameraExporter
-                                       camera_exporter = CameraExporter()
-                               res = camera_exporter.export_camera(obj)
+                               res_name = obj.name+".camera"
+                               if res_name not in resources:
+                                       if not camera_exporter:
+                                               from .export_camera import CameraExporter
+                                               camera_exporter = CameraExporter()
+                                       res = camera_exporter.export_camera(obj)
                        elif obj.type=='ARMATURE':
-                               if not armature_exporter:
-                                       from .export_armature import ArmatureExporter
-                                       armature_exporter = ArmatureExporter()
-                               res = armature_exporter.export_armature(context, obj)
+                               res_name = obj.name+".arma"
+                               if res_name not in resources:
+                                       if not armature_exporter:
+                                               from .export_armature import ArmatureExporter
+                                               armature_exporter = ArmatureExporter()
+                                       res = armature_exporter.export_armature(context, obj)
 
                        if res:
-                               resources[res.name] = res
+                               resources[res_name] = res
                                dummy_res.create_reference_statement("ref", res)
 
                        progress.pop_task()