Save and load the tilebank texture path.

--HG--
branch : gsoc2014-dfighter
hg/feature/cdb-packed
dfighter1985 10 years ago
parent 0f5e475d1c
commit 3e2addc057

@ -584,6 +584,7 @@ void TileEditorMainWindow::onChooseTexturePath()
m_texturePath = path; m_texturePath = path;
m_ui->tileBankTexturePathPB->setText( path ); m_ui->tileBankTexturePathPB->setText( path );
m_tileModel->setTexturePath( path );
} }
void TileEditorMainWindow::onOrientedStateChanged( int state ) void TileEditorMainWindow::onOrientedStateChanged( int state )
@ -742,6 +743,12 @@ void TileEditorMainWindow::onTileBankLoaded()
m_ui->listView128->reset(); m_ui->listView128->reset();
m_ui->listView256->reset(); m_ui->listView256->reset();
m_ui->listViewTransition->reset(); m_ui->listViewTransition->reset();
QString path = m_tileModel->texturePath();
if( path.isEmpty() )
m_ui->tileBankTexturePathPB->setText( "..." );
else
m_ui->tileBankTexturePathPB->setText( path );
} }
TileModel* TileEditorMainWindow::createTileModel() TileModel* TileEditorMainWindow::createTileModel()

@ -95,6 +95,9 @@ public:
void clear(); void clear();
void setTexturePath( const QString &path ){ m_texturePath = path; }
QString texturePath() const{ return m_texturePath; }
public Q_SLOTS: public Q_SLOTS:
void selectFilenameDisplay(bool selected); void selectFilenameDisplay(bool selected);
void selectIndexDisplay(bool selected); void selectIndexDisplay(bool selected);
@ -109,6 +112,8 @@ private:
//QList<TileItem*> m_tiles; //QList<TileItem*> m_tiles;
//int m_activeEditChannel; //int m_activeEditChannel;
Node *rootItem; Node *rootItem;
QString m_texturePath;
}; };
#endif // TILE_MODEL_H #endif // TILE_MODEL_H

@ -166,5 +166,7 @@ bool TileBankLoader::load( const char *filename, TileModel *model, QList< Land >
p->loadLands( lands ); p->loadLands( lands );
p->loadTileSets( model ); p->loadTileSets( model );
model->setTexturePath( p->bank.getAbsPath().c_str() );
return false; return false;
} }

@ -223,6 +223,8 @@ bool TileBankSaver::save( const char *fileName, const TileModel* model, const QL
p->addLands( lands ); p->addLands( lands );
p->addTileSets( model, lands ); p->addTileSets( model, lands );
p->bank.setAbsPath( model->texturePath().toUtf8().constData() );
// Save to file // Save to file
NLMISC::COFile f; NLMISC::COFile f;
bool b = f.open( fileName, false, false, false ); bool b = f.open( fileName, false, false, false );

Loading…
Cancel
Save