Skip to content

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.

fix: break circular dependency between AssetTypeRegistry and FileInspector

esenginedb67f737ffc0
diff --git a/editor/src/asset/AssetTypeRegistry.ts b/editor/src/asset/AssetTypeRegistry.ts
index eba407d4b..1af5bec34 100644
--- a/editor/src/asset/AssetTypeRegistry.ts
+++ b/editor/src/asset/AssetTypeRegistry.ts
@@ -420,7 +420,7 @@ export function registerBuiltinAssetTypes(): void {
icon: icons.file,
eventCategory: null,
droppable: false,
- inspectorRenderer: (container, path) => renderFileInspector(container, path, 'file'),
+ inspectorRenderer: (container, path) => renderFileInspector(container, path, 'File'),
createMenuEntry: null,
});
}
diff --git a/editor/src/panels/inspector/FileInspector.ts b/editor/src/panels/inspector/FileInspector.ts
index 11abef855..387454903 100644
--- a/editor/src/panels/inspector/FileInspector.ts
+++ b/editor/src/panels/inspector/FileInspector.ts
@@ -3,11 +3,9 @@
* @brief Script, scene, and generic file inspectors
*/
-import type { AssetType } from '../../store/EditorStore';
import { icons } from '../../utils/icons';
import { getEditorInstance } from '../../context/EditorContext';
import { getNativeFS, getFileExtension, formatFileSize, formatDate, escapeHtml, renderError } from './InspectorHelpers';
-import { getAssetTypeDisplayName } from '../../asset/AssetTypeRegistry';
export async function renderScriptInspector(container: HTMLElement, path: string): Promise<void> {
const fs = getNativeFS();
@@ -148,7 +146,7 @@ export async function renderSceneInspector(container: HTMLElement, path: string)
container.appendChild(actionsWrapper);
}
-export async function renderFileInspector(container: HTMLElement, path: string, type: AssetType): Promise<void> {
+export async function renderFileInspector(container: HTMLElement, path: string, displayName: string): Promise<void> {
const fs = getNativeFS();
const stats = fs ? await fs.getFileStats(path) : null;
const ext = getFileExtension(path);
@@ -164,7 +162,7 @@ export async function renderFileInspector(container: HTMLElement, path: string,
<div class="es-component-properties es-collapsible-content">
<div class="es-property-row">
<label class="es-property-label">Type</label>
- <div class="es-property-value">${getAssetTypeDisplayName(type)}${ext ? ` (${ext})` : ''}</div>
+ <div class="es-property-value">${displayName}${ext ? ` (${ext})` : ''}</div>
</div>
<div class="es-property-row">
<label class="es-property-label">File Size</label>