Let the scene view hide symbols, names and shapes per asset kind
The scene view gets crowded once a scene holds many behaviors, colliders and tilemaps. A new eye button in the topbar opens a list of all placeable asset kinds, and each row has toggles for what the scene view draws for that kind. - The popup lists all 9 placeable kinds from Behavior to Tilemap, with the columns Symbol, Name and Shape. It stays open while switching. - Sprite, Text and Tilemap draw no symbol, so their symbol toggle is greyed out. Their name toggle shows a new centred name tag, which is off by default. - Shape exists for Collider and Tilemap. A hidden collider outline is neither drawn nor clickable. A hidden tilemap shape removes the collision outlines and the paint tint, the tiles stay visible. - A hidden symbol takes no slot in the ring and draws no dashed link to its parent. A name that stays on moves to the centre of the object. - The setting lives in the project as `sceneVisibility`, not in localStorage. Older projects load with the defaults, which match the view as it was. - Switching has no undo step, like the game scale. It only changes the view. A change made during Play survives Stop. - The rules sit in `src/core/model/sceneVisibility.ts`, the popup in `src/editor/panels/SceneVisibilityPopup.ts`. Four new SVG icons. Not covered by a check: symbol off with name on for a kind with a symbol, Text and Tilemap with names, and the paint tint with shape off. Tests: - ./check.sh: 173 files, 2515 tests, CHECK EXIT 0 - e2e 46: ALL PASSED, 17 checks. 46g clicks the popup, lays a small tilemap over the crate and removes it again. - e2e 8 alone on a fresh seed: ALL PASSED, 23 checks. A red check in the partial run 2,8,46 came from the module selection. - 8 new unit tests in tests/editor/scene-visibility.test.ts. - 4 counter-probes, each fails its test: load ignores the saved value, Play skips the saved model, scene view ignores collider shape, scene view ignores tilemap shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66868de10a
commit
6015869297
19 files changed
+547
-25
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { findAssetOf, findObjectHolder } from '../../core/model/Project';
|
||||
import { resolveObjects } from '../../core/model/instance';
|
||||
import { findLayer, layerZ } from '../../core/model/tilemap';
|
||||
import { currentVisibilityPopup } from '../panels/SceneVisibilityPopup';
|
||||
import { currentTilemapWidgets, paintedLayerId, paintedTilemap } from '../panels/TilemapPanel';
|
||||
import type { TilemapTool } from '../state';
|
||||
import { rectOf } from '../textProbe';
|
||||
@@ -65,6 +66,13 @@ export function sceneHooks({ state, editor }: HookContext) {
|
||||
sceneIcon: (id: string) => viewport.iconInfo(id),
|
||||
/** The names shown beside the symbols, each with the plate under it, in world units and on screen. */
|
||||
sceneLabels: () => viewport.labelInfo(),
|
||||
/** A collider's outline in the Scene tab: hidden by the eye in the top bar, it is neither seen nor hit. */
|
||||
sceneShape: (id: string) => viewport.shapeInfo(id),
|
||||
/** The switches behind the eye while it stands open: per type and part, on, enabled, where to click. */
|
||||
visibilityPopup: () =>
|
||||
currentVisibilityPopup()
|
||||
?.info()
|
||||
.map(({ widget, ...entry }) => ({ ...entry, ...centreOf(widget) })) ?? null,
|
||||
drawOrder: () => viewport.drawOrder(),
|
||||
objectScreen: (id: string) => viewport.objectScreen(id),
|
||||
objectRect: (id: string) => viewport.objectRect(id),
|
||||
|
||||
Reference in new issue
Block a user