Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Plugins::RadiumPluginInterface Class Referenceabstract

Interface class for Radiums plugins. More...

#include <PluginBase/RadiumPluginInterface.hpp>

+ Collaboration diagram for Ra::Plugins::RadiumPluginInterface:

Public Member Functions

virtual void registerPlugin (const Context &context)=0
 Pass arguments for plugin initialization. This method must create and register all the services that the plugin wants to offer : system, renderers, materials, Ui ...
 
virtual bool doAddWidget (QString &name)=0
 Tells wether the plugin wants to add a widget (inside the UI tab widget) or not. If it does, it must provide a name for it, and getWidget() will be called.
 
virtual QWidget * getWidget ()=0
 Creates the widget to be added to the ui and then returns it. If connections are needed (between plugin ui and plugin internals) they have to be created here.
 
virtual bool doAddMenu ()=0
 Tells wether the plugin wants to add a menu or not. If it does, getMenu() will be called.
 
virtual QMenu * getMenu ()=0
 Creates to menu to be added to the ui and then returns it.
 
virtual bool doAddAction (int &nb)=0
 Tells wether the plugin wants to add actions or not. If it does, getAction() will be called for each one of them.
 
virtual QAction * getAction (int id)=0
 Returns the action to be added to the ui and then returns it.
 
virtual bool doAddRenderer ()
 
virtual void addRenderers (std::vector< std::shared_ptr< Ra::Engine::Rendering::Renderer > > *rds)
 addRenderers
 
virtual bool doAddFileLoader ()
 
virtual void addFileLoaders (std::vector< std::shared_ptr< Core::Asset::FileLoaderInterface > > *fl)
 
virtual void openGlInitialize (const Context &context)
 openGlInitialize
 
virtual bool doAddROpenGLInitializer ()
 

Detailed Description

Interface class for Radiums plugins.

To write your own plugin, you need to write a class as follow:

