Vegetation set stuff.

This commit is contained in:
dfighter1985 2014-08-04 21:33:11 +02:00
parent 90b9a592b8
commit de15faa5d2
5 changed files with 39 additions and 6 deletions

View file

@ -393,3 +393,22 @@ void TileBank::clearImage( int ts, int type, int tile, TileConstants::TTileChann
}
void TileBank::setVegetation( int tileSet, const QString &vegetation )
{
NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet );
if( set == NULL )
return;
set->setTileVegetableDescFileName( vegetation.toUtf8().constData() );
}
QString TileBank::getVegetation( int tileSet ) const
{
NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet );
if( set == NULL )
return "";
return set->getTileVegetableDescFileName().c_str();
}

View file

@ -29,6 +29,9 @@ public:
bool setTile( int tileset, int tile, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type );
void replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name, const QVariant &pixmap );
void clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel );
void setVegetation( int tileSet, const QString &vegetation );
QString getVegetation( int tileSet ) const;
bool hasError() const{ return m_hasError; }
QString getLastError() const{ return m_lastError; }

View file

@ -542,8 +542,7 @@ void TileEditorMainWindow::onChooseVegetation()
if( vegetSet.isEmpty() )
return;
TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() );
node->setVegetSet( vegetSet );
m_tileModel->setVegetation( idx.row(), vegetSet );
m_ui->chooseVegetPushButton->setText( vegetSet );
}
@ -560,8 +559,7 @@ void TileEditorMainWindow::onResetVegetation()
}
m_ui->chooseVegetPushButton->setText( "..." );
TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() );
node->setVegetSet( "" );
m_tileModel->setVegetation( idx.row(), "" );
}
void TileEditorMainWindow::onChooseTexturePath()
@ -860,9 +858,9 @@ void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, cons
if( newIndex.isValid() )
newNode = reinterpret_cast< TileSetNode* >( newIndex.internalPointer() );
if( newNode != NULL )
if( newIndex.isValid() )
{
QString vegetSet = newNode->vegetSet();
QString vegetSet = m_tileModel->getVegetation( newIndex.row() );
if( !vegetSet.isEmpty() )
m_ui->chooseVegetPushButton->setText( vegetSet );

View file

@ -396,6 +396,16 @@ void TileModel::clearImage( int ts, int type, int tile, TileConstants::TTileChan
m_tileBank->clearImage( ts, type, tile, channel );
}
void TileModel::setVegetation( int tileSet, const QString &vegetation )
{
m_tileBank->setVegetation( tileSet, vegetation );
}
QString TileModel::getVegetation( int tileSet ) const
{
return m_tileBank->getVegetation( tileSet );
}
QString TileModel::getLastError() const{
return m_tileBank->getLastError();
}

View file

@ -98,6 +98,9 @@ public:
bool replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name );
void clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel );
void setVegetation( int tileSet, const QString &vegetation );
QString getVegetation( int tileSet ) const;
QString getLastError() const;
bool hasError() const;