diff --git a/editor/editor_system.cpp b/editor/editor_system.cpp index b835f0d1e..25eb19a99 100644 --- a/editor/editor_system.cpp +++ b/editor/editor_system.cpp @@ -318,7 +318,10 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds) ImGui::Separator(); if (ImGui::BeginMenu("Create Scene")) { + SceneID inputBaseID = 0; ImGui::InputText("Scene Name", &newSceneName, ImGuiInputTextFlags_AlwaysInsertMode); + ImGui::InputScalar("Scene BaseID", ImGuiDataType_U32, &inputBaseID); + Scene::SetBaseID(inputBaseID); if (!newSceneName.empty() && ImGui::Button("Create") && !Scene::isReservedName(newSceneName)) { if (SceneLoader::GetSingleton()->getCurrentScene()) @@ -985,8 +988,7 @@ int EditorSystem::exportScene(const String& sceneName, const String& sceneFilePa { return; } - m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second); - })); + m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second); })); } /// TODO: Fix the need for this dummy task (blocks the main thread while tasks are running) diff --git a/rootex/framework/scene.cpp b/rootex/framework/scene.cpp index 04688f1f5..e787733de 100644 --- a/rootex/framework/scene.cpp +++ b/rootex/framework/scene.cpp @@ -7,8 +7,9 @@ #include "components/visual/camera_component.h" #include "components/audio/audio_listener_component.h" -static SceneID NextSceneID = ROOT_SCENE_ID + 1; Vector Scene::s_Scenes; +SceneID Scene::BaseID; +static SceneID NextSceneID = ROOT_SCENE_ID + 1; void to_json(JSON::json& j, const SceneSettings& s) { @@ -50,6 +51,13 @@ void Scene::ResetNextID() NextSceneID = ROOT_SCENE_ID + 1; } +void Scene::SetBaseID(const SceneID& inputBaseID) +{ + BaseID = inputBaseID; + SceneID SceneIDOffset = 4; + NextSceneID = std::max(std::max(BaseID, NextSceneID), SceneIDOffset); +} + Ptr Scene::Create(const JSON::json& sceneData, const bool assignNewIDs) { // Decide ID @@ -335,6 +343,7 @@ JSON::json Scene::getJSON() const j["ID"] = m_ID; j["name"] = m_Name; + j["BaseID"] = m_BaseID; j["importStyle"] = m_ImportStyle; j["sceneFile"] = m_SceneFile; j["entity"] = m_Entity.getJSON(); @@ -359,6 +368,7 @@ Scene::Scene(SceneID id, const String& name, const SceneSettings& settings, Impo , m_Entity(this) { setName(m_Name); + setBaseID(); s_Scenes.push_back(this); } diff --git a/rootex/framework/scene.h b/rootex/framework/scene.h index eb3656ad6..82d7d0fc0 100644 --- a/rootex/framework/scene.h +++ b/rootex/framework/scene.h @@ -40,9 +40,10 @@ class Scene bool m_IsScenePaused; static Vector s_Scenes; - + static SceneID BaseID; SceneID m_ID; String m_Name; + SceneID m_BaseID; String m_FullName; ImportStyle m_ImportStyle; /// Contains the current file name if local, else contains the linked scene file @@ -57,6 +58,7 @@ class Scene public: static void ResetNextID(); + static void SetBaseID(const SceneID& inputBaseID); static Ptr Create(const JSON::json& sceneData, const bool assignNewIDs); static Ptr CreateFromFile(const String& sceneFile); @@ -81,6 +83,7 @@ class Scene bool removeChild(Scene* toRemove); void setName(const String& name); + void setBaseID() { m_BaseID = BaseID; } JSON::json getJSON() const; bool& getIsScenePaused() { return m_IsScenePaused; }