Expand description
Asset Browser — folder explorer + grid + per-asset inspection.
Layout:
┌──────────────┬───────────────────────────────────┐
│ Categories │ ← / breadcrumb / search → │
│ (filters) ├───────────────────────────────────┤
├──────────────┤ Tile grid │
│ Folder tree │ │
│ (real VFS) │ │
└──────────────┴───────────────────────────────────┘Single-click on a tile sets EditorState::inspected_asset_path so
the Inspector switches to asset-metadata mode (Phase 5). Double-click
still routes through the handlers::AssetTypeHandler activation
— LoadScene for .kscene, OpenExternal for everything else.
Modules§
- handlers
AssetTypeHandler— extensibility seam for the Asset Browser.
Structs§
- Asset
Browser Panel - Flat
Asset 🔒 - Folder
Node 🔒 - One node of the folder tree built from the flat asset list.
Enums§
- Folder
Action 🔒 - A folder-tree context-menu / drag-drop action, collected during the
(
&self) tree walk and applied afterwards where&mut selfis available.
Constants§
- ASSET_
DRAG_ 🔒TAG - High 32 bits of a
u64drag payload that identifies an asset-browser tile — the low 32 bits hold the asset index inEditorState::asset_entries. Every tile is a drag source; the drop sink (viewport / folder tree) dispatches by the asset’s type, so the tag is type-agnostic. Picked so it can’t collide with theEntityId-packed payload used by the scene-tree reparent flow (entity generations are u32 and start at 1, so any value with0xKHPFin the top half can only mean “asset tile”). - DRAG_
EPOCH_ 🔒BITS - Number of low bits of
EditorState::asset_epochstamped into a drag payload. Eight is plenty: the stamp only has to survive one drag, and the epoch would have to advance 256 times mid-gesture to alias. - DRAG_
INDEX_ 🔒MASK - HEADER_
HEIGHT 🔒 - SIDEBAR_
CATEGORIES 🔒 - SIDEBAR_
ROW_ 🔒H - SIDEBAR_
WIDTH 🔒 - TILE_
GAP 🔒 - TILE_
SIZE 🔒 - TOOLBAR_
HEIGHT 🔒 - TREE_
INDENT 🔒
Functions§
- ensure_
extension 🔒 - Re-applies the original file’s extension to a user-edited name when the
user omitted one (so renaming
crate.pngtoboxyieldsbox.png, butbox.jpgis honoured verbatim). - entity_
display_ 🔒name - Walks a
SceneNodeforest to findentity’s display name. Used by the asset browser’s drop receiver to compose a default.kprefabfilename without a round-trip through the liveWorld. - is_
asset_ 🔒drag - Whether
payloadcarries the asset tag, regardless of how stale it is. - pack_
asset_ 🔒drag - Packs an asset-list index plus a stamp of the epoch it was read at.
- sanitize_
for_ 🔒filename - Strips characters that aren’t safe in cross-platform file names (path separators, shell-meta, control chars). Falls back to an underscore for runs of stripped chars so consecutive replacements don’t collapse into nothing.
- unpack_
asset_ 🔒drag - Unpacks an asset drag payload, rejecting it when the asset list changed since the drag started.