Updated all uses of EntityXMLFile to use the new EntityFile to load entities into a world.

This commit is contained in:
2016-03-02 20:12:59 +01:00
parent 3ef15dcb81
commit 7624c6ee0a
17 changed files with 41 additions and 60 deletions
+5 -6
View File
@@ -2,6 +2,7 @@
#include "Core/UniformScaleSystem.h"
#include "Editor/EditorRenderSystem.h"
#include "Editor/EditorWidgetSystem.h"
#include "Core/EntityFile.h"
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
: System(params)
@@ -259,12 +260,10 @@ EntityWrapper EditorSystem::importEntity(EntityWrapper parent, boost::filesystem
}
try {
auto entityFile = ResourceManager::Load<EntityXMLFile>(filePath.string());
EntityXMLFilePreprocessor fpp(entityFile);
fpp.RegisterComponents(parent.World);
EntityXMLFileParser fp(entityFile);
EntityID newEntity = fp.MergeEntities(parent.World, parent.ID);
return EntityWrapper(parent.World, newEntity);
auto entityFile = ResourceManager::Load<EntityFile>(filePath.string());
EntityWrapper newEntity = entityFile->MergeInto(parent.World);
parent.World->SetParent(newEntity.ID, parent.ID);
return newEntity;
} catch (const std::exception& e) {
LOG_ERROR("Failed to import entity \"%s\": \"%s\"", filePath.string().c_str(), e.what());
return EntityWrapper::Invalid;