Commit dcd154ec authored by Mike Kremer's avatar Mike Kremer

Implemented saving of textures for OBJ files.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10196 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 250941b6
......@@ -547,6 +547,47 @@ void TextureControlPlugin::slotTextureName( int _id, int _textureIndex, QString&
return;
}
void TextureControlPlugin::slotTextureFilename( int _id, QString _textureName, QString& _textureFilename){
// Get the object
BaseObjectData* obj;
if (! PluginFunctions::getObject( _id , obj ) ) {
emit log(LOGERR,"Unable to get Object for id " + QString::number(_id) );
}
// ================================================================================
// Get Texture data for current object
// ================================================================================
TextureData* texData = dynamic_cast< TextureData* > ( obj->objectData(TEXTUREDATA) );
if (texData == 0) {
emit log(LOGERR, tr("slotTextureName: Object has no texture data! Object: %1").arg(_id) );
return;
}
// Search in local textures
for (uint i=0; i < texData->textures().size(); i++ ) {
for (int j=0; j < texData->textures()[i].multiTextureList.size(); j++ ) {
if ( (texData->textures()[i]).name() == _textureName ){
Texture& tex = texData->texture((texData->textures()[i]).name());
_textureFilename = tex.filename();
return;
} else if ( (texData->textures()[i]).multiTextureList[j] == _textureName ){
Texture& tex = texData->texture((texData->textures()[i]).multiTextureList[j]);
_textureFilename = tex.filename();
return;
}
}
}
_textureFilename = OpenFlipper::Options::textureDir().path() +
QDir::separator().toAscii() + (globalTextures_.texture(_textureName)).filename();
QFile f(_textureFilename);
if(!f.exists()) _textureFilename = "NOT_FOUND";
return;
}
void TextureControlPlugin::slotGetCurrentTexture( int _id, QString& _textureName ){
_textureName = "NONE";
......
......@@ -121,6 +121,7 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
void slotTextureGetImage( QString _textureName, QImage& _image );
void slotTextureIndex( QString _textureName, int _id, int& _index);
void slotTextureName( int _id, int _textureIndex, QString& _textureName);
void slotTextureFilename( int _id, QString _textureName, QString& _textureFilename);
void slotGetCurrentTexture( int _id, QString& _textureName );
void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
......
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