Commit 02ebfb87 authored by Jan Möbius's avatar Jan Möbius
Browse files

Use addTexture from Core instead of directly accessing the textureNode

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4615 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 814c9f47
...@@ -110,10 +110,18 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident ...@@ -110,10 +110,18 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
doUpdateTexture(textureid, *mesh); doUpdateTexture(textureid, *mesh);
PluginFunctions::triMeshObject(object)->textureNode()->set_repeat(repeat); PluginFunctions::triMeshObject(object)->textureNode()->set_repeat(repeat);
QString filename = OpenFlipper::Options::textureDir().absolutePath() + QString filename = OpenFlipper::Options::textureDir().absolutePath() +
OpenFlipper::Options::dirSeparator() + OpenFlipper::Options::dirSeparator() +
textures_[textureid].filename; textures_[textureid].filename;
// load to image
QImage textureImage;
if ( !textureImage.load( filename ) )
{
std::cerr << "Cannot load texture " << filename.toStdString() << "\n";
return ;
}
PluginFunctions::triMeshObject(object)->textureNode()->read(filename.toUtf8()); PluginFunctions::triMeshObject(object)->addTexture(_textureName,textureImage);
} }
if ( object->dataType( DATA_POLY_MESH ) ) { if ( object->dataType( DATA_POLY_MESH ) ) {
...@@ -123,10 +131,18 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident ...@@ -123,10 +131,18 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
PluginFunctions::polyMeshObject(object)->textureNode()->set_repeat(repeat); PluginFunctions::polyMeshObject(object)->textureNode()->set_repeat(repeat);
QString filename = OpenFlipper::Options::textureDir().absolutePath() + QString filename = OpenFlipper::Options::textureDir().absolutePath() +
OpenFlipper::Options::dirSeparator() + OpenFlipper::Options::dirSeparator() +
textures_[textureid].filename; textures_[textureid].filename;
// load to image
QImage textureImage;
if ( !textureImage.load( filename ) )
{
std::cerr << "Cannot load texture " << filename.toStdString() << "\n";
return ;
}
PluginFunctions::polyMeshObject(object)->textureNode()->read(filename.toUtf8()); PluginFunctions::polyMeshObject(object)->addTexture(_textureName,textureImage);
} }
emit updateView(); emit updateView();
......
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