diff --git a/Nuake/src/FileSystem/FileSystem.cpp b/Nuake/src/FileSystem/FileSystem.cpp index 036b010c..9f7b74d9 100644 --- a/Nuake/src/FileSystem/FileSystem.cpp +++ b/Nuake/src/FileSystem/FileSystem.cpp @@ -69,7 +69,7 @@ std::vector> FileSystem::GetAllFiles(const FileType fileType) std::vector> foundFiles; std::function)> scanDir; - scanDir = [scanDir, &foundFiles, fileType](Ref dir) + scanDir = [&scanDir, &foundFiles, &fileType](Ref dir) { // All the files matching the filetype for (auto& f : dir->Files) diff --git a/Nuake/src/Resource/Project.cpp b/Nuake/src/Resource/Project.cpp index 2f7e1f8a..f8e684b4 100644 --- a/Nuake/src/Resource/Project.cpp +++ b/Nuake/src/Resource/Project.cpp @@ -224,7 +224,7 @@ namespace Nuake FGDPointEntity pointEntity = FGDPointEntity(name); pointEntity.Description = "A Prefab entity"; - + pointEntity.Prefab = p->GetRelativePath(); file->PointEntities.push_back(pointEntity); } diff --git a/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp b/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp index cbc20437..ccc92063 100644 --- a/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp +++ b/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp @@ -211,22 +211,23 @@ namespace Nuake { } } } - else + else if(!pointEntity->Prefab.empty()) { - Entity newPrefab = Engine::GetCurrentScene()->CreateEntity(pointEntity->Name); - pointEntities[pointEntity->Name].AddChild(newPrefab); + auto& prefabComponent = currentNonWorldEntity.AddComponent(); + Ref prefab = Prefab::InstanceInScene(pointEntity->Prefab, m_Scene); - auto& prefabComponent = newPrefab.AddComponent(); - prefabComponent.SetPrefab(Prefab::New(pointEntity->Prefab)); - newPrefab.GetComponent().SetLocalPosition(brushLocalPosition); + prefabComponent.SetPrefab(prefab); + prefabComponent.isInitialized = true; + currentNonWorldEntity.AddChild(prefabComponent.PrefabInstance->Root); + currentNonWorldEntity.GetComponent().SetLocalPosition(brushLocalPosition); - for (auto& e : prefabComponent.PrefabInstance->Entities) - { - if (!e.GetComponent().HasParent) - { - newPrefab.AddChild(e); - } - } + //for (auto& e : prefabComponent.PrefabInstance->Entities) + //{ + // if (!e.GetComponent().HasParent) + // { + // newPrefab.AddChild(e); + // } + //} } } else