Support custom submenus for editor script commands
- Dominant language
- C++
- Stars
- 6.3k
- Forks
- 455
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 129
Description
_Is it a private platform specific feature? (i.e. would it break your NDA?)
Then please add your feature request in the corresponding extension repository!_
No. This is not a private platform-specific feature and does not involve any NDA.
**Is your feature request related to a problem? Please describe (REQUIRED):**
Yes.
Editor scripts can add commands to existing menu locations such as Project, Assets, Edit, View, and so on. This works well when there are only one or two commands, but it becomes harder to organize when a framework or toolset needs to expose several related actions.
For context, I’m currently working on Kagetsu, a visual novel / galgame framework for Defold.
The framework uses .kage text scripts for scenarios, plus asset registries for characters, backgrounds, audio, and other resources. To make the workflow smoother, I’d like to provide several editor commands such as:
New Script
New Chapter
Validate Scenario Scripts
Build Asset Registries
Create Character Definition
Run Framework Checks
Currently, the practical workaround is to prefix all commands, for example:
Kagetsu: New Script
Kagetsu: New Chapter
This works, but as the number of commands grows, the menu starts to feel cluttered. The same issue also appears in context menus.
**Describe the solution you'd like (REQUIRED):**
I’d like editor scripts to support custom nested menu paths or submenus.
For example, instead of showing all commands as flat menu items, it would be useful to organize them like this:
Project → Kagetsu → New Script
Project → Kagetsu → New Chapter
Project → Kagetsu → Validate Scripts
Project → Kagetsu → Build Asset Registries
Assets → Kagetsu → Create Character Definition
Assets → Kagetsu → Add To Registry
I’m not tied to a specific API shape, but something like this would feel natural:
```lua
function M.get_commands()
return {
{
label = "New Script",
locations = {
{ "Project", "Kagetsu" }
},
run = function()
-- create script file
end
},
{
label = "New Chapter",
locations = {
{ "Project", "Kagetsu" }
},
run = function()
-- create chapter file
end
}
}
end
```
Or alternatively:
```lua
{
label = "New Script",
location = "Project",
menu_path = { "Kagetsu" },
run = function()
end
}
```
This would make editor-script-based tools and frameworks much cleaner to use, especially for larger extensions that provide multiple related commands.
**Describe alternatives you've considered (REQUIRED):**
The main workaround is to prefix every command name with the framework name, for example:
- Kagetsu: New Script
- Kagetsu: New Chapter
- Kagetsu: Validate Scripts
This is usable, but it still puts all commands directly into the parent menu and does not scale very well.
Another option is to put everything into a single command that opens a custom dialog. This avoids cluttering the menu, but it makes frequently used actions less direct and less discoverable.
**Additional context (OPTIONAL):**
Current Project menu example:
Current context menu example:
I noticed #12544 about scene view extensibility. This request feels related to editor extensibility in general, but it is specifically about organizing editor script commands into custom menu/submenu paths. It is not about gizmos or scene view tools.
Possible use cases:
- framework-specific tooling
- asset registry generators
- localization tools
- visual novel / dialogue tools
- custom validation tools
- project setup helpers
- build and export tools
If this feature sounds reasonable, I’d be happy to help test it or try working on a PR once the preferred API shape is clear.
Thanks for considering it.
Contributor guide
Research direction
No implementation files or tests are identified in the issue. Start by tracing how editor scripts currently register commands for Project, Assets, and context menus, then determine an API for nested menu paths; done means related commands can appear under custom submenus without relying on name prefixes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100