hotfix pixi blob texture

PixiJS blob URL テクスチャ読み込み修正

修正日: 2026-05-13

問題

PixiJS v8 で Assets.load(blobUrl) を呼ぶと、パーサー選択ステップで以下のエラーが発生しテクスチャが null になる。

[Assets] blob:http://127.0.0.1:1420/... could not be loaded as we don't know how to parse it
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'texture')
    at new Sprite (Sprite.mjs:16)
    at render (App.tsx:827)

根本原因

loadTextures パーサー(node_modules/pixi.js/lib/assets/loader/parsers/textures/loadTextures.mjs)の test() は拡張子(.png 等)または data:image/... URLのみを受理する。blob:http://... はどちらにも該当しないためパーサーが未選択となる。

// loadTextures.mjs:41
test(url) {
    return checkDataUrl(url, validImageMIMEs) || checkExtension(url, validImageExtensions);
}

修正箇所

ファイル変更内容
src/App.tsx821Assets.load(url)Assets.load({ src: url, parser: 'loadTextures' })

変更前

const texture = (await Assets.load(currentAsset.normalizedPngUrl)) as Texture;

変更後

const texture = (await Assets.load({ src: currentAsset.normalizedPngUrl, parser: 'loadTextures' })) as Texture;

parser: 'loadTextures' を指定することで test() をスキップし、blob URLでも直接 loadTextures パーサーが使われる。Assets.unload(blobUrl) はキャッシュキーが src と同一のため変更不要。

検証

確認項目結果
npx tsc --noEmitエラーなし

影響範囲

usePixiRenderer フック内の render 関数のみ。他のパス(Assets.unload、メッシュ描画、プロジェクト保存)への変更なし。