From 7e01282973bea46b8bdc88104f437b1f46253212 Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:34:09 -0400 Subject: [PATCH] renaming OnWorldChanged to OnLevelChanged and invoking callback --- include/NazaraEditor/Core/Application/BaseApplication.hpp | 2 +- src/NazaraEditor/Core/Application/BaseApplication.cpp | 7 ++++++- src/NazaraEditor/Editor/UI/LevelWindow.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/NazaraEditor/Core/Application/BaseApplication.hpp b/include/NazaraEditor/Core/Application/BaseApplication.hpp index eaa15e8..49b4e36 100644 --- a/include/NazaraEditor/Core/Application/BaseApplication.hpp +++ b/include/NazaraEditor/Core/Application/BaseApplication.hpp @@ -18,7 +18,7 @@ namespace Nz : public Nz::Application { public: - NazaraSignal(OnWorldChanged, Nz::Level&); + NazaraSignal(OnLevelChanged, Nz::Level&); // Entity lifetime events NazaraSignal(OnEntityCreated, entt::handle); diff --git a/src/NazaraEditor/Core/Application/BaseApplication.cpp b/src/NazaraEditor/Core/Application/BaseApplication.cpp index dc41d78..dab2efd 100644 --- a/src/NazaraEditor/Core/Application/BaseApplication.cpp +++ b/src/NazaraEditor/Core/Application/BaseApplication.cpp @@ -61,6 +61,11 @@ namespace Nz bool EditorBaseApplication::NewLevel() { - return m_level.CreateNewLevel(); + bool bRes = m_level.CreateNewLevel(); + if (bRes) + { + OnLevelChanged(m_level); + } + return bRes; } } \ No newline at end of file diff --git a/src/NazaraEditor/Editor/UI/LevelWindow.cpp b/src/NazaraEditor/Editor/UI/LevelWindow.cpp index 5bb33df..dca33a8 100644 --- a/src/NazaraEditor/Editor/UI/LevelWindow.cpp +++ b/src/NazaraEditor/Editor/UI/LevelWindow.cpp @@ -9,7 +9,7 @@ namespace NzEditor , m_currentLevel(app->GetLevel()) , m_dirty(true) { - app->OnWorldChanged.Connect([this](Nz::Level&) { m_dirty = true; }); + app->OnLevelChanged.Connect([this](Nz::Level&) { m_dirty = true; }); app->OnEntityCreated.Connect([this](entt::handle) { m_dirty = true; }); app->OnEntityDestroyed.Connect([this](entt::handle) { m_dirty = true; }); app->OnEntityParentChanged.Connect([this](entt::handle) { m_dirty = true; });