Surface data.

This commit is contained in:
dfighter1985 2014-08-04 21:53:22 +02:00
parent bcfcb5bb83
commit 716903fd5f
6 changed files with 53 additions and 0 deletions

View file

@ -430,3 +430,23 @@ bool TileBank::getOriented( int tileSet ) const
return set->getOriented();
}
void TileBank::setSurfaceData( int tileSet, unsigned long data )
{
NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet );
if( set == NULL )
return;
set->SurfaceData = data;
}
unsigned long TileBank::getSurfaceData( int tileSet ) const
{
NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet );
if( set == NULL )
return 0;
return set->SurfaceData;
}

View file

@ -35,6 +35,9 @@ public:
void setOriented( int tileSet, bool b );
bool getOriented( int tileSet ) const;
void setSurfaceData( int tileSet, unsigned long data );
unsigned long getSurfaceData( int tileSet ) const;
bool hasError() const{ return m_hasError; }
QString getLastError() const{ return m_lastError; }

View file

@ -183,6 +183,7 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
connect( m_ui->actionOpenTileBank, SIGNAL( triggered() ), this, SLOT( open() ) );
connect( m_ui->orientedCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onOrientedStateChanged( int ) ) );
connect( m_ui->surfaceDataLineEdit, SIGNAL( textEdited( const QString& ) ), this, SLOT( onSurfaceDataChanged( const QString& ) ) );
connect( m_ui->diffuse128BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) );
connect( m_ui->diffuse256BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) );
@ -598,6 +599,20 @@ void TileEditorMainWindow::onOrientedStateChanged( int state )
m_tileModel->setOriented( row, false );
}
void TileEditorMainWindow::onSurfaceDataChanged( const QString &text )
{
QModelIndex idx = m_ui->tileSetLV->currentIndex();
if( !idx.isValid() )
return;
bool ok = false;
unsigned long data = text.toUInt( &ok );
if( !ok )
return;
m_tileModel->setSurfaceData( idx.row(), data );
}
void TileEditorMainWindow::onDiffuseToggled( bool b )
{
if( !b )
@ -868,6 +883,7 @@ void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, cons
m_ui->chooseVegetPushButton->setText( "..." );
m_ui->orientedCheckBox->setChecked( m_tileModel->getOriented( newIndex.row() ) );
m_ui->surfaceDataLineEdit->setText( QString::number( m_tileModel->getSurfaceData( newIndex.row() ) ) );
}
else
{

View file

@ -68,6 +68,7 @@ private Q_SLOTS:
void onChooseTexturePath();
void onOrientedStateChanged( int state );
void onSurfaceDataChanged( const QString &text );
void onDiffuseToggled( bool b );
void onAdditiveToggled( bool b );

View file

@ -416,6 +416,16 @@ bool TileModel::getOriented( int tileSet ) const
return m_tileBank->getOriented( tileSet );
}
void TileModel::setSurfaceData( int tileSet, unsigned long data )
{
m_tileBank->setSurfaceData( tileSet, data );
}
unsigned long TileModel::getSurfaceData( int tileSet ) const
{
return m_tileBank->getSurfaceData( tileSet );
}
QString TileModel::getLastError() const{
return m_tileBank->getLastError();
}

View file

@ -104,6 +104,9 @@ public:
void setOriented( int tileSet, bool b );
bool getOriented( int tileSet ) const;
void setSurfaceData( int tileSet, unsigned long data );
unsigned long getSurfaceData( int tileSet ) const;
QString getLastError() const;
bool hasError() const;