Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to add items to Tool menu #17576

Merged
merged 1 commit into from
Mar 23, 2018
Merged

Allow users to add items to Tool menu #17576

merged 1 commit into from
Mar 23, 2018

Conversation

leopoldek
Copy link
Contributor

Added functions add_tool_menu_item and remove_tool_menu_item which were commented out and added logic to them. Also added logic to add_tool_submenu_item.

This allows users to create plugins that add items or submenus to the tools menu under Projects.

Fixes #9969

@ghost ghost added this to the 3.1 milestone Mar 17, 2018
@@ -2544,6 +2540,27 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}

void EditorNode::_tool_menu_option(int p_idx) {
if (p_idx == 0) {
orphan_resources->show();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fond of hardcoding what tool options do based on magic numbers from their inserting order.

The previous system let the item register itself as TOOLS_ORPHAN_RESOURCES, the new system should stay similar. The menu item should contain the necessary information to match it to its behaviour, not its index.

@akien-mga
Copy link
Member

Thanks for your contribution, it looks great :)

@akien-mga akien-mga merged commit 74382db into godotengine:master Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants