Commit 3c173e19 authored by Jan Möbius's avatar Jan Möbius

Make texture mode setting more stable ( string parser )

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5773 383ad7c9-94d9-4d36-a494-682f7c89f535
parent ba0683fa
......@@ -561,12 +561,20 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
// ================================================================================
Texture& texture = globalTextures_.texture(_textureName);
// Cleanup representation
_mode = _mode.toLower();
int i = 0;
QString nextString = _mode.section(',',i,i);
while ( nextString != "" ) {
QString sectionName = nextString.section('=',0,0);
QString value = nextString.section('=',1,1);
// Cleanup representation
value = value.trimmed();
sectionName = sectionName.trimmed();
if ( sectionName == "clamp" ) {
texture.parameters.clamp = StringToBool(value);
} else
......@@ -591,8 +599,11 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
if ( sectionName == "type" ) {
if (value == "halfedgebased") {
texture.type( HALFEDGEBASED );
} else {
} else if ( value == "vertexbased")
{
texture.type( VERTEXBASED );
} else {
emit log(LOGERR,"Unknown texture type : " + value + " for texture: " + _textureName);
}
} else
emit log(LOGERR,"Unknown texture mode : " + sectionName);
......@@ -701,6 +712,8 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName, QString _mod
// ================================================================================
Texture& texture = texData->texture(_textureName);
_mode = _mode.toLower();
bool changed = false;
int i = 0;
......@@ -709,6 +722,10 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName, QString _mod
QString sectionName = nextString.section('=',0,0);
QString value = nextString.section('=',1,1);
// Cleanup representation
value = value.trimmed();
sectionName = sectionName.trimmed();
if ( sectionName == "clamp" ) {
if ( StringToBool(value) != texture.parameters.clamp ) {
texture.parameters.clamp = StringToBool(value);
......@@ -750,12 +767,14 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName, QString _mod
changed = true;
}
} else if ( sectionName == "type" ) {
if (value == "halfedgebased") {
if ( ( value == "halfedgebased" ) && ( texture.type() != HALFEDGEBASED ) ) {
texture.type( HALFEDGEBASED );
changed = true;
} else {
} else if ( (value == "vertexbased") && (texture.type() != HALFEDGEBASED) ) {
texture.type( VERTEXBASED );
changed = true;
} else {
emit log(LOGERR,"Unknown texture type : " + value + " for texture: " + _textureName);
}
} else
emit log(LOGERR,"Unknown texture mode : " + sectionName);
......
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