mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 00:12:09 +00:00
Catch plugin actions loaded during startup
This commit is contained in:
@@ -3172,6 +3172,17 @@ bool GUI_App::on_init_inner()
|
||||
refresh_plugins_dialog();
|
||||
});
|
||||
|
||||
// Register all AppAction sources
|
||||
m_action_registry.add_source(std::make_unique<ScriptActionSource>());
|
||||
// m_action_registry.add_source(std::make_unique<AnotherActionSource>());
|
||||
// m_action_registry.add_source(std::make_unique<YetAnotherActionSource>());
|
||||
// ...
|
||||
|
||||
// Initialize with all added sources
|
||||
// - register callbacks,
|
||||
// - then enumerate: upsert all actions into registry
|
||||
m_action_registry.init();
|
||||
|
||||
for (const std::string& plugin_key : plugin_mgr.get_catalog().get_enabled_plugin_keys()) {
|
||||
if (!plugin_mgr.get_loader().is_plugin_loaded(plugin_key)) {
|
||||
plugin_mgr.get_loader().load_plugin(plugin_mgr.get_catalog(), plugin_key, false);
|
||||
@@ -3179,9 +3190,6 @@ bool GUI_App::on_init_inner()
|
||||
}
|
||||
}
|
||||
|
||||
m_action_registry.add_source(std::make_unique<ScriptActionSource>());
|
||||
m_action_registry.init();
|
||||
|
||||
if (m_agent)
|
||||
plugin_mgr.set_cloud_agent(std::dynamic_pointer_cast<OrcaCloudServiceAgent>(m_agent->get_cloud_agent()));
|
||||
|
||||
|
||||
@@ -91,15 +91,7 @@ void ScriptActionSource::start(ActionRegistry& sink)
|
||||
refresh_capability(capability, ActionChange::Removed);
|
||||
});
|
||||
|
||||
enumerate();
|
||||
}
|
||||
|
||||
void ScriptActionSource::enumerate()
|
||||
{
|
||||
assert(wxThread::IsMain());
|
||||
assert(m_sink != nullptr);
|
||||
|
||||
PluginLoader& loader = PluginManager::instance().get_loader();
|
||||
// enumerate
|
||||
std::unordered_map<std::string, std::string> source_names;
|
||||
for (const PluginDescriptor& desc : loader.get_all_loaded_plugin_descriptors())
|
||||
if (!desc.name.empty())
|
||||
|
||||
@@ -26,7 +26,6 @@ public:
|
||||
void start(ActionRegistry& sink) override;
|
||||
|
||||
private:
|
||||
void enumerate();
|
||||
void refresh_source(const std::string& plugin_key, ActionChange change);
|
||||
void refresh_capability(const std::string& plugin_key, const std::string& capability, ActionChange change);
|
||||
std::shared_ptr<AppAction> make_action(const std::string& plugin_key, const std::string& capability,
|
||||
|
||||
Reference in New Issue
Block a user