From 7a4227047a905b0c00c7bb6e59559e2cd19a0d56 Mon Sep 17 00:00:00 2001 From: Currency Date: Sun, 13 Apr 2025 15:10:45 +0200 Subject: [PATCH] Update xml_map_importer.py --- xml_map_importer.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xml_map_importer.py b/xml_map_importer.py index 7180fb8..f1480ce 100644 --- a/xml_map_importer.py +++ b/xml_map_importer.py @@ -364,22 +364,19 @@ class IMPORT_OT_xml_map(Operator, ImportHelper): cache_key = f"{library_name}_{group_name}_{prop_name}" - mesh_data = None material = None if self.use_caching and cache_key in self._mesh_cache: - - mesh_data = self._mesh_cache[cache_key] + # get the cached mesh data, but make a copy when you need a different material + original_mesh_data = self._mesh_cache[cache_key] + mesh_data = original_mesh_data.copy() - if texture_name and texture_name in self._material_cache: material = self._material_cache[texture_name] else: - mesh_data = self.import_mesh_data(context, mesh_path, library_name, prop_name) - if self.use_caching and mesh_data: self._mesh_cache[cache_key] = mesh_data @@ -651,4 +648,4 @@ def unregister(): bpy.utils.unregister_class(cls) if __name__ == "__main__": - register() \ No newline at end of file + register()