diff --git a/BasePlugin/TextureInterface.hh b/BasePlugin/TextureInterface.hh index 452419aefc388b547476dadc580dfc6b390241f9..d0c03b24a5ef7537610d3a06357bb0bf37ec2752 100644 --- a/BasePlugin/TextureInterface.hh +++ b/BasePlugin/TextureInterface.hh @@ -185,6 +185,36 @@ class TextureInterface { */ virtual void textureChangeImage( QString /*_textureName*/ , QImage& /*_image*/ ) {}; + /** \brief get the texture image of a given texture + * + * @param _textureName The name of the texture which should be addressed + * @param _image reference to the image for the texture + * @param _id Id of the object where the texture should be fetched from + */ + virtual void textureGetImage( QString /*_textureName*/ , QImage& /*_image*/ , int /*_id*/ ) {}; + + /** \brief Get the texture image of a given global texture + * + * @param _textureName The name of the texture which should be addressed + * @param _image reference to the image for the texture + */ + virtual void textureGetImage( QString /*_textureName*/ , QImage& /*_image*/ ) {}; + + /** \brief get the name of the texture which is currently enabled + * + * @param _id Id of the object where the current texture should be fetched from + * @param _textureName this returns the name of the texture + */ + virtual void getCurrentTexture( int /*_id*/, QString& /*_textureName*/ ) {}; + + /** \brief get the names of all sub-textures under the given multiTexture + * + * @param _id Id of the object where the current texture should be fetched from + * @param _multiTextureName name of a multi texture + * @param _textureName this returns the names of all sub textures that are combined under the given multi texture + */ + virtual void getSubTextures( int /*_id*/, QString /*_multiTextureName*/, QStringList& /*_subTextures*/ ) {}; + private slots : /** \brief update the texture with the given Name ( if this plugin provides this texture ) for all meshes * @@ -300,6 +330,36 @@ class TextureInterface { * @param _mode New mode flags for the given texture */ virtual void slotSetTextureMode(QString /*_textureName*/ ,QString /*_mode*/) {}; + + /** \brief fetches the texture image of a given texture + * + * @param _textureName The name of the texture which should be addressed + * @param _image reference to the image for the texture + * @param _id Id of the object where the texture should be fetched from + */ + virtual void slotTextureGetImage( QString /*_textureName*/ , QImage& /*_image*/ , int /*_id*/ ) {}; + + /** \brief fetches the texture image of a given global texture + * + * @param _textureName The name of the texture which should be addressed + * @param _image reference to the image for the texture + */ + virtual void slotTextureGetImage( QString /*_textureName*/ , QImage& /*_image*/ ) {}; + + /** \brief fetches the name of the texture which is currently enabled + * + * @param _id Id of the object where the current texture should be fetched from + * @param _textureName this returns the name of the texture + */ + virtual void slotGetCurrentTexture( int /*_id*/, QString& /*_textureName*/ ) {}; + + /** \brief fetches the names of all sub-textures under the given multiTexture + * + * @param _id Id of the object where the current texture should be fetched from + * @param _multiTextureName name of a multi texture + * @param _textureName this returns the names of all sub textures that are combined under the given multi texture + */ + virtual void slotGetSubTextures( int /*_id*/, QString /*_multiTextureName*/, QStringList& /*_subTextures*/ ) {}; /** @} */ }; diff --git a/Core/Core.hh b/Core/Core.hh index 0e9c2a2ba19d1368e7efd376f7a091c7c7a3e8b4..d4860ae5480009977a684e3f6ce8b2a395972d05 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -220,6 +220,18 @@ signals: /// Change the image for a given texture void textureChangeImage( QString _textureName , QImage& _image , int _id ); + ///fetch texture image + void textureGetImage( QString _textureName , QImage& _image ); + + ///fetch texture image + void textureGetImage( QString _textureName , QImage& _image , int _id ); + + ///get current texture + void getCurrentTexture( int _id, QString& _textureName ); + + /// get a multi-texture's sub textures + void getSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures ); + /// If an ini File is opened, this signal is send to Plugins capable of handling ini files void iniLoad( INIFile&, int ); @@ -323,6 +335,18 @@ signals: ///Called by plugins if texture image should be changed void slotTextureChangeImage( QString _textureName , QImage& _image , int _id ); + ///Called by plugins if texture image should be fetched + void slotTextureGetImage( QString _textureName , QImage& _image ); + + ///Called by plugins if texture image should be fetched + void slotTextureGetImage( QString _textureName , QImage& _image , int _id ); + + ///Called by plugins if current texture should be retrieved + void slotGetCurrentTexture( int _id, QString& _textureName ); + + ///Called by plugins if a multi-texture's sub textures should be fetched + void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures ); + /// Called if a backup is requested by the plugins void backupRequest( int _id , QString _name ); diff --git a/Core/PluginCommunication.cc b/Core/PluginCommunication.cc index 6eb913bba00bb061960d7aa9c191fc6ccd2538cb..72885ceb1f21acac3aae514d57eeb09b026baf4c 100644 --- a/Core/PluginCommunication.cc +++ b/Core/PluginCommunication.cc @@ -294,6 +294,30 @@ void Core::slotTextureChangeImage( QString _textureName , QImage& _image , int _ emit textureChangeImage( _textureName , _image , _id ); } +/** Called by plugins if texture image should be fetched + */ +void Core::slotTextureGetImage( QString _textureName , QImage& _image ) { + emit textureGetImage( _textureName ,_image ); +} + +/** Called by plugins if texture image should be fetched + */ +void Core::slotTextureGetImage( QString _textureName , QImage& _image , int _id ) { + emit textureGetImage( _textureName , _image , _id ); +} + +/** Called by plugins if current texture name should be returned + */ +void Core::slotGetCurrentTexture( int _id, QString& _textureName ){ + emit getCurrentTexture( _id, _textureName ); +} + +/** Called by plugins if texture image should be fetched + */ +void Core::slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures ){ + emit getSubTextures( _id, _multiTextureName, _subTextures ); +} + //======================================================================================== // === Backup Communication ============================ //======================================================================================== diff --git a/Core/PluginLoader.cc b/Core/PluginLoader.cc index acb0663f08de31167cbe7145932cb4519f77bbd7..47f4b772c3a1c98400454aa337f38f22cf9e0389 100644 --- a/Core/PluginLoader.cc +++ b/Core/PluginLoader.cc @@ -999,8 +999,39 @@ void Core::loadPlugin(QString filename, bool silent, QObject* _plugin){ connect(this , SIGNAL(addMultiTexture(QString,QString,QString,int,int&) ), plugin , SLOT(slotMultiTextureAdded( QString,QString,QString,int,int&) ),Qt::DirectConnection); - } + if ( checkSignal( plugin , "textureGetImage(QString,QImage&,int)" ) ) + connect(plugin , SIGNAL(textureGetImage(QString,QImage&,int)), + this , SLOT(slotTextureGetImage(QString,QImage&,int)),Qt::DirectConnection); + + if ( checkSlot( plugin , "slotTextureGetImage(QString,QImage&,int)" ) ) + connect(this , SIGNAL(textureGetImage(QString,QImage&,int)), + plugin , SLOT(slotTextureGetImage(QString,QImage&,int)),Qt::DirectConnection); + + if ( checkSignal( plugin , "textureGetImage(QString,QImage&)" ) ) + connect(plugin , SIGNAL(textureGetImage(QString,QImage&)), + this , SLOT(slotTextureGetImage(QString,QImage&)),Qt::DirectConnection); + + if ( checkSlot( plugin , "slotTextureGetImage(QString,QImage&)" ) ) + connect(this , SIGNAL(textureGetImage(QString,QImage&)), + plugin , SLOT(slotTextureGetImage(QString,QImage&)),Qt::DirectConnection); + + if ( checkSignal( plugin , "getCurrentTexture(int,QString&)" ) ) + connect(plugin , SIGNAL(getCurrentTexture(int,QString&)), + this , SLOT(slotGetCurrentTexture(int,QString&)),Qt::DirectConnection); + if ( checkSlot( plugin , "slotGetCurrentTexture(int,QString&)" ) ) + connect(this , SIGNAL(getCurrentTexture(int,QString&)), + plugin , SLOT(slotGetCurrentTexture(int,QString&)),Qt::DirectConnection); + + if ( checkSignal( plugin , "getSubTextures(int,QString,QStringList&)" ) ) + connect(plugin , SIGNAL(getSubTextures(int,QString,QStringList&)), + this , SLOT(slotGetSubTextures(int,QString,QStringList&)),Qt::DirectConnection); + + if ( checkSlot( plugin , "slotGetSubTextures(int,QString,QStringList&)" ) ) + connect(this , SIGNAL(getSubTextures(int,QString,QStringList&)), + plugin , SLOT(slotGetSubTextures(int,QString,QStringList&)),Qt::DirectConnection); + } + //Check if the plugin supports Backup-Interface BackupInterface* backupPlugin = qobject_cast< BackupInterface * >(plugin); if ( backupPlugin ) {