diff --git a/ShadowEditor.Web/src/serialization/texture/CubeTextureSerializer.js b/ShadowEditor.Web/src/serialization/texture/CubeTextureSerializer.js index af656896..e859bbe8 100644 --- a/ShadowEditor.Web/src/serialization/texture/CubeTextureSerializer.js +++ b/ShadowEditor.Web/src/serialization/texture/CubeTextureSerializer.js @@ -19,13 +19,22 @@ CubeTextureSerializer.prototype.toJSON = function (obj) { json.image = []; obj.image.forEach(n => { - var url = new URL(n.src); // 修复贴图路径自带服务端路径bug - json.image.push({ - tagName: 'img', - src: url.pathname, - width: n.width, - height: n.height - }); + if (n.src.startsWith('data')) { // base64 + json.image.push({ + tagName: 'img', + src: n.src, + width: n.width, + height: n.height + }); + } else { // url + var url = new URL(n.src); // 修复贴图路径自带服务端路径bug + json.image.push({ + tagName: 'img', + src: url.pathname, + width: n.width, + height: n.height + }); + } }); return json;