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(editor): pick the startup scene from the Content Browser
yhh8f09dbdee98c
diff --git a/desktop/src/panels/ContentBrowser.tsx b/desktop/src/panels/ContentBrowser.tsxindex f8a8ffd14..17d8b58db 100644--- a/desktop/src/panels/ContentBrowser.tsx+++ b/desktop/src/panels/ContentBrowser.tsx@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { Fragment, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';-import { ChevronRight, LayoutGrid, List, Import, FolderOpen, FolderPlus, ArrowLeft, ArrowRight, ArrowUp, ArrowDownUp } from 'lucide-react';+import { ChevronRight, LayoutGrid, List, Import, FolderOpen, FolderPlus, ArrowLeft, ArrowRight, ArrowUp, ArrowDownUp, Play } from 'lucide-react';import { AssetIcon, assetTint } from '@/components/icons';import { ConfirmDialog } from '@/components/ConfirmDialog';import { SearchField } from '@/components/SearchField';@@ -855,6 +855,11 @@ export function ContentBrowser() {...(entry.isDir || isScene || isMaterial? [{ label: 'Open', onClick: () => onOpen(path, entry.isDir, entry.name) }]: []),+ // The startup scene: what the editor opens, Play boots, and exports ship+ // first. One per project — the current one offers no redundant action.+ ...(isScene && path !== project?.defaultScene+ ? [{ label: 'Set as Startup Scene', onClick: () => void ProjectStore.setDefaultScene(path) }]+ : []),...(isTexture? [{ label: 'Create Tileset', onClick: () => void createTilesetFromTexture(path) }]: []),@@ -1036,6 +1041,11 @@ export function ContentBrowser() {<AssetIcon type={type} size={30} />)}{!it.isDir && TYPE_CODE[type] && <span className="badge">{TYPE_CODE[type]}</span>}+ {path === project?.defaultScene && (+ <span className="badge start" title="Startup scene">+ <Play size={9} strokeWidth={2.5} />+ </span>+ )}</div><divclassName="nm"@@ -1099,6 +1109,9 @@ export function ContentBrowser() {) : (<span className="t">{it.name}</span>)}+ {path === project?.defaultScene && (+ <Play className="start-mark" size={11} strokeWidth={2.5} aria-label="Startup scene" />+ )}</span><span className="c">{it.isDir ? '' : TYPE_CODE[type] || type}</span></div>diff --git a/desktop/src/project/ProjectStore.ts b/desktop/src/project/ProjectStore.tsindex 069f93921..0b34dbe18 100644--- a/desktop/src/project/ProjectStore.ts+++ b/desktop/src/project/ProjectStore.ts@@ -912,6 +912,27 @@ class ProjectStoreImpl {}}+ /**+ * Set the project's startup scene (`defaultScene`) and persist to+ * `project.esproject` — the scene the editor opens, Play boots, and every+ * export ships as the first scene. Rewrites the RAW manifest JSON so fields+ * the editor parser doesn't model survive; in-memory state updates first.+ */+ async setDefaultScene(path: string): Promise<void> {+ const st = this.state;+ if (!st || st.defaultScene === path) return;+ this.store.setState({ project: { ...st, defaultScene: path } });+ try {+ const raw = JSON.parse(await window.estella.fs.read(PROJECT_MANIFEST_FILE)) as Record<string, unknown>;+ raw.defaultScene = path;+ await window.estella.fs.write(PROJECT_MANIFEST_FILE, JSON.stringify(raw, null, 2) + '\n');+ Toasts.push(`Startup scene: ${path.split('/').pop()}`, 'info');+ } catch (e) {+ Toasts.push('Failed to save startup scene', 'error');+ console.error('[project] setDefaultScene write failed', e);+ }+ }+/** Display info for an asset ref (`@uuid:` or a project-relative path — the same* forms the loaders accept), or null (none / unresolved). For the inspector's* asset control: the project-relative path + a leaf name. */diff --git a/desktop/src/theme/content.css b/desktop/src/theme/content.cssindex d374d422e..c08d5b4f4 100644--- a/desktop/src/theme/content.css+++ b/desktop/src/theme/content.css@@ -83,6 +83,9 @@.asset .th { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r-md) var(--r-md) 0 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.85); overflow: hidden; background: var(--srf-4); }.asset .th img { width: 100%; height: 100%; object-fit: cover; }.asset .th .badge { position: absolute; top: 5px; left: 5px; font-size: var(--fs-3xs); font-weight: 700; letter-spacing: 0.4px; padding: 1px 4px; border-radius: var(--r-xs); background: rgba(0, 0, 0, 0.5); color: var(--on-accent); font-family: var(--mono); }+/* Startup-scene marker — the scene the editor opens, Play boots, exports ship first. */+.asset .th .badge.start { left: auto; right: 5px; display: grid; place-items: center; padding: 2px 3px; background: var(--star); }+.lr .start-mark { flex: none; color: var(--star-hi); }.asset .nm { display: flex; align-items: center; gap: 4px; padding: 6px 7px; font-size: var(--fs-xs); color: var(--text); background: var(--srf-3); border-radius: 0 0 var(--r-md) var(--r-md); border-top: 2px solid var(--tc, var(--text-mute)); }.asset .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.folder .th { background: none; color: var(--cat-collision); }