viariables not clear before project load

This commit is contained in:
Anthony Rabine 2025-10-17 10:17:11 +02:00
parent a308714302
commit 41914362d5
4 changed files with 5 additions and 4 deletions

View file

@ -511,6 +511,7 @@ bool StoryProject::Load(ResourceManager &manager, NodesFactory &factory)
nlohmann::json j = nlohmann::json::parse(f); nlohmann::json j = nlohmann::json::parse(f);
manager.Clear(); manager.Clear();
m_variables.clear();
if (ParseStoryInformation(j)) if (ParseStoryInformation(j))
{ {

View file

@ -764,7 +764,7 @@ void AppController::CloseProject()
m_dbg.run_result = VM_FINISHED; m_dbg.run_result = VM_FINISHED;
m_dbg.free_run = false; m_dbg.free_run = false;
m_dbg.m_breakpoints.clear(); m_dbg.m_breakpoints.clear();
m_resources.Clear(); // Clear loaded resources m_resources.Clear(); // Clear loaded resources
m_eventQueue.clear(); // Clear any pending VM events m_eventQueue.clear(); // Clear any pending VM events

View file

@ -28,7 +28,7 @@ int64_t FloatToScaled(float floatValue, int scalePower) {
} }
void VariablesWindow::ShowRAMEditor(std::shared_ptr<IStoryProject> story) void VariablesWindow::DrawVariableEditor(std::shared_ptr<IStoryProject> story)
{ {
if (ImGui::Button("Add variable")) { if (ImGui::Button("Add variable")) {
@ -114,7 +114,7 @@ void VariablesWindow::Draw(std::shared_ptr<IStoryProject> story)
if (story) if (story)
{ {
ShowRAMEditor(story); DrawVariableEditor(story);
} }
WindowBase::EndDraw(); WindowBase::EndDraw();

View file

@ -14,6 +14,6 @@ public:
void Draw(std::shared_ptr<IStoryProject> story); void Draw(std::shared_ptr<IStoryProject> story);
private: private:
void ShowRAMEditor(std::shared_ptr<IStoryProject> story); void DrawVariableEditor(std::shared_ptr<IStoryProject> story);
}; };