From ceb8f7997d95d9a3cd9a9fc8a3f99a85b94d3ac1 Mon Sep 17 00:00:00 2001 From: sfb Date: Fri, 9 Dec 2011 07:03:33 -0600 Subject: [PATCH] Changed: #1409 Made the tile set and tile type tabs connect. Added the context menu to each tab. --- .../tile_editor/tile_editor_main_window.cpp | 46 +++++++++++++++---- .../tile_editor/tile_editor_main_window.ui | 28 +++++++++-- .../src/plugins/tile_editor/tile_item.cpp | 8 +--- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp index afeaadb1d..48e8ff36f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -87,6 +87,27 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) m_ui->listView128->addAction(m_ui->actionDeleteTile); m_ui->listView128->addAction(m_ui->actionReplaceImage); m_ui->listView128->addAction(m_ui->actionDeleteImage); + + // 256x256 List View + m_ui->listView256->setModel(m_model); + m_ui->listView256->addAction(m_ui->actionAddTile); + m_ui->listView256->addAction(m_ui->actionDeleteTile); + m_ui->listView256->addAction(m_ui->actionReplaceImage); + m_ui->listView256->addAction(m_ui->actionDeleteImage); + + // Transition List View + m_ui->listViewTransition->setModel(m_model); + //m_ui->listViewTransition->addAction(m_ui->actionAddTile); + //m_ui->listViewTransition->addAction(m_ui->actionDeleteTile); + m_ui->listViewTransition->addAction(m_ui->actionReplaceImage); + m_ui->listViewTransition->addAction(m_ui->actionDeleteImage); + + // Displacement List View + m_ui->listViewDisplacement->setModel(m_model); + //m_ui->listViewDisplacement->addAction(m_ui->actionAddTile); + //m_ui->listViewDisplacement->addAction(m_ui->actionDeleteTile); + m_ui->listViewDisplacement->addAction(m_ui->actionReplaceImage); + m_ui->listViewDisplacement->addAction(m_ui->actionDeleteImage); // Connect context menu actions up. connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool))); @@ -174,7 +195,7 @@ void TileEditorMainWindow::onTileSetAdd() // Add the default transition tiles. // TODO tie this to CTileSet::count from NeL - for(int transPos=0; transPos < 48; transPos++) + for(int transPos=0; transPos<48; transPos++) { QVector tileInfo; tileInfo.push_back(QString("filename").append(QString::number(transPos+1))); @@ -187,6 +208,16 @@ void TileEditorMainWindow::onTileSetAdd() tilesDisp.push_back(QString("Displacement")); TileTypeTileItem *tileDisp= new TileTypeTileItem(tilesDisp); + // Add the default displacement tiles. + // TODO tie this to CTileSet::CountDisplace from NeL + for(int dispPos=0; dispPos<16; dispPos++) + { + QVector tileInfo; + tileInfo.push_back(QString("filename").append(QString::number(dispPos+1))); + TileItem *dispTile= new TileItem(tileInfo); + tileDisp->appendRow(dispTile); + } + // Append them in the correct order to the tile set. tileSet->appendRow(tile128); tileSet->appendRow(tile256); @@ -216,16 +247,13 @@ void TileEditorMainWindow::onActionAddTile(int tabId) void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex) { - - QModelIndex tile128Idx = newIndex.child(0,0); - QModelIndex tile256Idx = newIndex.child(1,0); - QModelIndex tileTransIdx = newIndex.child(2,0); - QModelIndex tileDispIdx = newIndex.child(3,0); + QModelIndex &tile128Idx = newIndex.child(0,0); + QModelIndex &tile256Idx = newIndex.child(1,0); + QModelIndex &tileTransIdx = newIndex.child(2,0); + QModelIndex &tileDispIdx = newIndex.child(3,0); - - m_ui->listView128->setRootIndex(newIndex); + m_ui->listView128->setRootIndex(tile128Idx); m_ui->listView256->setRootIndex(tile256Idx); m_ui->listViewTransition->setRootIndex(tileTransIdx); m_ui->listViewDisplacement->setRootIndex(tileDispIdx); -// m_ui->listView128->setModelColumn } \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui index d9b8d7116..5897d29be 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui @@ -18,7 +18,7 @@ - 0 + 2 @@ -66,7 +66,11 @@ - + + + Qt::ActionsContextMenu + + @@ -105,7 +109,17 @@ - + + + Qt::ActionsContextMenu + + + QListView::LeftToRight + + + QListView::Batched + + @@ -148,7 +162,11 @@ - + + + Qt::ActionsContextMenu + + @@ -468,7 +486,7 @@ - + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp index ee255755b..5758b9280 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp @@ -36,6 +36,7 @@ void TileItem::appendChild(TileItem *item) TileItem *TileItem::child(int row) { + //nlinfo("row %d and size %d", row, childItems.size()); return childItems.value(row); } @@ -136,16 +137,9 @@ void TileItem::appendRow(const QList &items) void TileItem::appendRow(TileItem *item) { - nlinfo("number of children: %d", childItems.size()); item->setParent(this); childItems.append(item); - nlinfo("number of children: %d", childItems.size()); } -//QImage *TileItem::getTileImageFromChannel(int channel) -//{ -// return m_tileChannels[channel]; -//} - ///////////////////////////////////////////////////