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(assets): the create door can name a material graph

yhha16344639b8e
diff --git a/desktop/tests/asset-meta-table.test.ts b/desktop/tests/asset-meta-table.test.ts
index 02de216d0..5ea9ae28a 100644
--- a/desktop/tests/asset-meta-table.test.ts
+++ b/desktop/tests/asset-meta-table.test.ts
@@ -30,6 +30,15 @@ describe('.meta type table (single source)', () => {
expect(metaTypeFor('x.inputmap')).toBe('inputmap');
});
+ // The graph is editor-side source that never ships — but an extension only
+ // the Content Browser knew about is one create_asset cannot name and the
+ // scan cannot adopt, so it belongs on the shared table like every other.
+ it('types a material graph (regression: only the renderer knew the extension)', () => {
+ expect(metaTypeFor('fire.esmatgraph')).toBe('materialgraph');
+ expect(metaTypeFor('fire.esshader')).toBe('shader');
+ expect(metaTypeFor('fire.esmaterial')).toBe('material');
+ });
+
it('mints a type for an imported .esanimator (regression: was unknown → no meta)', () => {
expect(metaTypeFor('player.esanimator')).toBe('animatorcontroller');
});
diff --git a/tools/assetMetaTable.js b/tools/assetMetaTable.js
index 29d29c0aa..312592b32 100644
--- a/tools/assetMetaTable.js
+++ b/tools/assetMetaTable.js
@@ -54,6 +54,13 @@ export const EXT_TO_TYPE = Object.freeze({
'.esshader': 'shader',
'.esmaterial': 'material',
'.esmat': 'material',
+ // The visual material graph. It never ships (it compiles to the sibling
+ // `.esshader` that materials actually reference), but it has to be TYPED
+ // here all the same: without an entry the create door cannot name it
+ // (`create_asset` derives its extension from this table, so a graph could
+ // only be made by the Content Browser's own button) and a graph written by
+ // any other hand is never adopted by the scan, which types orphans by name.
+ '.esmatgraph': 'materialgraph',
'.esanim': 'animclip',
'.esanimclip': 'animclip',
'.estimeline': 'animation',