class MyPlugin : public QObject, Ra::Plugins::RadiumPluginInterface
{
Q_OBJECT
Q_RADIUM_PLUGIN_METADATA
public:
MyPlugin();
~MyPlugin() override;
virtual void registerPlugin( const Ra::Plugins::Context& context ) override;
virtual bool doAddWidget( QString& name ) override;
virtual QWidget* getWidget() override;
virtual bool doAddMenu() override;
virtual QMenu* getMenu() override;
virtual bool doAddAction( int &nb ) override;
virtual QAction* getAction( int id ) override;
};
Data passed to the plugin constructor.
Interface class for Radiums plugins.
virtual void registerPlugin(const Context &context)=0
Pass arguments for plugin initialization. This method must create and register all the services that ...
virtual QAction * getAction(int id)=0
Returns the action to be added to the ui and then returns it.
virtual QMenu * getMenu()=0
Creates to menu to be added to the ui and then returns it.
virtual QWidget * getWidget()=0
Creates the widget to be added to the ui and then returns it. If connections are needed (between plug...
virtual bool doAddWidget(QString &name)=0
Tells wether the plugin wants to add a widget (inside the UI tab widget) or not. If it does,...
virtual bool doAddMenu()=0
Tells wether the plugin wants to add a menu or not. If it does, getMenu() will be called.
virtual bool doAddAction(int &nb)=0
Tells wether the plugin wants to add actions or not. If it does, getAction() will be called for each ...
Note
Q_RADIUM_PLUGIN_METADATA: we use this macro to load a default metadata files, which sets the basic metadata required by Radium. The macro is defined in RaPluginBase.hpp. If you need to use your own file, you have to extend the filespluginMetaDataXXXX.json, packaged with Radium in the following folder
  • source tree: src/PluginBase/
  • install tree: lib/cmake/Radium/ Then, replace Q_RADIUM_PLUGIN_METADATA by Q_PLUGIN_METADATA( IID "RadiumEngine.PluginInterface" FILE "yourPluginMetaDataRelease.json" ) or Q_PLUGIN_METADATA( IID "RadiumEngine.PluginInterface" FILE "yourPluginMetaDataDebug.json" ) depending on the debug mode

Definition at line 72 of file RadiumPluginInterface.hpp.

Constructor & Destructor Documentation

◆ ~RadiumPluginInterface()

virtual Ra::Plugins::RadiumPluginInterface::~RadiumPluginInterface ( )
inlinevirtual

Definition at line 76 of file RadiumPluginInterface.hpp.

Member Function Documentation

◆ addFileLoaders()

virtual void Ra::Plugins::RadiumPluginInterface::addFileLoaders ( std::vector< std::shared_ptr< Core::Asset::FileLoaderInterface > > * fl)
inlinevirtual

Add the file loader services offered by the plugin

Parameters
flThe set of file loader to add

Definition at line 161 of file RadiumPluginInterface.hpp.

◆ addRenderers()

virtual void Ra::Plugins::RadiumPluginInterface::addRenderers ( std::vector< std::shared_ptr< Ra::Engine::Rendering::Renderer > > * rds)
inlinevirtual

addRenderers

Parameters
rdsthe renderers that the plugin wants to expose to the application.
Warning
Allocated renderers are given to the application that takes ownership. They MUST not be destroyed by the plugin

Definition at line 148 of file RadiumPluginInterface.hpp.

◆ doAddAction()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddAction ( int & nb)
pure virtual

Tells wether the plugin wants to add actions or not. If it does, getAction() will be called for each one of them.

Parameters
nbthe number of action the plugin wants to add.
Returns
True if the plugin wants to add a menu, false otherwise

◆ doAddFileLoader()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddFileLoader ( )
inlinevirtual

Tells if the system will add a file loader

Returns
true if a file loader service is offered

Definition at line 155 of file RadiumPluginInterface.hpp.

◆ doAddMenu()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddMenu ( )
pure virtual

Tells wether the plugin wants to add a menu or not. If it does, getMenu() will be called.

Returns
True if the plugin wants to add a menu, false otherwise

◆ doAddRenderer()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddRenderer ( )
inlinevirtual

Tells if the plugin will add a renderer

Returns
true if the plugin offer rendering service

Definition at line 139 of file RadiumPluginInterface.hpp.

◆ doAddROpenGLInitializer()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddROpenGLInitializer ( )
inlinevirtual

Tells if the plugin offer OpenGL based services that need to be initialized after the OpenGL context is created.

Returns
true if plugin offers OppenGL services

Definition at line 191 of file RadiumPluginInterface.hpp.

◆ doAddWidget()

virtual bool Ra::Plugins::RadiumPluginInterface::doAddWidget ( QString & name)
pure virtual

Tells wether the plugin wants to add a widget (inside the UI tab widget) or not. If it does, it must provide a name for it, and getWidget() will be called.

Parameters
nameName of the tab to be added, if needed.
Returns
True if the plugin wants to add a widget, false otherwise

◆ getAction()

virtual QAction * Ra::Plugins::RadiumPluginInterface::getAction ( int id)
pure virtual

Returns the action to be added to the ui and then returns it.

Returns
The action to add.
Warning
This mechanism implies QAction copies and does not allow to control the appearance of multiple actions with interlocked behaviors, e.g. play/pause and stop buttons.

◆ getMenu()

virtual QMenu * Ra::Plugins::RadiumPluginInterface::getMenu ( )
pure virtual

Creates to menu to be added to the ui and then returns it.

Returns
The created menu
Todo
Find a better name ?

◆ getWidget()

virtual QWidget * Ra::Plugins::RadiumPluginInterface::getWidget ( )
pure virtual

Creates the widget to be added to the ui and then returns it. If connections are needed (between plugin ui and plugin internals) they have to be created here.

Returns
The created and configured widget
Todo
Find a better name for this ?

◆ openGlInitialize()

virtual void Ra::Plugins::RadiumPluginInterface::openGlInitialize ( const Context & context)
inlinevirtual

openGlInitialize

Parameters
context(const PluginContext& context) the Plugin context
See also
https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/ for the reason a const QOpenGLContext * is given
Warning
Allocated renderers are given to the application and MUST not be destroyed by the plugin
Note
Plugins that want to manage OpenGL resources MUST ENSURE at the time they create/access these resources that the current openGLContext is the one pass when initializing OpenGL here and stored in the PluginContext ...
When this function is called from the application, The active OpenGL Context is the one that will be used for rendering.

Developers of plugins that need to manage OpenGL resources in a direct way (recommended for plugins that manage OpenGL resources for rendering or interaction with rendering) must implement this method and memorize the viewer of the PluginContext. Each time they need to create or destroy an OpenGL resource, they must activate this context (viewer->makeCurrent()) and realease it after usage (viewer->doneCurrent())

See also
Ra::Gui::Viewer

Definition at line 184 of file RadiumPluginInterface.hpp.

◆ registerPlugin()

virtual void Ra::Plugins::RadiumPluginInterface::registerPlugin ( const Context & context)
pure virtual

Pass arguments for plugin initialization. This method must create and register all the services that the plugin wants to offer : system, renderers, materials, Ui ...

Parameters
context: plugin context containing the engine and UI interfaces.

The documentation for this class was generated from the following file: