Commit 722058a0 authored by Jan Möbius's avatar Jan Möbius

Check if textures are really available before loading or load unknown texture image

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6019 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 46d39238
......@@ -219,7 +219,7 @@ void TextureControlPlugin::handleFileOpenTextures( MeshT*& _mesh , int _objectId
_mesh->property(oldVertexCoords, v_it ) = _mesh->texcoord2D( v_it );
slotTextureAdded("Original Per Vertex Texture Coords","unknown.png",2,_objectId);
slotSetTextureMode("Original Per Face Texture Coords","type=vertexbased",_objectId);
slotSetTextureMode("Original Per Vertex Texture Coords","type=vertexbased",_objectId);
// ================================================================================
// Create a backup of the original per Face texture Coordinates
......@@ -250,11 +250,18 @@ void TextureControlPlugin::handleFileOpenTextures( MeshT*& _mesh , int _objectId
// TODO : If only one Texture, use single Texturing mode
if ( true ) {
std::cerr << "Size : " << _mesh->property(property).size() << std::endl;
// Assume multiTexture Mode now and load the Textures
for ( std::map< int, std::string >::iterator texture = _mesh->property(property).begin();
texture != _mesh->property(property).end(); texture++ ) {
int textureId = -1;
slotMultiTextureAdded("OBJ Data",QString(texture->second.c_str()) , QString(texture->second.c_str()), _objectId, textureId );
QFileInfo info(texture->second.c_str());
if ( info.exists() )
slotMultiTextureAdded("OBJ Data",QString(texture->second.c_str()) , QString(texture->second.c_str()), _objectId, textureId );
else {
emit log(LOGWARN,"Unable to load texture image " + QString(texture->second.c_str()));
slotMultiTextureAdded("OBJ Data","Unknown Texture image " + QString::number(textureId), "unknown.png", _objectId, textureId );
}
newMapping[texture->first] = textureId;
}
......
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