From: Mikko Rasa Date: Sat, 17 Apr 2021 10:25:39 +0000 (+0300) Subject: Ignore already existing resources in DataExporter X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=4ae86b67b65259a3d73ef191ca7cef3e7f3135d8 Ignore already existing resources in DataExporter --- diff --git a/blender/io_mspgl/export.py b/blender/io_mspgl/export.py index 96f39320..4751468b 100644 --- a/blender/io_mspgl/export.py +++ b/blender/io_mspgl/export.py @@ -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()