diff --git a/src/Editor/ModelEditor/CModelEditorViewport.cpp b/src/Editor/ModelEditor/CModelEditorViewport.cpp
index d3c965b9..f782007c 100644
--- a/src/Editor/ModelEditor/CModelEditorViewport.cpp
+++ b/src/Editor/ModelEditor/CModelEditorViewport.cpp
@@ -5,7 +5,8 @@ CModelEditorViewport::CModelEditorViewport(QWidget *pParent)
: CBasicViewport(pParent),
mMode(eDrawMesh),
mpActiveMaterial(nullptr),
- mpModelNode(nullptr)
+ mpModelNode(nullptr),
+ mGridEnabled(true)
{
mpRenderer = new CRenderer();
mpRenderer->SetViewportSize(width(), height());
@@ -42,17 +43,27 @@ void CModelEditorViewport::SetClearColor(CColor color)
mpRenderer->SetClearColor(color);
}
+void CModelEditorViewport::SetGridEnabled(bool Enable)
+{
+ mGridEnabled = Enable;
+}
+
void CModelEditorViewport::Paint()
{
mpRenderer->BeginFrame();
mCamera.LoadMatrices();
if (!mpModelNode->Model())
- CDrawUtil::DrawGrid();
+ {
+ if (mGridEnabled)
+ CDrawUtil::DrawGrid();
+ }
else if (mMode == eDrawMesh)
{
- CDrawUtil::DrawGrid();
+ if (mGridEnabled)
+ CDrawUtil::DrawGrid();
+
mpModelNode->AddToRenderer(mpRenderer, mViewInfo);
mpRenderer->RenderBuckets(mViewInfo);
}
diff --git a/src/Editor/ModelEditor/CModelEditorViewport.h b/src/Editor/ModelEditor/CModelEditorViewport.h
index bebdaad7..bef4dd33 100644
--- a/src/Editor/ModelEditor/CModelEditorViewport.h
+++ b/src/Editor/ModelEditor/CModelEditorViewport.h
@@ -16,6 +16,7 @@ private:
CModelNode *mpModelNode;
CMaterial *mpActiveMaterial;
CRenderer *mpRenderer;
+ bool mGridEnabled;
public:
CModelEditorViewport(QWidget *pParent = 0);
@@ -24,6 +25,7 @@ public:
void SetActiveMaterial(CMaterial *pMat);
void SetDrawMode(EDrawMode mode);
void SetClearColor(CColor color);
+ void SetGridEnabled(bool Enable);
void Paint();
void OnResize();
};
diff --git a/src/Editor/ModelEditor/CModelEditorWindow.cpp b/src/Editor/ModelEditor/CModelEditorWindow.cpp
index 9e5433d7..019938c8 100644
--- a/src/Editor/ModelEditor/CModelEditorWindow.cpp
+++ b/src/Editor/ModelEditor/CModelEditorWindow.cpp
@@ -884,3 +884,8 @@ void CModelEditorWindow::on_actionConvert_DDS_to_TXTR_triggered()
}
}
}
+
+void CModelEditorWindow::on_ToggleGridButton_toggled(bool checked)
+{
+ ui->Viewport->SetGridEnabled(checked);
+}
diff --git a/src/Editor/ModelEditor/CModelEditorWindow.h b/src/Editor/ModelEditor/CModelEditorWindow.h
index 681bb861..890d7151 100644
--- a/src/Editor/ModelEditor/CModelEditorWindow.h
+++ b/src/Editor/ModelEditor/CModelEditorWindow.h
@@ -119,6 +119,8 @@ private slots:
void on_actionConvert_DDS_to_TXTR_triggered();
+ void on_ToggleGridButton_toggled(bool checked);
+
signals:
void Closed();
};
diff --git a/src/Editor/ModelEditor/CModelEditorWindow.ui b/src/Editor/ModelEditor/CModelEditorWindow.ui
index 21ce7c65..a611f842 100644
--- a/src/Editor/ModelEditor/CModelEditorWindow.ui
+++ b/src/Editor/ModelEditor/CModelEditorWindow.ui
@@ -2140,7 +2140,7 @@
-
-
+
50
@@ -2167,7 +2167,7 @@
-
-
+
Grid
@@ -2195,38 +2195,6 @@
- -
-
-
- Selection Tint
-
-
- border: none;
-
-
-
-
-
-
- :/icons/Highlight.png:/icons/Highlight.png
-
-
-
- 32
- 32
-
-
-
- true
-
-
- true
-
-
- true
-
-
-
-
@@ -2418,6 +2386,19 @@
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
-
-
-
-
-
- toolBar
-
-
- TopToolBarArea
-
-
- false
-
-
-