PluginLoader
Inherits: Resource
Manage and load plugins
Description
The PluginLoader is responsible for downloading, loading, and initializing OpenGamepadUI plugins. The plugin system for OpenGamepadUI is inspired by the modding system implemented by Delta-V.
The PluginLoader works by taking advantage of Godot's method ProjectSettings.load_resource_pack method, which can allow us to load Godot scripts and scenes from a zip file. The PluginLoader looks for zip files in user://plugins, and parses the plugin.json file contained within them. If the plugin metadata is valid, the loader loads the zip as a resource pack.
Properties
| Type | Name | Default |
|---|---|---|
| SettingsManager | SettingsManager | |
| PluginManager | parent | |
| CustomLogger | logger | |
| Dictionary | plugins | {} |
| Dictionary | plugin_nodes | {} |
| Dictionary | plugin_store_items | {} |
| Array | plugins_upgradable | [] |
| Callable[] | plugin_filters | [] |
Methods
| Returns | Signature |
|---|---|
| void | init(manager: PluginManager) |
| void | enable_plugin(plugin_id: String) |
| void | disable_plugin(plugin_id: String) |
| Variant | get_plugin_store_items() |
| void | install_plugin(plugin_id: String, download_url: String, sha256: String) |
| int | uninstall_plugin(plugin_id: String) |
| bool | is_extracted(meta: Dictionary) |
| void | extract_plugin(plugin_id: String, path: String) |
| int | unload_plugin(plugin_id: String) |
| int | uninitialize_plugin(plugin_id: String) |
| bool | is_installed(plugin_id: String) |
| bool | is_loaded(plugin_id: String) |
| bool | is_initialized(plugin_id: String) |
| bool | is_upgradable(plugin_id: String) |
| Plugin | get_plugin(plugin_id: String) |
| Dictionary | get_plugin_meta(plugin_id: String) |
| Array | get_loaded_plugins() |
| Array | get_initialized_plugins() |
| bool | set_plugin_upgraded(plugin_id: String) |
| int | initialize_plugin(plugin_id: Variant) |
| void | on_update_timeout() |
| String[] | filter_by_tag(plugins: Dictionary, tag: String) |
| void | set_plugin_filters(filters: Callable[]) |
Property Descriptions
SettingsManager
SettingsManager SettingsManager
Note
There is currently no description for this property. Please help us by contributing one!
parent
PluginManager parent
Note
There is currently no description for this property. Please help us by contributing one!
logger
CustomLogger logger
Note
There is currently no description for this property. Please help us by contributing one!
plugins
Dictionary plugins = {}
Dictionary of installed plugins on the root file system.
plugin_nodes
Dictionary plugin_nodes = {}
Dictionary of instantiated plugins.
plugin_store_items
Dictionary plugin_store_items = {}
Dictionary of available plugins in the defualt plugin store. Similair data struture to the plugins dict with some additonal fields.
plugins_upgradable
Array plugins_upgradable = []
List of plugin_ids that are installed where a newer version of the plugin is available in the plugin store.
plugin_filters
Callable[] plugin_filters = []
Note
There is currently no description for this property. Please help us by contributing one!
Method Descriptions
init()
void init(manager: PluginManager)
Initializes the plugin loader. Loaded plugins will be added to the given manager node.
enable_plugin()
void enable_plugin(plugin_id: String)
Sets the given plugin to enabled
disable_plugin()
void disable_plugin(plugin_id: String)
Sets the given plugin to disabled
get_plugin_store_items()
Variant get_plugin_store_items()
Returns the parsed dictionary of plugin store items. Returns null if there is a failure.
install_plugin()
void install_plugin(plugin_id: String, download_url: String, sha256: String)
Downloads and installs the given plugin
uninstall_plugin()
int uninstall_plugin(plugin_id: String)
Unloads and uninstalls the given plugin. Returns OK if removed successfully.
is_extracted()
bool is_extracted(meta: Dictionary)
Returns whether or not the given plugin is already extracted. This takes the parsed plugin metadata as an argument.
extract_plugin()
void extract_plugin(plugin_id: String, path: String)
Extract the given plugin into the plugins directory
unload_plugin()
int unload_plugin(plugin_id: String)
Unloads the given plugin. Returns OK if successful.
uninitialize_plugin()
int uninitialize_plugin(plugin_id: String)
Uninitializes a plugin and calls its "unload" method
is_installed()
bool is_installed(plugin_id: String)
Returns true if the given plugin is installed.
is_loaded()
bool is_loaded(plugin_id: String)
Returns true if the given plugin is loaded.
is_initialized()
bool is_initialized(plugin_id: String)
Returns true if the given plugin is initialized and running
is_upgradable()
bool is_upgradable(plugin_id: String)
Returns true if the given plugin is upgradable.
get_plugin()
Plugin get_plugin(plugin_id: String)
Returns the given plugin instance
get_plugin_meta()
Dictionary get_plugin_meta(plugin_id: String)
Returns the metadata for the given plugin
get_loaded_plugins()
Array get_loaded_plugins()
Returns a list of plugin_ids that were loaded
get_initialized_plugins()
Array get_initialized_plugins()
Returns a list of plugin_ids that are initialized and running
set_plugin_upgraded()
bool set_plugin_upgraded(plugin_id: String)
Note
There is currently no description for this method. Please help us by contributing one!
initialize_plugin()
int initialize_plugin(plugin_id: Variant)
Instances the given plugin and adds it to the scene tree
on_update_timeout()
void on_update_timeout()
Note
There is currently no description for this method. Please help us by contributing one!
filter_by_tag()
String[] filter_by_tag(plugins: Dictionary, tag: String)
Note
There is currently no description for this method. Please help us by contributing one!
set_plugin_filters()
void set_plugin_filters(filters: Callable[])
Note
There is currently no description for this method. Please help us by contributing one!