From 92e850d296155eded085a56c4fa1dbf762f61faf Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 4 Aug 2014 21:59:05 +0200 Subject: [PATCH] Texture path. --HG-- branch : gsoc2014-dfighter --- code/studio/src/plugins/tile_editor/tile_bank.cpp | 10 ++++++++++ code/studio/src/plugins/tile_editor/tile_bank.h | 3 +++ .../plugins/tile_editor/tile_editor_main_window.cpp | 2 +- code/studio/src/plugins/tile_editor/tile_model.cpp | 10 ++++++++++ code/studio/src/plugins/tile_editor/tile_model.h | 8 +++----- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/code/studio/src/plugins/tile_editor/tile_bank.cpp b/code/studio/src/plugins/tile_editor/tile_bank.cpp index 86c2646f9..a4dd3f358 100644 --- a/code/studio/src/plugins/tile_editor/tile_bank.cpp +++ b/code/studio/src/plugins/tile_editor/tile_bank.cpp @@ -449,4 +449,14 @@ unsigned long TileBank::getSurfaceData( int tileSet ) const return set->SurfaceData; } +void TileBank::setTexturePath( const QString &path ) +{ + m_pvt->m_bank.setAbsPath( path.toUtf8().constData() ); +} + +QString TileBank::getTexturePath() const +{ + return m_pvt->m_bank.getAbsPath().c_str(); +} + diff --git a/code/studio/src/plugins/tile_editor/tile_bank.h b/code/studio/src/plugins/tile_editor/tile_bank.h index dddafe032..c42546895 100644 --- a/code/studio/src/plugins/tile_editor/tile_bank.h +++ b/code/studio/src/plugins/tile_editor/tile_bank.h @@ -38,6 +38,9 @@ public: void setSurfaceData( int tileSet, unsigned long data ); unsigned long getSurfaceData( int tileSet ) const; + + void setTexturePath( const QString &path ); + QString getTexturePath() const; bool hasError() const{ return m_hasError; } QString getLastError() const{ return m_lastError; } diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index f673d75c4..e8f19cedc 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -816,7 +816,7 @@ void TileEditorMainWindow::onTileBankLoaded() m_ui->listView256->reset(); m_ui->listViewTransition->reset(); - QString path = m_tileModel->texturePath(); + QString path = m_tileModel->getTexturePath(); if( path.isEmpty() ) m_ui->tileBankTexturePathPB->setText( "..." ); else diff --git a/code/studio/src/plugins/tile_editor/tile_model.cpp b/code/studio/src/plugins/tile_editor/tile_model.cpp index e1d7019b4..e1249cb14 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.cpp +++ b/code/studio/src/plugins/tile_editor/tile_model.cpp @@ -426,6 +426,16 @@ unsigned long TileModel::getSurfaceData( int tileSet ) const return m_tileBank->getSurfaceData( tileSet ); } +void TileModel::setTexturePath( const QString &path ) +{ + m_tileBank->setTexturePath( path ); +} + +QString TileModel::getTexturePath() const +{ + return m_tileBank->getTexturePath(); +} + QString TileModel::getLastError() const{ return m_tileBank->getLastError(); } diff --git a/code/studio/src/plugins/tile_editor/tile_model.h b/code/studio/src/plugins/tile_editor/tile_model.h index daec140ea..96193fd38 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.h +++ b/code/studio/src/plugins/tile_editor/tile_model.h @@ -85,9 +85,6 @@ public: void clear(); - void setTexturePath( const QString &path ){ m_texturePath = path; } - QString texturePath() const{ return m_texturePath; } - void addLand( const QString &name ); void removeLand( int idx ); void removeTileSet( int idx ); @@ -107,6 +104,9 @@ public: void setSurfaceData( int tileSet, unsigned long data ); unsigned long getSurfaceData( int tileSet ) const; + void setTexturePath( const QString &path ); + QString getTexturePath() const; + QString getLastError() const; bool hasError() const; @@ -125,8 +125,6 @@ private: //int m_activeEditChannel; Node *rootItem; - QString m_texturePath; - TileBank *m_tileBank; };