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
feat(assets): a texture's importer carries a Mip Maps switch that the loader and the cook honour
yhhe84bdcb01267
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8d7f2c3f0..3289b2355 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,7 +16,7 @@ published separately; it ships inside the editor.### Changed-- **Textures are set up by purpose.** Pick Pixel art, UI & icons, or Photo & background in a texture's inspector and the filter and compression follow; the preview shows the image, its 9-slice, or its sprite sheet one at a time.+- **Textures can turn mip maps off, and the preview zooms.** A texture's import settings have a Mip Maps switch (on by default; turn it off for pixel art and UI drawn at their own size), honoured in the editor, the cook and the shipped build. The preview scrolls to zoom and drags to pan, and shows the image, its 9-slice or its sprite sheet one at a time.- **Outliner selection is quieter.** A selected row is a soft tint instead of a solid block, and rows selected together join into one rounded block.- **The input map editor captures keys.** Press "Capture" and the next key, mouse button or gamepad press becomes a binding; click a key cap to rebind it, and a key that another action also uses is flagged on the row.- **The interface font is a setting.** Choose Rounded (the default, which prefers HarmonyOS Sans SC or MiSans for Chinese text when installed), Sans, Serif, or the name of any font installed on the computer, under Settings › Editor › General › Appearance.diff --git a/desktop b/desktopindex d175bec84..a7cd9f1d2 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit d175bec8413b5a97f0f87a515710e049a116690d+Subproject commit a7cd9f1d2fbfcfedb1dce558577afc733b38d0ecdiff --git a/pipeline/src/assets/textureCook.ts b/pipeline/src/assets/textureCook.tsindex bc769d930..6c584d466 100644--- a/pipeline/src/assets/textureCook.ts+++ b/pipeline/src/assets/textureCook.ts@@ -175,20 +175,21 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookOconst enc = textureEnc!;const mode = cook.selected;const source = data;- const coverage = mode === 'uastc' ? tex.mipCoverage : 0;+ const coverage = mode === 'uastc' && tex.mipmaps ? tex.mipCoverage : 0;+ const mips = tex.mipmaps ? {} : { mipmaps: false };// UASTC levels ship under zstd — the bytes a project's textures cost to move and to store.// ETC1S already carries its own supercompression. Part of the key, so an entry cooked// before this existed is re-encoded rather than reused.const supercompress = mode === 'uastc';const key = [source, JSON.stringify({ mode, srgb: tex.srgb, maxSize: tex.maxSize, scaled: scaled ? [size!.width, size!.height] : null,- ...(coverage ? { mipCoverage: coverage } : {}), ...(supercompress ? { supercompress } : {}) }), input.encoder!.id];+ ...(coverage ? { mipCoverage: coverage } : {}), ...(supercompress ? { supercompress } : {}), ...mips }), input.encoder!.id];const produce = (): Promise<Uint8Array> => {const image = scaled ? scaledImage() : null;return coverage? encodeCoverageChain(enc, image ?? decodePngImage(path, source), tex.srgb, coverage): image- ? enc.encodeToKtx2({ type: enc.ImageType.RGBA, data: image.rgba, width: image.width, height: image.height }, { mode, srgb: tex.srgb, supercompress })- : enc.encodeToKtx2({ type: enc.ImageType.PNG, data: source }, { mode, srgb: tex.srgb, supercompress });+ ? enc.encodeToKtx2({ type: enc.ImageType.RGBA, data: image.rgba, width: image.width, height: image.height }, { mode, srgb: tex.srgb, supercompress, ...mips })+ : enc.encodeToKtx2({ type: enc.ImageType.PNG, data: source }, { mode, srgb: tex.srgb, supercompress, ...mips });};const file = cookCacheFile(root, key);const encoded = input.cachedOnly ? await cookCacheHitAt(file) : (await cookCachedAt(file, produce)).bytes;diff --git a/pipeline/src/project/importSettings.ts b/pipeline/src/project/importSettings.tsindex 0b76ee4ca..61a3b797d 100644--- a/pipeline/src/project/importSettings.ts+++ b/pipeline/src/project/importSettings.ts@@ -79,6 +79,12 @@ const TEXTURE: ImporterFieldSpec[] = [tooltip: 'UASTC — high quality, larger. ETC1S — much smaller, lower quality '+ '(good for photographic / low-frequency art). Only used when Compress is on.',},+ {+ key: 'mipmaps', label: 'Mip Maps', type: 'bool', default: true, category: 'Texture',+ tooltip: 'Keep a chain of half-size copies so a texture drawn small samples a filtered image '+ + 'instead of shimmering. Costs a third more memory. Turn off for pixel art and UI that '+ + 'is always drawn at its own size.',+ },{key: 'filterMode', label: 'Filter', type: 'select', default: 'linear', category: 'Texture',selectOptions: ['nearest', 'linear'],@@ -317,7 +323,7 @@ export function textureCompression(stored: unknown): TextureCompression {}export function readTextureCookSettings(importer: Record<string, unknown> | undefined, platform?: string): {- compress: TextureCompression; format: 'uastc' | 'etc1s'; maxSize: number; srgb: boolean; mipCoverage: number;+ compress: TextureCompression; format: 'uastc' | 'etc1s'; maxSize: number; srgb: boolean; mipCoverage: number; mipmaps: boolean;} {const compress = importer?.compress;const mipCoverage = importer?.mipCoverage;@@ -330,6 +336,7 @@ export function readTextureCookSettings(importer: Record<string, unknown> | undemaxSize: typeof maxSize === 'number' && maxSize > 0 ? maxSize : 2048,srgb: typeof srgb === 'boolean' ? srgb : true,mipCoverage: typeof mipCoverage === 'number' && mipCoverage > 0 && mipCoverage < 1 ? mipCoverage : 0,+ mipmaps: importer?.mipmaps !== false,};const overrides = importer?.overrides as Record<string, TexturePlatformOverride> | undefined;const ov = platform ? overrides?.[platform] : undefined;diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 3973c19a1..55966cdf8 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -5635,6 +5635,7 @@ entity: number## ParsedTextureImportSettings — interface @experimental```filter: "linear" | "nearest" | undefined+mipmaps: boolean | undefinedsliceBorder: { left: number; right: number; top: number; bottom: number; } | undefinedsrgb: boolean | undefinedwrap: "repeat" | "clamp" | "mirror" | undefineddiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex 059e3ba88..500a33637 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -5838,6 +5838,7 @@ entity: number## ParsedTextureImportSettings — interface @experimental```filter: "linear" | "nearest" | undefined+mipmaps: boolean | undefinedsliceBorder: { left: number; right: number; top: number; bottom: number; } | undefinedsrgb: boolean | undefinedwrap: "repeat" | "clamp" | "mirror" | undefineddiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 18f893185..1c7b324e2 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -5630,6 +5630,7 @@ entity: number## ParsedTextureImportSettings — interface @experimental```filter: "linear" | "nearest" | undefined+mipmaps: boolean | undefinedsliceBorder: { left: number; right: number; top: number; bottom: number; } | undefinedsrgb: boolean | undefinedwrap: "repeat" | "clamp" | "mirror" | undefineddiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 20af3f57b..6523ca55a 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -5923,6 +5923,7 @@ entity: number## ParsedTextureImportSettings — interface @experimental```filter: "linear" | "nearest" | undefined+mipmaps: boolean | undefinedsliceBorder: { left: number; right: number; top: number; bottom: number; } | undefinedsrgb: boolean | undefinedwrap: "repeat" | "clamp" | "mirror" | undefineddiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex bc5ce6e57..b50af317e 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -5637,6 +5637,7 @@ entity: number## ParsedTextureImportSettings — interface @experimental```filter: "linear" | "nearest" | undefined+mipmaps: boolean | undefinedsliceBorder: { left: number; right: number; top: number; bottom: number; } | undefinedsrgb: boolean | undefinedwrap: "repeat" | "clamp" | "mirror" | undefineddiff --git a/sdk/src/asset/textureImportSettings.ts b/sdk/src/asset/textureImportSettings.tsindex 97682eaad..3411d0c2b 100644--- a/sdk/src/asset/textureImportSettings.ts+++ b/sdk/src/asset/textureImportSettings.ts@@ -16,6 +16,7 @@ export interface ParsedTextureImportSettings {filter?: 'linear' | 'nearest';wrap?: 'repeat' | 'clamp' | 'mirror';srgb?: boolean;+ mipmaps?: boolean;sliceBorder?: { left: number; right: number; top: number; bottom: number };}@@ -44,9 +45,10 @@ export function textureImportSettingsFrom(? importer.wrapMode: undefined;const srgb = typeof importer.sRGB === 'boolean' ? importer.sRGB : undefined;+ const mipmaps = typeof importer.mipmaps === 'boolean' ? importer.mipmaps : undefined;const sliceBorder = readSliceBorder(importer.sliceBorder);- return filter || wrap || srgb !== undefined || sliceBorder- ? { filter, wrap, srgb, sliceBorder }+ return filter || wrap || srgb !== undefined || mipmaps !== undefined || sliceBorder+ ? { filter, wrap, srgb, mipmaps, sliceBorder }: undefined;}diff --git a/sdk/tests/texture-import-settings.test.ts b/sdk/tests/texture-import-settings.test.tsindex 4110b590a..3654bc043 100644--- a/sdk/tests/texture-import-settings.test.ts+++ b/sdk/tests/texture-import-settings.test.ts@@ -106,4 +106,10 @@ describe('indexTextureImportSettings', () => {expect(empty('x')).toBeUndefined();expect(empty('a.png')).toBeUndefined();});++ it('reads whether a texture generates mip maps, and says nothing when the block does not', () => {+ expect(textureImportSettingsFrom({ mipmaps: false })?.mipmaps).toBe(false);+ expect(textureImportSettingsFrom({ mipmaps: true })?.mipmaps).toBe(true);+ expect(textureImportSettingsFrom({ filterMode: 'nearest' })?.mipmaps).toBeUndefined();+ });});diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex e59d82edd..8da86179c 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -41,7 +41,9 @@ export const NOTED = {'feat(editor): selected outliner rows are a soft tint, and a run of them reads as one rounded block':{ note: 'Outliner selection is quieter.' },'feat(editor): a texture is set up by what it is for, and its preview shows one thing at a time':- { note: 'Textures are set up by purpose.' },+ { internal: 'Reverted before release: purposes were not how Unity or Unreal present a texture.' },+ 'feat(editor): a texture has a Mip Maps switch honoured by the editor, the cook and the build, and a preview that zooms':+ { note: 'Textures can turn mip maps off, and the preview zooms.' },'feat(editor): an asset header names its kind and size, and a segmented switch is used only when its words fit':{ note: "An asset's header names its kind and size." },"feat(editor): asset inspectors take the board's finish — a card preview, ruled key-value rows, tinted actions, a kind icon in the header":