Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>();
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);
}
}
}
Expand Down
Loading