From ded73a0b4c86536177c5c3faf4e9961a305eafc7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 22 May 2024 23:24:08 -0500 Subject: [PATCH] [jasper/world/studio] Fix WorldEditor to pull in resource updates --- .../src/studio/worldeditor/worldeditor-imgui.cpp | 11 +++++++---- .../src/studio/worldeditor/worldeditor-imgui.hpp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp index f998cf3..3b13254 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp @@ -239,11 +239,14 @@ void WorldEditorImGui::rmObjSet() noexcept { pushCommand(m_doc, m_palMgr.selectedIdx); } -ox::Error WorldEditorImGui::handleObjectSetUpdate(ox::StringView path) noexcept { - if (ox::any_of(m_doc.objSets.begin(), m_doc.objSets.end(), [path](ObjectSetEntry const&set) { - return set.path == path; - })) { +ox::Error WorldEditorImGui::handleObjectSetUpdate(ox::StringView, ox::UUID const&uuid) noexcept { + auto const matches = [uuid](ObjectSetEntry const&set) { + auto const [setUuid, err] = keel::uuidUrlToUuid(set.path); + return !err && setUuid == uuid; + }; + if (ox::any_of(m_doc.objSets.begin(), m_doc.objSets.end(), matches)) { oxReturnError(buildObjCache(keelCtx(m_sctx.tctx), m_doc).moveTo(m_objCache)); + oxReturnError(loadWorldStatic(m_objCache, m_doc).moveTo(m_worldStatic)); } return loadObjectSets(); } diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp index 501d955..1f9633a 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp @@ -72,7 +72,7 @@ class WorldEditorImGui: public studio::Editor { void rmObjSet() noexcept; // handles the updating of an object set in case it is one used by this world - ox::Error handleObjectSetUpdate(ox::StringView path) noexcept; + ox::Error handleObjectSetUpdate(ox::StringView path, ox::UUID const&) noexcept; ox::Error loadObjectSets() noexcept;