mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
修复CubeTexture以data开头的src保存bug。
This commit is contained in:
parent
a459fd3039
commit
5072d48d8b
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user