Now exports prefabs to trenchbroom automatically

This commit is contained in:
antopilo
2024-12-01 13:21:58 -05:00
parent ea044a2357
commit 5b4d6d915a

View File

@@ -4,7 +4,7 @@
#include "src/Core/Logger.h"
#include "src/Audio/AudioManager.h"
#include "src/Scripting/ScriptingEngineNet.h"
#include "src/FileSystem/File.h"
#include <json/json.hpp>
#include <filesystem>
@@ -211,6 +211,23 @@ namespace Nuake
file->PointEntities.push_back(pointEntity);
}
for (auto& p : FileSystem::GetAllFiles(FileType::Prefab))
{
const std::string& fileContent = FileSystem::ReadFile(p->GetRelativePath());
json fileJson = json::parse(fileContent);
std::string name = p->GetName();
if (fileJson.contains("DisplayName"))
{
name = fileJson["DisplayName"];
}
FGDPointEntity pointEntity = FGDPointEntity(name);
pointEntity.Description = "A Prefab entity";
file->PointEntities.push_back(pointEntity);
}
for (auto& b : bases)
{
FGDBaseEntity baseEntity;