renaming OnWorldChanged to OnLevelChanged and invoking callback

This commit is contained in:
SweetId 2023-10-11 23:34:09 -04:00
parent 46fe2d296b
commit 7e01282973
3 changed files with 8 additions and 3 deletions

View File

@ -18,7 +18,7 @@ namespace Nz
: public Nz::Application<Nz::Graphics, Nz::Imgui, Nz::EditorCore> : public Nz::Application<Nz::Graphics, Nz::Imgui, Nz::EditorCore>
{ {
public: public:
NazaraSignal(OnWorldChanged, Nz::Level&); NazaraSignal(OnLevelChanged, Nz::Level&);
// Entity lifetime events // Entity lifetime events
NazaraSignal(OnEntityCreated, entt::handle); NazaraSignal(OnEntityCreated, entt::handle);

View File

@ -61,6 +61,11 @@ namespace Nz
bool EditorBaseApplication::NewLevel() bool EditorBaseApplication::NewLevel()
{ {
return m_level.CreateNewLevel(); bool bRes = m_level.CreateNewLevel();
if (bRes)
{
OnLevelChanged(m_level);
}
return bRes;
} }
} }

View File

@ -9,7 +9,7 @@ namespace NzEditor
, m_currentLevel(app->GetLevel()) , m_currentLevel(app->GetLevel())
, m_dirty(true) , 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->OnEntityCreated.Connect([this](entt::handle) { m_dirty = true; });
app->OnEntityDestroyed.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; }); app->OnEntityParentChanged.Connect([this](entt::handle) { m_dirty = true; });