Commit 30e25859 authored by Jan Möbius's avatar Jan Möbius

Allow change of visible name for textures

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5994 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fcea44ad
...@@ -667,6 +667,11 @@ bool TextureControlPlugin::parseMode( QString _mode, Texture& _texture ) { ...@@ -667,6 +667,11 @@ bool TextureControlPlugin::parseMode( QString _mode, Texture& _texture ) {
_texture.indexMappingProperty( value ); _texture.indexMappingProperty( value );
changed = true; changed = true;
} }
}else if ( sectionName == "visiblename" ) {
if ( value != _texture.visibleName() ) {
_texture.visibleName( value );
changed = true;
}
} else if ( sectionName == "type" ) { } else if ( sectionName == "type" ) {
if ( ( value == "halfedgebased" ) && ( _texture.type() != HALFEDGEBASED ) ) { if ( ( value == "halfedgebased" ) && ( _texture.type() != HALFEDGEBASED ) ) {
_texture.type( HALFEDGEBASED ); _texture.type( HALFEDGEBASED );
...@@ -769,6 +774,11 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod ...@@ -769,6 +774,11 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
changed = true; changed = true;
} }
if ( _mode.contains("visiblename") && (texture.visibleName() != localTex.visibleName() ) ){
localTex.visibleName( texture.visibleName() );
changed = true;
}
//only update if the texture is enabled //only update if the texture is enabled
if (changed){ if (changed){
if ( texData->isEnabled(_textureName) ) if ( texData->isEnabled(_textureName) )
...@@ -1179,7 +1189,10 @@ void TextureControlPlugin::slotUpdateContextMenu( int _objectId ) { ...@@ -1179,7 +1189,10 @@ void TextureControlPlugin::slotUpdateContextMenu( int _objectId ) {
if ( texData->textures()[i].hidden() ) if ( texData->textures()[i].hidden() )
continue; continue;
action = actionGroup->addAction( texData->textures()[i].name() ); if ( !texData->textures()[i].visibleName().isEmpty() )
action = actionGroup->addAction( texData->textures()[i].visibleName() );
else
action = actionGroup->addAction( texData->textures()[i].name() );
action->setCheckable(true); action->setCheckable(true);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
Texture::Texture() : Texture::Texture() :
name_("No Texture"), name_("No Texture"),
visibleName_(""),
filename_("Invalid"), filename_("Invalid"),
id_(-1), id_(-1),
glName_(0), glName_(0),
...@@ -294,7 +295,7 @@ int TextureData::getTextureIndex(QString _textureName) ...@@ -294,7 +295,7 @@ int TextureData::getTextureIndex(QString _textureName)
// 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 ) {
if ( textures_[i].name() == _textureName ) { if ( (textures_[i].name() == _textureName) || (textures_[i].visibleName() == _textureName) ) {
textureid = i; textureid = i;
break; break;
} }
......
...@@ -101,6 +101,9 @@ class Texture { ...@@ -101,6 +101,9 @@ class Texture {
void name( QString _name ) { name_ = _name; }; void name( QString _name ) { name_ = _name; };
QString name() { return name_; }; QString name() { return name_; };
void visibleName( QString _name ) { visibleName_ = _name; };
QString visibleName() { return visibleName_; };
void dimension( uint _dimension ) { dimension_ = _dimension; }; void dimension( uint _dimension ) { dimension_ = _dimension; };
uint dimension( ) { return dimension_; }; uint dimension( ) { return dimension_; };
...@@ -142,6 +145,9 @@ class Texture { ...@@ -142,6 +145,9 @@ class Texture {
/// Texture Name /// Texture Name
QString name_; QString name_;
/// Name visible in the gui
QString visibleName_;
/// Filename of the texture /// Filename of the texture
QString filename_; QString filename_;
......
...@@ -91,9 +91,17 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name ...@@ -91,9 +91,17 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name
for (uint i=0; i < texData_->textures().size(); i++) for (uint i=0; i < texData_->textures().size(); i++)
if ( ! texData_->textures()[i].hidden() ) { if ( ! texData_->textures()[i].hidden() ) {
if ( texData_->textures()[i].type() != MULTITEXTURE ) { if ( texData_->textures()[i].type() != MULTITEXTURE ) {
textureList->addTopLevelItem( new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) ) ); if ( !texData_->textures()[i].visibleName().isEmpty() )
textureList->addTopLevelItem( new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].visibleName() ) ) );
else
textureList->addTopLevelItem( new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) ) );
} else { } else {
QTreeWidgetItem* parent = new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) ); QTreeWidgetItem* parent = 0;
if ( !texData_->textures()[i].visibleName().isEmpty() )
parent = new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].visibleName() ) );
else
parent = new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) );
textureList->addTopLevelItem( parent ) ; textureList->addTopLevelItem( parent ) ;
for ( int j = 0 ; j < texData_->textures()[i].multiTextureList.size() ; ++j ) for ( int j = 0 ; j < texData_->textures()[i].multiTextureList.size() ; ++j )
textureList->addTopLevelItem( new QTreeWidgetItem(parent, QStringList(texData_->textures()[i].multiTextureList[j] )) ); textureList->addTopLevelItem( new QTreeWidgetItem(parent, QStringList(texData_->textures()[i].multiTextureList[j] )) );
......
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