Surface data.

--HG--
branch : gsoc2014-dfighter
hg/feature/cdb-packed
dfighter1985 10 years ago
parent 55c046252f
commit bdedd145e4

@ -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;
}

@ -36,6 +36,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; }
void resetError(){

@ -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
{

@ -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 );

@ -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();
}

@ -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;

Loading…
Cancel
Save