From 41914362d520371c3908ed2eb1eb0710ffbe51a6 Mon Sep 17 00:00:00 2001 From: Anthony Rabine Date: Fri, 17 Oct 2025 10:17:11 +0200 Subject: [PATCH] viariables not clear before project load --- core/story-manager/src/story_project.cpp | 1 + story-editor/src/app/app_controller.cpp | 2 +- story-editor/src/windows/variables_window.cpp | 4 ++-- story-editor/src/windows/variables_window.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/story-manager/src/story_project.cpp b/core/story-manager/src/story_project.cpp index decb4a5..cea15a9 100644 --- a/core/story-manager/src/story_project.cpp +++ b/core/story-manager/src/story_project.cpp @@ -511,6 +511,7 @@ bool StoryProject::Load(ResourceManager &manager, NodesFactory &factory) nlohmann::json j = nlohmann::json::parse(f); manager.Clear(); + m_variables.clear(); if (ParseStoryInformation(j)) { diff --git a/story-editor/src/app/app_controller.cpp b/story-editor/src/app/app_controller.cpp index 7777d07..501926d 100644 --- a/story-editor/src/app/app_controller.cpp +++ b/story-editor/src/app/app_controller.cpp @@ -764,7 +764,7 @@ void AppController::CloseProject() m_dbg.run_result = VM_FINISHED; m_dbg.free_run = false; m_dbg.m_breakpoints.clear(); - + m_resources.Clear(); // Clear loaded resources m_eventQueue.clear(); // Clear any pending VM events diff --git a/story-editor/src/windows/variables_window.cpp b/story-editor/src/windows/variables_window.cpp index 7cb22b0..6eaa7f6 100644 --- a/story-editor/src/windows/variables_window.cpp +++ b/story-editor/src/windows/variables_window.cpp @@ -28,7 +28,7 @@ int64_t FloatToScaled(float floatValue, int scalePower) { } -void VariablesWindow::ShowRAMEditor(std::shared_ptr story) +void VariablesWindow::DrawVariableEditor(std::shared_ptr story) { if (ImGui::Button("Add variable")) { @@ -114,7 +114,7 @@ void VariablesWindow::Draw(std::shared_ptr story) if (story) { - ShowRAMEditor(story); + DrawVariableEditor(story); } WindowBase::EndDraw(); diff --git a/story-editor/src/windows/variables_window.h b/story-editor/src/windows/variables_window.h index 89d3150..4dc19cf 100644 --- a/story-editor/src/windows/variables_window.h +++ b/story-editor/src/windows/variables_window.h @@ -14,6 +14,6 @@ public: void Draw(std::shared_ptr story); private: - void ShowRAMEditor(std::shared_ptr story); + void DrawVariableEditor(std::shared_ptr story); };