Editor API
UnigineEditor public API
UnigineEditor::PluginManager Class Referencefinal

The UnigineEditor::PluginManager is the main controller class of the Plugin System, it is responsible for:

More...

#include <UniginePluginManager.h>

Inherits QObject.

Signals

void initializationCompleted ()
 This signal is emitted when the PluginManager initialization is completed (i.e. all plugins from the loading queue are loaded and initialized). More...
 
void aboutToBeLoadedPlugin (PluginInfo *plugin_info)
 This signal is emitted right before loading a plugin. More...
 
void loadedPlugin (PluginInfo *plugin_info)
 This signal is emitted when a plugin is successfully loaded. More...
 
void aboutToBeUnloadedPlugin (PluginInfo *plugin_info)
 This signal is emitted right before unloading a plugin. More...
 
void unloadedPlugin (PluginInfo *plugin_info)
 This signal is emitted when a plugin is unloaded. More...
 

Static Public Member Functions

static PluginManagerinstance ()
 Returns the instance of the PluginManager class. This method is used to subscribe to signals. More...
 
static void loadPluginSpecs (const Unigine::Vector< Unigine::String > &search_paths)
 Loads specifications for all plugins found in the specified directories and tries to read all plugins metadata and resolve all dependencies (change the state of all PluginInfo instances from INVALID to RESOLVED). This method builds the list of all available plugins. More...
 
static void loadPlugins ()
 Loads and initializes all available plugins from the list generated by calling the loadPluginSpecs() method (PluginInfo states LOADED and RUNNING). More...
 
static void unloadPlugins ()
 Destroys all currently loaded plugins and unloads dynamic libraries from memory (PluginInfo states STOPPED and UNLOADED). More...
 
static bool loadPlugin (PluginInfo *plugin_info)
 Loads and initializes the plugin. (PluginInfo states LOADED and RUNNING). More...
 
static bool unloadPlugin (PluginInfo *plugin_info)
 Destroys the loaded plugin and unloads its dynamic library from memory. (PluginInfo states STOPPED and UNLOADED). Calling this method also clears both Editor and selection undo stacks (the same happens on clicking Unload in the Editor's Plugins window). More...
 
static Unigine::Vector< PluginInfo * > plugins ()
 Returns information on all plugins currently available as a vector of PluginInfo items containing all necessary information on each plugin. More...
 
static bool hasError ()
 Returns true if at least one error has occurred when loading any of the plugins available. If the result is positive, you can use the allErrors() method to get detailed information on all errors. More...
 
static Unigine::Vector< Unigine::String > allErrors ()
 Returns detailed information on all plugin errors accurred as a vector of strings (one string per error). More...
 
static bool isInitialized ()
 Returns a value indicating if the PluginManager is initialized successfully (i.e. all plugins from the loading queue are loaded and initialized). More...
 

Detailed Description

The UnigineEditor::PluginManager is the main controller class of the Plugin System, it is responsible for:

  • Locating dynamic libraries in folders specified by the user.
  • Plugins initialization their lifecycle management and destruction via the instances of PluginInfo class.
  • Building plugins loading queue, as the order in which the plugins are loaded is important. If a plugin has a required dependency it expects for certain symbols to be loaded.
  • Providing the user with information on plugins. Currently used to build target UI in the Editor.

Member Function Documentation

◆ aboutToBeLoadedPlugin

void UnigineEditor::PluginManager::aboutToBeLoadedPlugin ( PluginInfo plugin_info)
signal

This signal is emitted right before loading a plugin.

◆ aboutToBeUnloadedPlugin

void UnigineEditor::PluginManager::aboutToBeUnloadedPlugin ( PluginInfo plugin_info)
signal

This signal is emitted right before unloading a plugin.

◆ allErrors()

static Unigine::Vector<Unigine::String> UnigineEditor::PluginManager::allErrors ( )
static

Returns detailed information on all plugin errors accurred as a vector of strings (one string per error).

◆ hasError()

static bool UnigineEditor::PluginManager::hasError ( )
static

Returns true if at least one error has occurred when loading any of the plugins available. If the result is positive, you can use the allErrors() method to get detailed information on all errors.

◆ initializationCompleted

void UnigineEditor::PluginManager::initializationCompleted ( )
signal

This signal is emitted when the PluginManager initialization is completed (i.e. all plugins from the loading queue are loaded and initialized).

◆ instance()

static PluginManager* UnigineEditor::PluginManager::instance ( )
static

Returns the instance of the PluginManager class. This method is used to subscribe to signals.

Returns
PluginManager class instance.

Example:

, this, &SomeClass::plugin_manager_initialized);

◆ isInitialized()

static bool UnigineEditor::PluginManager::isInitialized ( )
static

Returns a value indicating if the PluginManager is initialized successfully (i.e. all plugins from the loading queue are loaded and initialized).

Returns
true if the PluginManager was successfully initialized; otherwise, false.

◆ loadedPlugin

void UnigineEditor::PluginManager::loadedPlugin ( PluginInfo plugin_info)
signal

This signal is emitted when a plugin is successfully loaded.

◆ loadPlugin()

static bool UnigineEditor::PluginManager::loadPlugin ( PluginInfo plugin_info)
static

Loads and initializes the plugin. (PluginInfo states LOADED and RUNNING).

◆ loadPlugins()

static void UnigineEditor::PluginManager::loadPlugins ( )
static

Loads and initializes all available plugins from the list generated by calling the loadPluginSpecs() method (PluginInfo states LOADED and RUNNING).

◆ loadPluginSpecs()

static void UnigineEditor::PluginManager::loadPluginSpecs ( const Unigine::Vector< Unigine::String > &  search_paths)
static

Loads specifications for all plugins found in the specified directories and tries to read all plugins metadata and resolve all dependencies (change the state of all PluginInfo instances from INVALID to RESOLVED). This method builds the list of all available plugins.

Parameters
search_pathsList of directories to look for plugin binary files in.

◆ plugins()

static Unigine::Vector<PluginInfo *> UnigineEditor::PluginManager::plugins ( )
static

Returns information on all plugins currently available as a vector of PluginInfo items containing all necessary information on each plugin.

◆ unloadedPlugin

void UnigineEditor::PluginManager::unloadedPlugin ( PluginInfo plugin_info)
signal

This signal is emitted when a plugin is unloaded.

◆ unloadPlugin()

static bool UnigineEditor::PluginManager::unloadPlugin ( PluginInfo plugin_info)
static

Destroys the loaded plugin and unloads its dynamic library from memory. (PluginInfo states STOPPED and UNLOADED). Calling this method also clears both Editor and selection undo stacks (the same happens on clicking Unload in the Editor's Plugins window).

◆ unloadPlugins()

static void UnigineEditor::PluginManager::unloadPlugins ( )
static

Destroys all currently loaded plugins and unloads dynamic libraries from memory (PluginInfo states STOPPED and UNLOADED).