浏览代码

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

Nicholas Barlow 6 年之前
父节点
当前提交
6f3b43e26a
共有 1 个文件被更改,包括 3 次插入1 次删除
  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;
                 }