diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp
index 62feaec48..a97dcf380 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp
@@ -56,7 +56,7 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
m_ui.setupUi(this);
m_undoStack = new QUndoStack(this);
- m_landscapeScene = new LandscapeScene(this);
+ m_landscapeScene = new LandscapeScene(160, this);
m_zoneBuilder = new ZoneBuilder(m_landscapeScene, m_ui.zoneListWidget, m_undoStack);
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
@@ -69,6 +69,9 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
m_ui.saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
m_ui.saveLandAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
m_ui.saveAsLandAction->setIcon(QIcon(Core::Constants::ICON_SAVE_AS));
+ m_ui.zonesDockWidget->toggleViewAction()->setIcon(QIcon(Constants::ICON_LANDSCAPE_ZONES));
+ m_ui.landscapesDockWidget->toggleViewAction()->setIcon(QIcon(Constants::ICON_ZONE_ITEM));
+
m_ui.deleteLandAction->setEnabled(false);
createMenus();
@@ -85,6 +88,7 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
connect(m_ui.saveLandAction, SIGNAL(triggered()), this, SLOT(saveSelectedLand()));
connect(m_ui.saveAsLandAction, SIGNAL(triggered()), this, SLOT(saveAsSelectedLand()));
connect(m_ui.deleteLandAction, SIGNAL(triggered()), this, SLOT(deleteSelectedLand()));
+ connect(m_ui.transitionModeAction, SIGNAL(toggled(bool)), m_landscapeScene, SLOT(setTransitionMode(bool)));
connect(m_ui.landscapesListWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenu()));
m_ui.landscapesListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -353,23 +357,27 @@ void LandscapeEditorWindow::createToolBars()
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
//QAction *action = menuManager->action(Core::Constants::NEW);
//m_ui.fileToolBar->addAction(action);
- QAction *action = menuManager->action(Core::Constants::OPEN);
- m_ui.fileToolBar->addAction(m_ui.newLandAction);
- m_ui.fileToolBar->addAction(action);
- m_ui.fileToolBar->addAction(m_ui.saveAction);
-
- action = menuManager->action(Core::Constants::UNDO);
- if (action != 0)
- m_ui.undoToolBar->addAction(action);
-
- action = menuManager->action(Core::Constants::REDO);
- if (action != 0)
- m_ui.undoToolBar->addAction(action);
-
//action = menuManager->action(Core::Constants::SAVE);
//m_ui.fileToolBar->addAction(action);
//action = menuManager->action(Core::Constants::SAVE_AS);
//m_ui.fileToolBar->addAction(action);
+
+ QAction *action = menuManager->action(Core::Constants::OPEN);
+ m_ui.fileToolBar->addAction(m_ui.newLandAction);
+ m_ui.fileToolBar->addAction(action);
+ m_ui.fileToolBar->addAction(m_ui.saveAction);
+ m_ui.fileToolBar->addSeparator();
+
+ action = menuManager->action(Core::Constants::UNDO);
+ if (action != 0)
+ m_ui.fileToolBar->addAction(action);
+
+ action = menuManager->action(Core::Constants::REDO);
+ if (action != 0)
+ m_ui.fileToolBar->addAction(action);
+
+ m_ui.zoneToolBar->insertAction(m_ui.enableGridAction, m_ui.landscapesDockWidget->toggleViewAction());
+ m_ui.zoneToolBar->insertAction(m_ui.enableGridAction, m_ui.zonesDockWidget->toggleViewAction());
}
void LandscapeEditorWindow::readSettings()
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui
index b2db9dc42..77133c593 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui
@@ -31,8 +31,8 @@
0.000000000000000
0.000000000000000
- 99999.000000000000000
- 99999.000000000000000
+ 0.000000000000000
+ 0.000000000000000
@@ -65,7 +65,11 @@
false
-
+
+
+
+ :/icons/ic_nel_zones.png:/icons/ic_nel_zones.png
+
Zones
@@ -74,18 +78,11 @@
-
-
- toolBar_2
-
-
- TopToolBarArea
-
-
- false
-
-
+
+
+ :/icons/ic_nel_zone.png:/icons/ic_nel_zone.png
+
Landscapes
@@ -116,9 +113,10 @@
false
+
+
-
@@ -136,6 +134,10 @@
true
+
+
+ :/icons/ic_grid.png:/icons/ic_grid.png
+
EnableGrid
@@ -147,6 +149,10 @@
+
+
+ :/icons/ic_snapshot.png:/icons/ic_snapshot.png
+
snapshot
@@ -200,6 +206,22 @@
Create new landscape
+
+
+ true
+
+
+
+ :/icons/ic_nel_landscape_item.png
+ :/icons/ic_nel_transition_land.png:/icons/ic_nel_landscape_item.png
+
+
+ Transition mode
+
+
+ Enable transition mode
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp
index 40074292d..263417204 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp
@@ -59,9 +59,7 @@ bool LandscapeView::isVisibleGrid() const
void LandscapeView::setVisibleGrid(bool visible)
{
m_visibleGrid = visible;
-
- // hack for repaint view
- translate(0.0001, 0.0001);
+ scene()->update();
}
void LandscapeView::wheelEvent(QWheelEvent *event)
@@ -117,45 +115,55 @@ void LandscapeView::drawForeground(QPainter *painter, const QRectF &rect)
if (!m_visibleGrid)
return;
- qreal scaleFactor = transform().m11();
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
+ drawGrid(painter, rect);
- // draw grid
- qreal left = m_cellSize * floor(rect.left() / m_cellSize);
- qreal top = m_cellSize * floor(rect.top() / m_cellSize);
-
- // draw vertical lines
- while (left < rect.right())
- {
- painter->drawLine(int(left), int(rect.bottom()), int(left), int(rect.top()));
- left += m_cellSize;
- }
-
- // draw horizontal lines
- while (top < rect.bottom())
- {
- painter->drawLine(int(rect.left()), int(top), int(rect.right()), int(top));
- top += m_cellSize;
- }
-
- // Render text (slow!)
if (m_numSteps > -m_maxSteps / 4)
{
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
-
//painter->setFont(QFont("Helvetica [Cronyx]", 12));
- int leftSide = int(floor(rect.left() / m_cellSize));
- int rightSide = int(floor(rect.right() / m_cellSize));
- int topSide = int(floor(rect.top() / m_cellSize));
- int bottomSide = int(floor(rect.bottom() / m_cellSize));
+ drawZoneNames(painter, rect);
+ }
+}
- for (int i = leftSide; i < rightSide + 1; ++i)
+void LandscapeView::drawGrid(QPainter *painter, const QRectF &rect)
+{
+ qreal left = m_cellSize * floor(rect.left() / m_cellSize);
+ qreal top = m_cellSize * floor(rect.top() / m_cellSize);
+
+ QVector lines;
+
+ // Calculate vertical lines
+ while (left < rect.right())
+ {
+ lines.push_back(QLine(int(left), int(rect.bottom()), int(left), int(rect.top())));
+ left += m_cellSize;
+ }
+
+ // Calculate horizontal lines
+ while (top < rect.bottom())
+ {
+ lines.push_back(QLine(int(rect.left()), int(top), int(rect.right()), int(top)));
+ top += m_cellSize;
+ }
+
+ // Draw lines
+ painter->drawLines(lines);
+}
+
+void LandscapeView::drawZoneNames(QPainter *painter, const QRectF &rect)
+{
+ int leftSide = int(floor(rect.left() / m_cellSize));
+ int rightSide = int(floor(rect.right() / m_cellSize));
+ int topSide = int(floor(rect.top() / m_cellSize));
+ int bottomSide = int(floor(rect.bottom() / m_cellSize));
+
+ for (int i = leftSide; i < rightSide + 1; ++i)
+ {
+ for (int j = topSide; j < bottomSide + 1; ++j)
{
- for (int j = topSide; j < bottomSide + 1; ++j)
- {
- QString text = QString("%1_%2%3").arg(j).arg(QChar('A' + (i / 26))).arg(QChar('A' + (i % 26)));
- painter->drawText(i * m_cellSize + 5, j * m_cellSize + 15, text);
- }
+ QString text = QString("%1_%2%3").arg(j).arg(QChar('A' + (i / 26))).arg(QChar('A' + (i % 26)));
+ painter->drawText(i * m_cellSize + 5, j * m_cellSize + 15, text);
}
}
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h
index 2ae251fee..0673db82c 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h
@@ -49,6 +49,8 @@ protected:
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void drawForeground(QPainter *painter, const QRectF &rect);
+ void drawGrid(QPainter *painter, const QRectF &rect);
+ void drawZoneNames(QPainter *painter, const QRectF &rect);
private:
bool m_visibleGrid;
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui
index 1c25a2ace..66f657012 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui
@@ -13,6 +13,10 @@
Snapshot
+
+
+ :/icons/ic_snapshot.png:/icons/ic_snapshot.png
+
-
@@ -136,7 +140,9 @@
keepRatioCheckBox
buttonBox
-
+
+
+
buttonBox