Commit 990b3416 authored by Mike Kremer's avatar Mike Kremer

Extended texture interface to provide signals/slots to easily retrieve texture names and filenames.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10195 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 549e57ef
......@@ -207,18 +207,30 @@ class TextureInterface {
* @param _index the index of the texture (used for multiTexturing)
*/
virtual void textureIndex( QString /*_textureName*/, int /*_id*/, int& /*_index*/) {};
/** \brief get the name of the texture with given texture index
*
* When using multiTexturing you can retrieve the texture index of a face with 'mesh->texture_index'
* When using multiTexturing you can retrieve the texture index of a face with 'mesh.texture_index(Handle)'
* This function maps the texture index to the name of the actual texture that is used to texture
* the face.
* the face. Note that some plugins may change the mesh's internal property name for the texture
* index such that mesh.texture_index(Handle) won't return a valid texture index.
*
* @param _id Id of the object where the texture should be fetched from
* @param _textureIndex texture index of the wanted texture
* @param _textureName this returns the name of the texture
*/
virtual void textureName( int /*_id*/, int /*_textureIndex*/, QString& /*_textureName*/ ) {};
/** \brief get the filename of the texture with given texture index
*
* Get the filename of a given texture with name _textureName. Retrieve the texture's
* name via signal textureName(int,int,QString&) first.
*
* @param _id Id of the object where the texture should be fetched from
* @param _textureName The name of the texture whose filename will be fetched
* @param _textureFilename this returns the name of the texture
*/
virtual void textureFilename( int /*_id*/, QString /*_textureName*/, QString& /*_textureFilename*/ ) {};
/** \brief get the name of the texture which is currently enabled
*
......@@ -381,6 +393,25 @@ class TextureInterface {
* @param _textureName this returns the name of the texture
*/
virtual void slotTextureName( int /*_id*/, int /*_textureIndex*/, QString& /*_textureName*/ ) {};
/** \brief get the filename of the texture with given texture name
*
* Get the filename to texture with name _textureName. Retrieve texture names
* via signal textureName(int,int,QString&) using the object's id and
* the texture index.
*
* @param _id Id of the object where the texture should be fetched from
* @param _textureName texture name of the wanted texture
* @param _textureFilename this returns the filename of the texture
*/
virtual void slotTextureFilename( int /*_id*/, QString /*_textureName*/, QString& /*_textureFilename*/ ) {};
/** \brief get the number of textures per object
*
* @param _id Id of the object
* @param _numTextures returns the number of textures
*/
virtual void slotNumberOfTextures( int /*_id*/, int& /*_numTextures*/ ) {};
/** \brief fetches the name of the texture which is currently enabled
*
......
......@@ -237,6 +237,9 @@ signals:
/// get the texture name
void textureName( int _id, int _textureIndex, QString& _textureName);
/// get the texture's filename
void textureFilename( int _id, QString _textureName, QString& _textureFilename);
///get current texture
void getCurrentTexture( int _id, QString& _textureName );
......@@ -384,6 +387,9 @@ signals:
///Called by plugins if texture name should be fetched
void slotTextureName( int _id, int _textureIndex, QString& _textureName);
///Called by plugins if texture name should be fetched
void slotTextureFilename( int _id, QString _textureName, QString& _textureFilename);
///Called by plugins if current texture should be retrieved
void slotGetCurrentTexture( int _id, QString& _textureName );
......
......@@ -319,6 +319,12 @@ void Core::slotTextureName( int _id, int _textureIndex, QString& _textureName){
emit textureName( _id, _textureIndex, _textureName);
}
/** Called by plugins if texture filename should be fetched
*/
void Core::slotTextureFilename( int _id, QString _textureName, QString& _textureFilename){
emit textureFilename( _id, _textureName, _textureFilename);
}
/** Called by plugins if current texture name should be returned
*/
void Core::slotGetCurrentTexture( int _id, QString& _textureName ){
......
......@@ -1025,11 +1025,11 @@ void Core::loadPlugin(QString filename, bool silent, QObject* _plugin){
if ( checkSignal( plugin , "textureIndex(QString,int,int&)" ) )
connect(plugin , SIGNAL(textureIndex(QString,int,int&)),
this , SLOT(slotTextureIndex(QString,int,int&)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotTextureIndex(QString,int,int&)" ) )
connect(this , SIGNAL(textureIndex(QString,int,int&)),
plugin , SLOT(slotTextureIndex(QString,int,int&)),Qt::DirectConnection);
if ( checkSignal( plugin , "textureName(int,int,QString&)" ) )
connect(plugin , SIGNAL(textureName(int,int,QString&)),
this , SLOT(slotTextureName(int,int,QString&)),Qt::DirectConnection);
......@@ -1038,6 +1038,14 @@ void Core::loadPlugin(QString filename, bool silent, QObject* _plugin){
connect(this , SIGNAL(textureName(int,int,QString&)),
plugin , SLOT(slotTextureName(int,int,QString&)),Qt::DirectConnection);
if ( checkSignal( plugin , "textureFilename(int,QString,QString&)" ) )
connect(plugin , SIGNAL(textureFilename(int,QString,QString&)),
this , SLOT(slotTextureFilename(int,QString,QString&)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotTextureFilename(int,QString,QString&)" ) )
connect(this , SIGNAL(textureFilename(int,QString,QString&)),
plugin , SLOT(slotTextureFilename(int,QString,QString&)),Qt::DirectConnection);
if ( checkSignal( plugin , "getCurrentTexture(int,QString&)" ) )
connect(plugin , SIGNAL(getCurrentTexture(int,QString&)),
this , SLOT(slotGetCurrentTexture(int,QString&)),Qt::DirectConnection);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment