Asset browser: implement cascaded context menu for asset creation
Goal
Convert the flat context menu for creating new assets into a cascaded/hierarchical menu, organizing asset types into categories (e.g., Textures > 2D > PNG, Models > Mesh > FBX, Scripts > C# Class). Implement a runtime path-based system where asset definitions can declare their menu path as a string (e.g., "mygame/powers/freeze") that is evaluated at runtime to build the hierarchy. Adapt all builtin asset types to use this API.
Context / integration points
- Currently: right-click → flat list of 20+ asset types (hard to scan).
- Unity's approach: cascaded menus with path-based organization.
- No Zig attributes; must use a registration system (e.g., a registry function or manifest).
- Builtin assets are defined in
studio/AssetFactory.zigor similar; must be refactored. - Plugins can contribute asset types via #4 (closed) (editor extensions).
Design
- Define an
AssetTypestruct with fields:name,menu_path: "category/subcategory/name",create_fn, etc. - Build a hierarchical menu tree at runtime by parsing menu_path strings and grouping types.
- Render cascaded menus in DVUI on right-click in asset browser.
- Each asset type registers itself in a registry (procedural, no macros needed).
Tasks
- Design the asset type registration API (menu_path evaluation)
- Implement the menu tree builder (parse paths, group by hierarchy)
- Implement cascaded menu rendering in DVUI
- Refactor all builtin asset types to use the new API (Texture, Model, Script, Material, etc.)
- Test with deeply nested paths (3+ levels)
- Document asset type registration for plugins (#4 (closed))
Acceptance criteria
- Builtin asset types appear in cascaded menus organized by path.
- Right-click "Create New" → cascaded menus appear.
- Selecting a type from a submenu creates that asset.
- Menu paths can be arbitrarily nested (e.g.,
Game/Powers/Freeze/Variant).
Dependencies
Related to #4 (closed) (editor extensions) — plugins can define asset types with this API. Can ship independently.
Out of scope
- Drag-drop asset creation.
- Asset templates or wizards (future enhancement).