From e54d5ad2215f75d4c275f719c7f95cc375179335 Mon Sep 17 00:00:00 2001 From: Neil Connatty Date: Sat, 21 Feb 2026 07:47:51 -0800 Subject: [PATCH] add support for toc entities to be listed in instancesData json entry --- src/Project.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Project.cpp b/src/Project.cpp index fc0670e..cc6c002 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -325,17 +325,26 @@ void Project::load(const nlohmann::json& j, const FileLoader& file_loader, bool if (j.contains("toc")) { for (const auto& toc_entry : j["toc"]) { auto entity_name = toc_entry["identifier"].get(); - for (const auto& ref : toc_entry["instances"]) { + auto createAndAddEntityRef = [&](const nlohmann::json& jsonEntry) { auto entity_ref = EntityRef( - IID(ref["entityIid"]), - IID(ref["layerIid"]), - IID(ref["levelIid"]), - IID(ref["worldIid"]) + IID(jsonEntry["entityIid"]), + IID(jsonEntry["layerIid"]), + IID(jsonEntry["levelIid"]), + IID(jsonEntry["worldIid"]) ); resolveEntityRef(entity_ref); m_toc.push_back(entity_ref); m_toc_map[entity_name].push_back(entity_ref); + }; + + for (const auto& ref : toc_entry["instances"]) { + createAndAddEntityRef(ref); + } + + for (const auto& ref: toc_entry["instancesData"]) { + const auto& iids = ref["iids"]; + createAndAddEntityRef(iids); } } }