Vegetation set stuff.
--HG-- branch : gsoc2014-dfighter
This commit is contained in:
parent
caf76f09c8
commit
688f6de090
5 changed files with 39 additions and 6 deletions
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ public:
|
||||||
bool setTile( int tileset, int tile, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type );
|
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 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 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; }
|
bool hasError() const{ return m_hasError; }
|
||||||
QString getLastError() const{ return m_lastError; }
|
QString getLastError() const{ return m_lastError; }
|
||||||
|
|
|
@ -542,8 +542,7 @@ void TileEditorMainWindow::onChooseVegetation()
|
||||||
if( vegetSet.isEmpty() )
|
if( vegetSet.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() );
|
m_tileModel->setVegetation( idx.row(), vegetSet );
|
||||||
node->setVegetSet( vegetSet );
|
|
||||||
|
|
||||||
m_ui->chooseVegetPushButton->setText( vegetSet );
|
m_ui->chooseVegetPushButton->setText( vegetSet );
|
||||||
}
|
}
|
||||||
|
@ -560,8 +559,7 @@ void TileEditorMainWindow::onResetVegetation()
|
||||||
}
|
}
|
||||||
m_ui->chooseVegetPushButton->setText( "..." );
|
m_ui->chooseVegetPushButton->setText( "..." );
|
||||||
|
|
||||||
TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() );
|
m_tileModel->setVegetation( idx.row(), "" );
|
||||||
node->setVegetSet( "" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileEditorMainWindow::onChooseTexturePath()
|
void TileEditorMainWindow::onChooseTexturePath()
|
||||||
|
@ -860,9 +858,9 @@ void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, cons
|
||||||
if( newIndex.isValid() )
|
if( newIndex.isValid() )
|
||||||
newNode = reinterpret_cast< TileSetNode* >( newIndex.internalPointer() );
|
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() )
|
if( !vegetSet.isEmpty() )
|
||||||
m_ui->chooseVegetPushButton->setText( vegetSet );
|
m_ui->chooseVegetPushButton->setText( vegetSet );
|
||||||
|
|
|
@ -396,6 +396,16 @@ void TileModel::clearImage( int ts, int type, int tile, TileConstants::TTileChan
|
||||||
m_tileBank->clearImage( ts, type, tile, channel );
|
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{
|
QString TileModel::getLastError() const{
|
||||||
return m_tileBank->getLastError();
|
return m_tileBank->getLastError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ public:
|
||||||
bool replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name );
|
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 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;
|
QString getLastError() const;
|
||||||
bool hasError() const;
|
bool hasError() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue