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

Add EditorContextMenuPluginManager and refactor menu plugins #96539

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Sep 3, 2024

Follow-up to #94582
It mostly refactors the code and improves the API a bit. Also filled/improved the documentation.

  • added EditorContextMenuPluginManager class
  • all context menu code was moved from EditorData to the NewClass
  • replaced the 4 item callbacks with single one that takes Variant
  • custom menu item IDs are now assigned when menu is created
  • custom shortcuts call the callback directly instead of going instead of going roundabout way via IDs
  • custom shortcuts now properly accept events and callbacks report errors
  • duplicated slot enums are unified into single one in EditorContextMenuPlugin class

API changes (breaking!):

  • added new add_context_menu_item_from_shortcut() method that reuses a previously added shortcut, so you don't need to repeat the callback
  • remove_context_menu_plugin() no longer takes slot argument, only plugin
  • CONTEXT_SLOT_SUBMENU_FILESYSTEM_CREATE renamed to CONTEXT_SLOT_FILESYSTEM_CREATE
  • add_context_menu_plugin() uses the enum from EditorContextMenuPlugin

CC @citizenll

@KoBeWi KoBeWi added this to the 4.4 milestone Sep 3, 2024
@KoBeWi KoBeWi requested review from a team as code owners September 3, 2024 21:32
@KoBeWi KoBeWi force-pushed the feat_context_menu_plugin4.x_2-electric_boogaloo branch 2 times, most recently from 3a9f62e to 96b7a5a Compare September 3, 2024 21:49
@KoBeWi KoBeWi force-pushed the feat_context_menu_plugin4.x_2-electric_boogaloo branch from 96b7a5a to ecc0ab8 Compare September 3, 2024 21:59
@akien-mga akien-mga merged commit a4e77d9 into godotengine:master Sep 11, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the feat_context_menu_plugin4.x_2-electric_boogaloo branch September 11, 2024 11:06
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