1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-11 20:57:16 +08:00
81 changed files with 3410 additions and 132 deletions

View File

@@ -5,6 +5,7 @@ import type {
Match3DRunSnapshot,
} from '../../../packages/shared/src/contracts/match3dRuntime';
import type { Match3DGeneratedItemAsset } from '../../../packages/shared/src/contracts/match3dWorks';
import { isDebugMode } from '../../config/debugMode';
import { readAssetBytes } from '../../services/assetReadUrlService';
import {
isItemState,
@@ -236,6 +237,23 @@ function resolveGeneratedModelSourceForItemType(
return asset ? normalizeMatch3DGeneratedModelSource(asset) : '';
}
function warnMatch3DGeneratedModelLoadFailure(
itemTypeId: string,
source: string,
error: unknown,
) {
if (!isDebugMode()) {
return;
}
const message =
error instanceof Error ? error.message : String(error || 'unknown error');
console.warn('[match3d] generated model load failed', {
itemTypeId,
source,
message,
});
}
async function loadMatch3DGeneratedModelTemplate(
templateMap: Match3DGeneratedModelTemplateMap,
three: ThreeModule,
@@ -1693,10 +1711,15 @@ export function Match3DTrayPreviewBoard({
runtime.entries.delete(itemInstanceId);
});
})
.catch(() => {
.catch((caughtError) => {
if (abortController.signal.aborted) {
return;
}
warnMatch3DGeneratedModelLoadFailure(
itemTypeId,
source,
caughtError,
);
runtime.generatedModelTemplates.delete(itemTypeId);
});
});
@@ -2168,10 +2191,15 @@ export function Match3DPhysicsBoard({
}
});
})
.catch(() => {
.catch((caughtError) => {
if (abortController.signal.aborted) {
return;
}
warnMatch3DGeneratedModelLoadFailure(
itemTypeId,
source,
caughtError,
);
runtime.generatedModelTemplates.delete(itemTypeId);
});
});