A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(asset): invalidate resident skeletal atlas images
yhhdf0fa86a7ffb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f328486ae..3b5763e15 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,8 @@ published separately; it ships inside the editor.### Fixed+- **Skeletal atlas edits invalidate resident textures.** Image changes also sever the bare-path residency used by skeletal atlas pages. Reopening a DragonBones scene loads the updated image instead of reviving stale pixels, while existing holders retain their texture until released.+- **DragonBones atlas textures follow skeleton ownership.** Scene loading reuses a resident atlas page and transfers its reference to the skeleton that uses it. The last armature removal and manager disposal release the page; rejected armatures release otherwise unbound skeletons and uploads. Repeated editor scene switching no longer adds a new atlas texture on every load, while paused poses and device recovery continue drawing correctly.- **Late scene-load errors roll back the new entities.** A failing final spawn-phase observer or asset-reference publication step now despawns the entities created by that load and releases their owned resources before returning the original error. Existing unrelated entities remain intact and a later load can retry normally.diff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.tsindex 9b8e9034f..082d640f2 100644--- a/sdk/src/asset/Assets.ts+++ b/sdk/src/asset/Assets.ts@@ -2222,6 +2222,11 @@ export class Assets {dropped = true;}}+ // Skeletal atlas pages register the image path without a flip suffix.+ // End their residency too, even when no SDK texture cache holds them.+ if (typeof rm?.invalidateTexturePath === 'function' && rm.invalidateTexturePath(path)) {+ dropped = true;+ }} else {const cache = this.genericCache_.get(type);if (cache) {diff --git a/sdk/tests/texture-residency.test.ts b/sdk/tests/texture-residency.test.tsindex a8912d5d9..46044a743 100644--- a/sdk/tests/texture-residency.test.ts+++ b/sdk/tests/texture-residency.test.ts@@ -218,6 +218,30 @@ describe('texture residency (Assets ↔ pool contract)', () => {expect(pool.registerTextureWithPath).toHaveBeenCalledWith(raw.handle, 'tex/a.png:n');});+ it('invalidates a released skeletal atlas page outside the SDK texture cache', () => {+ const assets = buildAssets();+ const atlas = pool.createTexture();+ pool.registerTextureWithPath(atlas, 'tex/atlas.png');+ pool.releaseTexture(atlas);++ expect(assets.invalidate('tex/atlas.png')).toBe(true);+ expect(pool.isResident(atlas)).toBe(false);+ expect(pool.acquireTextureByPath('tex/atlas.png')).toBe(0);+ expect(assets.invalidate('tex/atlas.png')).toBe(false);+ });++ it('keeps held atlas pages alive while severing their stale residency identity', () => {+ const assets = buildAssets();+ const atlas = pool.createTexture();+ pool.registerTextureWithPath(atlas, 'tex/atlas.png');++ expect(assets.invalidate('tex/atlas.png')).toBe(true);+ expect(pool.entryOf(atlas)).toMatchObject({ refCount: 1, path: null });+ expect(pool.acquireTextureByPath('tex/atlas.png')).toBe(0);+ pool.releaseTexture(atlas);+ expect(pool.isResident(atlas)).toBe(false);+ });+it('with the budget off, release frees outright and the next load re-decodes', async () => {pool.budget = 0;const assets = buildAssets();diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex a4d891704..a5af6d34f 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'fix(asset): invalidate resident skeletal atlas images':+ { note: 'Skeletal atlas edits invalidate resident textures.' },'fix(dragonbones): release atlas pages with their skeleton owners':{ note: 'DragonBones atlas textures follow skeleton ownership.' },'fix(scene): roll back entities after publication failures':