From 2b9acc677ff2d9b35451d839aaa094a226ec1622 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Fri, 25 Apr 2025 08:08:52 -0600 Subject: [PATCH] Disable Editor when its disabled --- src/engine/editor/Editor.cpp | 11 +++++++++++ src/engine/editor/Editor.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/engine/editor/Editor.cpp b/src/engine/editor/Editor.cpp index d0093d035..446da7487 100644 --- a/src/engine/editor/Editor.cpp +++ b/src/engine/editor/Editor.cpp @@ -41,6 +41,14 @@ namespace Editor { } void Editor::Tick() { + + if (CVarGetInteger("gEditorEnabled", 0) == true) { + bEditorEnabled = true; + } else { + bEditorEnabled = false; + return; + } + auto wnd = GameEngine::Instance->context->GetWindow(); static bool wasMouseDown = false; @@ -94,6 +102,9 @@ namespace Editor { } void Editor::Draw() { + if (!bEditorEnabled) { + return; + } eObjectPicker.Draw(); for (auto& object : eGameObjects) { object->Draw(); diff --git a/src/engine/editor/Editor.h b/src/engine/editor/Editor.h index e3b74b5fc..759c59355 100644 --- a/src/engine/editor/Editor.h +++ b/src/engine/editor/Editor.h @@ -29,6 +29,7 @@ public: void SetLevelDimensions(s16 minX, s16 maxX, s16 minZ, s16 maxZ, s16 minY, s16 maxY); void ClearMatrixPool(); void DeleteObject(); + bool bEditorEnabled = false; private: bool _draw = false;