Allow Plugins to Register Actions in Application Menu#3021
Draft
Allow Plugins to Register Actions in Application Menu#3021
Conversation
- Add Plugin.loadMenuActions() to load actions from menu.json - Add Plugin.menuActions property - Add NodePluginManager.getAllMenuActions() to aggregate from all plugins - Add MeshroomApp.pluginMenuActions property (QML-accessible) - Reload menu actions and emit signal on plugin reload - Add Plugins menu in Application.qml populated dynamically - Add tests and sample menu.json for test plugins Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add dynamic entry to general menu for plugins
Add dynamic plugin menu entries to the application menu bar
Feb 28, 2026
Copilot stopped work on behalf of
fabiencastan due to an error
February 28, 2026 07:35
…approach Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot
AI
changed the title
Add dynamic plugin menu entries to the application menu bar
Replace menu.json plugin registration with a Python callable API
Feb 28, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3021 +/- ##
===========================================
+ Coverage 82.35% 82.80% +0.45%
===========================================
Files 69 71 +2
Lines 9367 9522 +155
===========================================
+ Hits 7714 7885 +171
+ Misses 1653 1637 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
menu.jsonfile-based approach for plugin menu registration in favor of a Python API where plugins register callable actions directly. This eliminates the need for any JSON file and enables plugins to attach real Python functions (not just URLs) to menu entries.Description
Plugins now register menu actions programmatically via a
register(plugin)hook or themeshroom.core.registerMenuAction()convenience function. The registered callables are stored with a UUID and invoked through a Qt slot when the user triggers the menu item.Features list
Plugin.addMenuAction(label, function, tooltip)— Meshroom-side API for registering a Python callable as a menu entryNodePluginManager.executeMenuAction(actionId)— resolves and calls a registered action by UUIDmeshroom.core.registerMenuAction()— convenience wrapper using thread-local context, usable at module level during first importregister(plugin)hook — called by Meshroom on every plugin load (bypasses Python module caching), recommended patternMeshroomApp.executePluginMenuAction(actionId)QML slot replaces URL-opening logic in the Plugins menuImplementation remarks
Plugin authoring pattern — define a
register(plugin)function in the package's__init__.py:Meshroom calls
register(plugin)explicitly after each plugin load, so it works correctly even when Python has already cached the module (which would silently skip module-levelregisterMenuAction()calls on subsequent loads). TheregisterMenuAction()convenience path is still supported for first-load scenarios.getAllMenuActions()intentionally excludes the callable from the QML model — onlylabel,tooltip,actionId, andpluginNameare exposed. QML calls back into Python via theexecutePluginMenuActionslot which resolves the callable by UUID.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.