From d2fac4d79eb9a391b19906b1d1a3b0103be1a691 Mon Sep 17 00:00:00 2001 From: "anthony@rabine.fr" Date: Mon, 28 Jul 2025 20:39:04 +0200 Subject: [PATCH] Fix open exiting module --- core/story-manager/lib/nodes_factory.h | 6 +++++- story-editor/src/main_window.cpp | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/story-manager/lib/nodes_factory.h b/core/story-manager/lib/nodes_factory.h index f094966..f73ce29 100644 --- a/core/story-manager/lib/nodes_factory.h +++ b/core/story-manager/lib/nodes_factory.h @@ -158,16 +158,20 @@ public: if (entry.is_directory()) { std::cout << "Scanning directory: " << entry.path() << std::endl; + auto uuid = entry.path().filename().string(); for (const auto& subEntry : std::filesystem::directory_iterator(entry.path())) { if (subEntry.is_regular_file() && subEntry.path().extension() == ".json") { std::cout << "Found module file: " << subEntry.path() << std::endl; + + auto p = std::make_shared(m_log); + + p->SetPaths(uuid, m_rootPath); // Load the JSON file and register a node based on its content std::ifstream file(subEntry.path()); nlohmann::json j; file >> j; - auto p = std::make_shared(m_log); p->ParseStoryInformation(j); if (p->IsModule()) { diff --git a/story-editor/src/main_window.cpp b/story-editor/src/main_window.cpp index 18c396d..55a1107 100644 --- a/story-editor/src/main_window.cpp +++ b/story-editor/src/main_window.cpp @@ -909,18 +909,15 @@ void MainWindow::OpenModule(const std::string &uuid) { Log("Open module success"); m_moduleEditorWindow.Load(m_module); + m_moduleEditorWindow.Enable(); } else { Log("Open module error"); } - - - m_moduleEditorWindow.Enable(); } - void MainWindow::CloseProject() { // FIXME: not sure but if present, we lost some information in the library manager