]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_scene.py
Compare materials when looking for object clones while exporting a scene
[libs/gl.git] / blender / io_mspgl / export_scene.py
index 16435e8f1b487ea089fad5edcdc42092709c677e..18cdcbca2404cea30f14b89f863e9aecef512c38 100644 (file)
@@ -35,16 +35,15 @@ class SceneExporter:
                                continue
 
                        clones = [o]
-                       if not any(s.link=="OBJECT" for s in o.material_slots):
-                               for u in objs:
-                                       if u is o:
-                                               continue
-                                       if u.data.name!=o.data.name:
-                                               continue
-                                       if any(s.link=="OBJECT" for s in u.material_slots):
-                                               continue
+                       for u in objs:
+                               if u is o:
+                                       continue
+                               if u.data.name!=o.data.name:
+                                       continue
+                               if any(m1.name!=m2.name for m1, m2 in zip(o.material_slots, u.material_slots)):
+                                       continue
 
-                                       clones.append(u)
+                               clones.append(u)
 
                        prefix = o.name
                        for c in clones:
@@ -92,11 +91,11 @@ class SceneExporter:
                object_export = ObjectExporter()
                object_export.single_file = False
 
-               material_atlass = {}
+               material_atlases = {}
 
                for i, o in enumerate(objs):
                        progress.push_task_slice(o.name, i, len(objs))
-                       object_export.export_object_resources(context, o, resources, progress, material_atlass=material_atlass)
+                       object_export.export_object_resources(context, o, resources, progress, material_atlases=material_atlases)
                        obj_name = o.name+".object"
                        resources[obj_name] = object_export.export_object(context, o, progress, resources=resources)
                        progress.pop_task()