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

Switch Menu Entry to right Texture on update

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3583 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fdee2908
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
// it under the terms of the GNU Lesser General Public License as published by // it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// OpenFlipper is distributed in the hope that it will be useful, // OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details. // GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>. // along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
// //
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
#include <QtGui> #include <QtGui>
#include "TextureControl.hh" #include "TextureControl.hh"
#include <iostream> #include <iostream>
#include <ACG/GL/GLState.hh> #include <ACG/GL/GLState.hh>
#include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include "OpenFlipper/common/GlobalOptions.hh" #include "OpenFlipper/common/GlobalOptions.hh"
...@@ -59,30 +59,30 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil ...@@ -59,30 +59,30 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
tex.max_val = 1.0; tex.max_val = 1.0;
tex.type = VERTEXBASED; tex.type = VERTEXBASED;
textures_.push_back( tex ); textures_.push_back( tex );
activeTexture_ = _textureName; activeTexture_ = _textureName;
QAction* new_texture = new QAction(_textureName, this); QAction* new_texture = new QAction(_textureName, this);
new_texture->setStatusTip(tr("Switch to this Texture")); new_texture->setStatusTip(tr("Switch to this Texture"));
new_texture->setCheckable(true); new_texture->setCheckable(true);
actionGroup_->addAction(new_texture); actionGroup_->addAction(new_texture);
textureMenu_->addAction(new_texture); textureMenu_->addAction(new_texture);
new_texture->setChecked(true); new_texture->setChecked(true);
textureActions_.push_back(new_texture); textureActions_.push_back(new_texture);
///@todo if a texture is added later, update or generate it for all objects ///@todo if a texture is added later, update or generate it for all objects
// emit updateTexture(_textureName,-1); // emit updateTexture(_textureName,-1);
} }
void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _identifier ) { void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _identifier ) {
BaseObjectData* object; BaseObjectData* object;
if (! PluginFunctions::get_object( _identifier , object ) ) { if (! PluginFunctions::get_object( _identifier , object ) ) {
emit log(LOGERR,"Unable to get Object for id " + QString::number(_identifier) ); emit log(LOGERR,"Unable to get Object for id " + QString::number(_identifier) );
return; return;
} }
// Search the list of textures if we have the texture // Search the list of textures if we have the texture
int textureid = -1; int textureid = -1;
for ( int i = 0 ; i < (int)textures_.size() ; ++i ) { for ( int i = 0 ; i < (int)textures_.size() ; ++i ) {
...@@ -91,39 +91,39 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident ...@@ -91,39 +91,39 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
break; break;
} }
} }
if ( textureid == -1 ) { if ( textureid == -1 ) {
emit log(LOGERR,"Unable to find texture with name " + _textureName ); emit log(LOGERR,"Unable to find texture with name " + _textureName );
return; return;
} }
// Only update if the active texture is the current texture // Only update if the active texture is the current texture
if ( activeTexture_ != _textureName) if ( activeTexture_ != _textureName)
return; return;
const bool repeat = textures_[textureid].repeat; const bool repeat = textures_[textureid].repeat;
if( object->dataType( DATA_TRIANGLE_MESH ) ) { if( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMesh* mesh = PluginFunctions::triMesh(object); TriMesh* mesh = PluginFunctions::triMesh(object);
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;
PluginFunctions::triMeshObject(object)->textureNode()->read(filename.toUtf8()); PluginFunctions::triMeshObject(object)->textureNode()->read(filename.toUtf8());
} }
if ( object->dataType( DATA_POLY_MESH ) ) { if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMesh* mesh = PluginFunctions::polyMesh(object); PolyMesh* mesh = PluginFunctions::polyMesh(object);
doUpdateTexture(textureid, *mesh); doUpdateTexture(textureid, *mesh);
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;
PluginFunctions::polyMeshObject(object)->textureNode()->read(filename.toUtf8()); PluginFunctions::polyMeshObject(object)->textureNode()->read(filename.toUtf8());
...@@ -156,7 +156,7 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh ) ...@@ -156,7 +156,7 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh )
copyTexture(_textureid, _mesh, texture2D); copyTexture(_textureid, _mesh, texture2D);
} else } else
emit log(LOGERR, "Unsupported Texture Dimension " + QString::number(textures_[_textureid].dimension) ); emit log(LOGERR, "Unsupported Texture Dimension " + QString::number(textures_[_textureid].dimension) );
} else if ( textures_[_textureid].type == VERTEXBASED ) { } else if ( textures_[_textureid].type == VERTEXBASED ) {
if ( textures_[_textureid].dimension == 1 ) { if ( textures_[_textureid].dimension == 1 ) {
...@@ -164,7 +164,7 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh ) ...@@ -164,7 +164,7 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh )
OpenMesh::VPropHandleT< double > texture; OpenMesh::VPropHandleT< double > texture;
if ( ! _mesh.get_property_handle(texture,textures_[_textureid].name.toStdString() ) ) { if ( ! _mesh.get_property_handle(texture,textures_[_textureid].name.toStdString() ) ) {
emit log(LOGERR,"Unable to get property " + textures_[_textureid].name ); emit log(LOGERR,"Unable to get property " + textures_[_textureid].name );
return; return;
} }
copyTexture(_textureid, _mesh, texture); copyTexture(_textureid, _mesh, texture);
...@@ -174,27 +174,27 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh ) ...@@ -174,27 +174,27 @@ void TextureControlPlugin::doUpdateTexture ( int _textureid, MeshT& _mesh )
OpenMesh::VPropHandleT< OpenMesh::Vec2d > texture2D; OpenMesh::VPropHandleT< OpenMesh::Vec2d > texture2D;
if ( ! _mesh.get_property_handle(texture2D,textures_[_textureid].name.toStdString() ) ) { if ( ! _mesh.get_property_handle(texture2D,textures_[_textureid].name.toStdString() ) ) {
emit log(LOGERR,"Unable to get property " + textures_[_textureid].name ); emit log(LOGERR,"Unable to get property " + textures_[_textureid].name );
return; return;
} }
copyTexture(_textureid, _mesh, texture2D); copyTexture(_textureid, _mesh, texture2D);
} /*else if ( textures_[_textureid].dimension == 3 ) { } /*else if ( textures_[_textureid].dimension == 3 ) {
OpenMesh::VPropHandleT< OpenMesh::Vec3d > scalarField3D; OpenMesh::VPropHandleT< OpenMesh::Vec3d > scalarField3D;
if ( ! _mesh.get_property_handle(scalarField3D,textures_[_textureid].name) ) { if ( ! _mesh.get_property_handle(scalarField3D,textures_[_textureid].name) ) {
emit log(LOGERR,"Unable to get property " + textures_[_textureid].name ); emit log(LOGERR,"Unable to get property " + textures_[_textureid].name );
return; return;
} }
copyTexture(_textureid, _mesh, scalarField3D); copyTexture(_textureid, _mesh, scalarField3D);
}*/ else }*/ else
emit log(LOGERR, "Unsupported Texture Dimension " + QString::number(textures_[_textureid].dimension) ); emit log(LOGERR, "Unsupported Texture Dimension " + QString::number(textures_[_textureid].dimension) );
} else } else
emit log(LOGERR, "Unsupported Texture type"); emit log(LOGERR, "Unsupported Texture type");
} }
template< typename MeshT > template< typename MeshT >
...@@ -218,7 +218,7 @@ void TextureControlPlugin::copyTexture ( int /*_textureid*/, MeshT& _mesh, OpenM ...@@ -218,7 +218,7 @@ void TextureControlPlugin::copyTexture ( int /*_textureid*/, MeshT& _mesh, OpenM
_mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value[0]), float(value[1]) ) ); _mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value[0]), float(value[1]) ) );
} }
} }
template< typename MeshT > template< typename MeshT >
void TextureControlPlugin::copyTexture ( int _textureid, MeshT& _mesh, OpenMesh::HPropHandleT< double > _texProp ) void TextureControlPlugin::copyTexture ( int _textureid, MeshT& _mesh, OpenMesh::HPropHandleT< double > _texProp )
{ {
...@@ -248,10 +248,10 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open ...@@ -248,10 +248,10 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open
const bool clamp = textures_[_textureid].clamp ; const bool clamp = textures_[_textureid].clamp ;
const double clamp_max = textures_[_textureid].clamp_max; const double clamp_max = textures_[_textureid].clamp_max;
const double clamp_min = textures_[_textureid].clamp_min; const double clamp_min = textures_[_textureid].clamp_min;
_max = FLT_MIN; _max = FLT_MIN;
_min = FLT_MAX; _min = FLT_MAX;
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin() ; v_it != _mesh.vertices_end(); ++v_it) { for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin() ; v_it != _mesh.vertices_end(); ++v_it) {
if ( abs ) { if ( abs ) {
_max = std::max( fabs(_mesh.property(_texture,v_it)) , _max); _max = std::max( fabs(_mesh.property(_texture,v_it)) , _max);
...@@ -260,8 +260,8 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open ...@@ -260,8 +260,8 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open
_max = std::max( _mesh.property(_texture,v_it) , _max); _max = std::max( _mesh.property(_texture,v_it) , _max);
_min = std::min( _mesh.property(_texture,v_it) , _min); _min = std::min( _mesh.property(_texture,v_it) , _min);
} }
} }
if ( clamp ) { if ( clamp ) {
if ( _max > clamp_max ) if ( _max > clamp_max )
_max = clamp_max; _max = clamp_max;
...@@ -277,10 +277,10 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open ...@@ -277,10 +277,10 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open
const bool clamp = textures_[_textureid].clamp ; const bool clamp = textures_[_textureid].clamp ;
const double clamp_max = textures_[_textureid].clamp_max; const double clamp_max = textures_[_textureid].clamp_max;
const double clamp_min = textures_[_textureid].clamp_min; const double clamp_min = textures_[_textureid].clamp_min;
_max = FLT_MIN; _max = FLT_MIN;
_min = FLT_MAX; _min = FLT_MAX;
for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin() ; h_it != _mesh.halfedges_end(); ++h_it) { for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin() ; h_it != _mesh.halfedges_end(); ++h_it) {
if ( abs ) { if ( abs ) {
_max = std::max( fabs(_mesh.property(_texture,h_it)) , _max); _max = std::max( fabs(_mesh.property(_texture,h_it)) , _max);
...@@ -289,16 +289,16 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open ...@@ -289,16 +289,16 @@ void TextureControlPlugin::computeMinMaxScalar(int _textureid, MeshT& _mesh,Open
_max = std::max( _mesh.property(_texture,h_it) , _max); _max = std::max( _mesh.property(_texture,h_it) , _max);
_min = std::min( _mesh.property(_texture,h_it) , _min); _min = std::min( _mesh.property(_texture,h_it) , _min);
} }
} }
if ( clamp ) { if ( clamp ) {
if ( _max > clamp_max ) if ( _max > clamp_max )
_max = clamp_max; _max = clamp_max;
if (_min < clamp_min) if (_min < clamp_min)
_min = clamp_min; _min = clamp_min;
} }
} }
void TextureControlPlugin::computeValue(int _textureid, double _min, double _max, double& _value) { void TextureControlPlugin::computeValue(int _textureid, double _min, double _max, double& _value) {
const bool clamp = textures_[_textureid].clamp ; const bool clamp = textures_[_textureid].clamp ;
const bool center = textures_[_textureid].center; const bool center = textures_[_textureid].center;
...@@ -308,11 +308,11 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max ...@@ -308,11 +308,11 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max
const double clamp_min = textures_[_textureid].clamp_min; const double clamp_min = textures_[_textureid].clamp_min;
const double scale = fabs(_max) + fabs(_min); const double scale = fabs(_max) + fabs(_min);
const bool repeat = textures_[_textureid].repeat; const bool repeat = textures_[_textureid].repeat;
// Use absolute value as requested by plugin // Use absolute value as requested by plugin
if ( abs ) if ( abs )
_value = fabs(_value); _value = fabs(_value);
// Clamp if requested // Clamp if requested
if ( clamp ) { if ( clamp ) {
if ( _value > clamp_max ) if ( _value > clamp_max )
...@@ -320,7 +320,7 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max ...@@ -320,7 +320,7 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max
if (_value < clamp_min) if (_value < clamp_min)
_value = clamp_min; _value = clamp_min;
} }
// if the texture should not be repeated, scale to 0..1 // if the texture should not be repeated, scale to 0..1
if ( ! repeat ) { if ( ! repeat ) {
if (! center ) { if (! center ) {
...@@ -345,24 +345,24 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max ...@@ -345,24 +345,24 @@ void TextureControlPlugin::computeValue(int _textureid, double _min, double _max
} }
void TextureControlPlugin::slotObjectUpdated(int _identifier) void TextureControlPlugin::slotObjectUpdated(int _identifier)
{ {
// Object erased, so do nothing // Object erased, so do nothing
if ( _identifier == -1 ) { if ( _identifier == -1 ) {
return; return;
} }
// Force an update of all textures which are available for the updated object // Force an update of all textures which are available for the updated object
for ( uint i = 0 ; i < textures_.size() ; ++i ) { for ( uint i = 0 ; i < textures_.size() ; ++i ) {
emit updateTexture( textures_[i].name , _identifier ); emit updateTexture( textures_[i].name , _identifier );
} }
emit update_view(); emit update_view();
} }
void TextureControlPlugin::slotUpdateAllTextures( ) { void TextureControlPlugin::slotUpdateAllTextures( ) {
// Force an update of all textures which are available for the updated object // Force an update of all textures which are available for the updated object
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objects_end(); ++o_it) for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objects_end(); ++o_it)
for ( uint i = 0 ; i < textures_.size() ; ++i ) for ( uint i = 0 ; i < textures_.size() ; ++i )
emit updateTexture( textures_[i].name , o_it->id() ); emit updateTexture( textures_[i].name , o_it->id() );
} }
...@@ -374,18 +374,18 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod ...@@ -374,18 +374,18 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
break; break;
} }
} }
if ( textureid == -1 ) { if ( textureid == -1 ) {
emit log(LOGERR,"Texture Mode setting requested for " + _textureName + " but texture not found" ); emit log(LOGERR,"Texture Mode setting requested for " + _textureName + " but texture not found" );
return; return;
} }
int i = 0; int i = 0;
QString nextString = _mode.section(',',i,i); QString nextString = _mode.section(',',i,i);
while ( nextString != "" ) { while ( nextString != "" ) {
QString sectionName = nextString.section('=',0,0); QString sectionName = nextString.section('=',0,0);
QString value = nextString.section('=',1,1); QString value = nextString.section('=',1,1);
if ( sectionName == "clamp" ) { if ( sectionName == "clamp" ) {
if (value == "false") { if (value == "false") {
textures_[textureid].clamp = false; textures_[textureid].clamp = false;
...@@ -407,14 +407,14 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod ...@@ -407,14 +407,14 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
textures_[textureid].repeat = false; textures_[textureid].repeat = false;
} else { } else {
textures_[textureid].repeat = true; textures_[textureid].repeat = true;
} }
} else } else
if ( sectionName == "center" ) { if ( sectionName == "center" ) {
if (value == "false") { if (value == "false") {
textures_[textureid].center = false; textures_[textureid].center = false;
} else { } else {
textures_[textureid].center = true; textures_[textureid].center = true;
} }
} else } else
if ( sectionName == "scale" ) { if ( sectionName == "scale" ) {
if (value == "false") { if (value == "false") {
...@@ -431,17 +431,17 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod ...@@ -431,17 +431,17 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
} }
} else } else
emit log(LOGERR,"Unknown texture mode : " + sectionName); emit log(LOGERR,"Unknown texture mode : " + sectionName);
++i; ++i;
nextString = _mode.section(',',i,i); nextString = _mode.section(',',i,i);
} }
if ( activeTexture_ == _textureName ) { if ( activeTexture_ == _textureName ) {
// Force an update of all objects // Force an update of all objects
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objects_end(); ++o_it) for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objects_end(); ++o_it)
updateTexture( _textureName , o_it->id() ); updateTexture( _textureName , o_it->id() );
emit update_view(); emit update_view();
} }
} }
...@@ -449,35 +449,35 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod ...@@ -449,35 +449,35 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
void TextureControlPlugin::pluginsInitialized() { void TextureControlPlugin::pluginsInitialized() {
// Texture menu // Texture menu
textureMenu_ = new QMenu(tr("&Texture Control")); textureMenu_ = new QMenu(tr("&Texture Control"));
textureMenu_->setTearOffEnabled(true); textureMenu_->setTearOffEnabled(true);
emit addMenu( textureMenu_ , VIEWMENU ); emit addMenu( textureMenu_ , VIEWMENU );
settingsDialog_ = new texturePropertiesWidget(0); settingsDialog_ = new texturePropertiesWidget(0);
connect(settingsDialog_->okButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesOk() ) ); connect(settingsDialog_->okButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesOk() ) );
connect(settingsDialog_->applyButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesApply() ) ); connect(settingsDialog_->applyButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesApply() ) );
connect(settingsDialog_->cancelButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesCancel() ) ); connect(settingsDialog_->cancelButton,SIGNAL(clicked()), this , SLOT (slotTexturePropertiesCancel() ) );
actionGroup_ = new QActionGroup( 0 ); actionGroup_ = new QActionGroup( 0 );
actionGroup_->setExclusive( true ); actionGroup_->setExclusive( true );
connect( actionGroup_, SIGNAL( triggered( QAction * ) ), connect( actionGroup_, SIGNAL( triggered( QAction * ) ),
this, SLOT( slotTextureMenu( QAction * ) ) ); this, SLOT( slotTextureMenu( QAction * ) ) );
QAction* AC_Texture_Settings = new QAction(tr("&Texture Settings"), this); QAction* AC_Texture_Settings = new QAction(tr("&Texture Settings"), this);
AC_Texture_Settings->setStatusTip(tr("Set the texture visualization properties")); AC_Texture_Settings->setStatusTip(tr("Set the texture visualization properties"));
connect(AC_Texture_Settings, SIGNAL(triggered()), this, SLOT(slotSetTextureProperties())); connect(AC_Texture_Settings, SIGNAL(triggered()), this, SLOT(slotSetTextureProperties()));
textureMenu_->addAction(AC_Texture_Settings); textureMenu_->addAction(AC_Texture_Settings);
textureMenu_->addSeparator(); textureMenu_->addSeparator();
textureMenu_->addActions(actionGroup_->actions()); textureMenu_->addActions(actionGroup_->actions());
} }
void TextureControlPlugin::updateDialog() { void TextureControlPlugin::updateDialog() {
if ( textures_.size() == 0 ) if ( textures_.size() == 0 )
return; return;
int textureid = -1; int textureid = -1;
for ( int i = 0 ; i < (int)textures_.size() ; ++i ) { for ( int i = 0 ; i < (int)textures_.size() ; ++i ) {
if ( textures_[i].name == activeTexture_ ) { if ( textures_[i].name == activeTexture_ ) {
...@@ -485,12 +485,12 @@ void TextureControlPlugin::pluginsInitialized() { ...@@ -485,12 +485,12 @@ void TextureControlPlugin::pluginsInitialized() {
break; break;
} }
} }
if ( textureid == -1 ) { if ( textureid == -1 ) {
emit log(LOGERR,"Active Texture not found"); emit log(LOGERR,"Active Texture not found");
return; return;
} }
settingsDialog_->repeatBox->setChecked(textures_[textureid].repeat); settingsDialog_->repeatBox->setChecked(textures_[textureid].repeat);
settingsDialog_->clampBox->setChecked(textures_[textureid].clamp); settingsDialog_->clampBox->setChecked(textures_[textureid].clamp);
settingsDialog_->centerBox->setChecked(textures_[textureid].center); settingsDialog_->centerBox->setChecked(textures_[textureid].center);
...@@ -501,21 +501,21 @@ void TextureControlPlugin::pluginsInitialized() { ...@@ -501,21 +501,21 @@ void TextureControlPlugin::pluginsInitialized() {
tmp.setNum(textures_[textureid].clamp_min); tmp.setNum(textures_[textureid].clamp_min);
settingsDialog_->clamp_min->setText(tmp); settingsDialog_->clamp_min->setText(tmp);
tmp.setNum(textures_[textureid].clamp_max); tmp.setNum(textures_[textureid].clamp_max);
settingsDialog_->clamp_max->setText(tmp); settingsDialog_->clamp_max->setText(tmp);
} }
void TextureControlPlugin::slotSetTextureProperties() { void TextureControlPlugin::slotSetTextureProperties() {
updateDialog(); updateDialog();
if ( textures_.size() == 0 ) if ( textures_.size() == 0 )
return;