Browse Source

Fix for scene texture duplication, GLTF exporter improperly compared texture URI against non-clashing texture URI when creating gltfImage

Nicholas Barlow 6 years ago
parent
commit
6f3b43e26a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      serializers/src/glTF/2.0/glTFMaterialExporter.ts

+ 3 - 1
serializers/src/glTF/2.0/glTFMaterialExporter.ts

@@ -1209,6 +1209,7 @@ export class _GLTFMaterialExporter {
 
         let extension = mimeType === ImageMimeType.JPEG ? '.jpeg' : '.png';
         let textureName = baseTextureName + extension;
+        let originalTextureName = textureName;
         if (textureName in imageData) {
             textureName = `${baseTextureName}_${Tools.RandomId()}${extension}`;
         }
@@ -1220,8 +1221,9 @@ export class _GLTFMaterialExporter {
                 uri: textureName
             };
             let foundIndex: Nullable<number> = null;
+
             for (let i = 0; i < images.length; ++i) {
-                if (images[i].uri === textureName) {
+                if (images[i].uri === originalTextureName) {
                     foundIndex = i;
                     break;
                 }