From 0ae216774bac002295864104b79860a8e4c76953 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Wed, 15 May 2024 12:50:34 +0100 Subject: [PATCH] Fix: assets not being deleted correctly --- src/core/Asset.ts | 2 ++ src/core/AssetPack.ts | 2 +- src/core/AssetWatcher.ts | 2 ++ src/manifest/pixiManifest.ts | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/Asset.ts b/src/core/Asset.ts index 77e9f43..1ea3fb1 100644 --- a/src/core/Asset.ts +++ b/src/core/Asset.ts @@ -76,6 +76,8 @@ export class Asset this.children.splice(index, 1); asset.parent = null; } + + asset.releaseChildrenBuffers(); } addTransformChild(asset: Asset) diff --git a/src/core/AssetPack.ts b/src/core/AssetPack.ts index 89a5488..286fa13 100644 --- a/src/core/AssetPack.ts +++ b/src/core/AssetPack.ts @@ -218,7 +218,7 @@ export class AssetPack } } -async function deleteAsset(asset: Asset) +export async function deleteAsset(asset: Asset) { asset.transformChildren.forEach((child) => { diff --git a/src/core/AssetWatcher.ts b/src/core/AssetWatcher.ts index 551b427..0df3a8e 100644 --- a/src/core/AssetWatcher.ts +++ b/src/core/AssetWatcher.ts @@ -2,6 +2,7 @@ import chokidar from 'chokidar'; import fs from 'fs-extra'; import { Asset } from './Asset.js'; import { AssetIgnore } from './AssetIgnore.js'; +import { deleteAsset } from './AssetPack.js'; import { Logger } from './logger/Logger.js'; import { applySettingToAsset } from './utils/applySettingToAsset.js'; import { path } from './utils/path.js'; @@ -222,6 +223,7 @@ export class AssetWatcher else if (asset.state === 'normal') { asset.state = 'modified'; + deleteAsset(asset); } // flag all folders as modified.. diff --git a/src/manifest/pixiManifest.ts b/src/manifest/pixiManifest.ts index 9f3437a..9fc4f2e 100644 --- a/src/manifest/pixiManifest.ts +++ b/src/manifest/pixiManifest.ts @@ -102,6 +102,8 @@ function collectAssets( ) { if (asset.skip) return; + // an item may have been deleted, so we don't want to add it to the manifest! + if (asset.state === 'deleted') return; let localBundle = bundle;