fix(Editor): Force canvas extraction for blob URLs to avoid revoked blob errors
Build and Deploy / build-and-push (push) Successful in 47s
Build and Deploy / build-and-push (push) Successful in 47s
This commit is contained in:
@@ -268,10 +268,13 @@ export const extractTextureUrl = (texture: any) => {
|
|||||||
if (!texture) return undefined;
|
if (!texture) return undefined;
|
||||||
const img = texture.image || (texture.source && texture.source.data);
|
const img = texture.image || (texture.source && texture.source.data);
|
||||||
if (!img) return undefined;
|
if (!img) return undefined;
|
||||||
if (typeof img.src === 'string' && img.src.length > 0) return img.src;
|
|
||||||
if (typeof img.currentSrc === 'string' && img.currentSrc.length > 0) return img.currentSrc;
|
// If we have a stable URL that isn't a blob, return it directly
|
||||||
|
if (typeof img.src === 'string' && img.src.length > 0 && !img.src.startsWith('blob:')) return img.src;
|
||||||
|
if (typeof img.currentSrc === 'string' && img.currentSrc.length > 0 && !img.currentSrc.startsWith('blob:')) return img.currentSrc;
|
||||||
|
|
||||||
// Fallback: draw ImageBitmap or HTMLImageElement to canvas to extract data URL
|
// Fallback: draw ImageBitmap or HTMLImageElement to canvas to extract data URL
|
||||||
|
// We MUST do this for blob: URLs because GLTFLoader revokes blob URLs after loading!
|
||||||
try {
|
try {
|
||||||
const MAX = 1024;
|
const MAX = 1024;
|
||||||
let scale = 1;
|
let scale = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user