From 7912cbe7dc7ae3c61073af507537c01fb1410662 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 5 Aug 2014 03:35:10 +0200 Subject: [PATCH] Set all images by default. --- .../src/plugins/tile_editor/tile_item.cpp | 17 +++++---------- .../src/plugins/tile_editor/tile_item.h | 1 - .../src/plugins/tile_editor/tile_model.cpp | 21 ++++--------------- .../src/plugins/tile_editor/tile_model.h | 2 -- 4 files changed, 9 insertions(+), 32 deletions(-) diff --git a/code/studio/src/plugins/tile_editor/tile_item.cpp b/code/studio/src/plugins/tile_editor/tile_item.cpp index cba20ce2d..7d339b1db 100644 --- a/code/studio/src/plugins/tile_editor/tile_item.cpp +++ b/code/studio/src/plugins/tile_editor/tile_item.cpp @@ -300,24 +300,17 @@ private: TileConstants::TTileChannel TileItemNode::s_displayChannel = TileConstants::TileDiffuse; int TileItemNode::s_alphaRot = 0; -TileItemNode::TileItemNode( TileConstants::TNodeTileType type, int tileId, TileConstants::TTileChannel channel, QString filename, Node *parent) -{ - m_id = tileId; - m_parentItem = parent; - //nlinfo("dispalying tile %d - %s", m_tileId, m_tileFilename[TileModel::TileDiffuse].toAscii().data()); - - pvt = new TileItemNodePvt(); - m_hasError = false; - - setTileFilename( channel, filename ); -} - TileItemNode::TileItemNode( TileConstants::TNodeTileType type, int tileId, Node *parent ) { m_id = tileId; m_parentItem = parent; pvt = new TileItemNodePvt(); m_hasError = false; + + for( int i = 0; i < TileConstants::TileChannelCount; i++ ) + { + setTileFilename( TileConstants::TTileChannel( i ), "" ); + } } TileItemNode::~TileItemNode() diff --git a/code/studio/src/plugins/tile_editor/tile_item.h b/code/studio/src/plugins/tile_editor/tile_item.h index 08de0ec1f..85da09c4f 100644 --- a/code/studio/src/plugins/tile_editor/tile_item.h +++ b/code/studio/src/plugins/tile_editor/tile_item.h @@ -106,7 +106,6 @@ class TileItemNodePvt; class TileItemNode : public Node { public: - TileItemNode( TileConstants::TNodeTileType type, int tileId, TileConstants::TTileChannel channel, QString filename, Node *parent=0); TileItemNode( TileConstants::TNodeTileType type, int tileId, Node *parent=0); virtual ~TileItemNode(); QVariant data(int column, int role) const; diff --git a/code/studio/src/plugins/tile_editor/tile_model.cpp b/code/studio/src/plugins/tile_editor/tile_model.cpp index 14016024a..f4b9dfa15 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.cpp +++ b/code/studio/src/plugins/tile_editor/tile_model.cpp @@ -200,7 +200,7 @@ TileSetNode *TileModel::createTileSetNode(QString tileSetName) // TODO tie this to CTileSet::count from NeL for(int transPos=0; transPos<48; transPos++) { - TileItemNode *transTile= new TileItemNode( TileConstants::TileTransition, transPos, TileConstants::TileDiffuse, QString("empty")); + TileItemNode *transTile= new TileItemNode( TileConstants::TileTransition, transPos ); tileTrans->appendRow(transTile); } @@ -212,7 +212,7 @@ TileSetNode *TileModel::createTileSetNode(QString tileSetName) // TODO tie this to CTileSet::CountDisplace from NeL for(int dispPos=0; dispPos<16; dispPos++) { - TileItemNode *dispTile= new TileItemNode( TileConstants::TileDisplacement, dispPos, TileConstants::TileDiffuse, QString("empty")); + TileItemNode *dispTile= new TileItemNode( TileConstants::TileDisplacement, dispPos ); tileDisp->appendRow(dispTile); } @@ -222,20 +222,6 @@ TileSetNode *TileModel::createTileSetNode(QString tileSetName) return tileSet; } -TileItemNode *TileModel::createItemNode( int idx, TileConstants::TNodeTileType type, int id, TileConstants::TTileChannel channel, const QString &fileName ) -{ - TileItemNode *n = new TileItemNode( type, id, channel, fileName ); - - bool b = m_tileBank->addTile( idx, fileName, n->pixmap( channel ), channel, type ); - if( !b ) - { - delete n; - return NULL; - } - - return n; -} - const char *TileModel::getTileTypeName(TileConstants::TNodeTileType type) { switch(type) @@ -370,7 +356,8 @@ bool TileModel::addTile( int ts, int type, const QString &fileName, TileConstant TileConstants::TNodeTileType t = TileConstants::TNodeTileType( type ); - TileItemNode *item = new TileItemNode( t, tile, channel, fileName ); + TileItemNode *item = new TileItemNode( t, tile ); + item->setTileFilename( channel, fileName ); bool b = m_tileBank->addTile( ts, fileName, item->pixmap( channel ), channel, t ); if( !b ) diff --git a/code/studio/src/plugins/tile_editor/tile_model.h b/code/studio/src/plugins/tile_editor/tile_model.h index b0e3232b9..8a89076bb 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.h +++ b/code/studio/src/plugins/tile_editor/tile_model.h @@ -79,8 +79,6 @@ public: void swapRows( int a, int b ); - TileItemNode *createItemNode( int idx, TileConstants::TNodeTileType type, int id, TileConstants::TTileChannel channel, const QString &fileName ); - static const char *getTileTypeName(TileConstants::TNodeTileType type); static uint32 getTileTypeSize(TileConstants::TNodeTileType type);