| 280 | } |
| 281 | |
| 282 | void Scene::Update(Timestep ts) |
| 283 | { |
| 284 | ZoneScoped; |
| 285 | |
| 286 | if (!Engine::IsPlayMode()) |
| 287 | { |
| 288 | const auto& view = m_Registry.view<QuakeMapComponent>(); |
| 289 | for (const auto& e : view) |
| 290 | { |
| 291 | auto& map = view.get<QuakeMapComponent>(e); |
| 292 | |
| 293 | bool buildMap = false; |
| 294 | if (map.rebuildNextTick && map.Path.Exist()) |
| 295 | { |
| 296 | buildMap = true; |
| 297 | map.rebuildNextTick = false; |
| 298 | } |
| 299 | |
| 300 | if (map.AutoRebuild && map.Path.Exist()) |
| 301 | { |
| 302 | if (auto file = FileSystem::GetFile(map.Path.GetRelativePath()); file->Exist() && file->GetHasBeenModified()) |
| 303 | { |
| 304 | file->SetHasBeenModified(false); |
| 305 | buildMap = true; |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | if (buildMap) |
| 310 | { |
| 311 | Entity entity = Entity(e, this); |
| 312 | QuakeMapBuilder builder; |
| 313 | builder.BuildQuakeMap(entity, map.HasCollisions); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | std::map<std::string, Ref<File>> prefabToReimport; |
| 318 | const auto& prefabView = m_Registry.view<PrefabComponent>(); |
| 319 | for (const auto& e : prefabView) |
| 320 | { |
| 321 | auto& prefabComponent = prefabView.get<PrefabComponent>(e); |
| 322 | if (prefabComponent.PrefabInstance == nullptr) |
| 323 | { |
| 324 | continue; |
| 325 | } |
| 326 | |
| 327 | const std::string& filePath = prefabComponent.PrefabInstance->Path; |
| 328 | if (!FileSystem::FileExists(filePath)) |
| 329 | { |
| 330 | continue; |
| 331 | } |
| 332 | |
| 333 | Ref<File> file = FileSystem::GetFile(filePath); |
| 334 | if (file->GetHasBeenModified() || !prefabComponent.isInitialized) |
| 335 | { |
| 336 | prefabToReimport[filePath] = file; |
| 337 | } |
| 338 | } |
| 339 |
nothing calls this directly
no test coverage detected