diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd
index 0965ef89..1c9456ad 100644
--- a/resources/Schema/Types/Entity.xsd
+++ b/resources/Schema/Types/Entity.xsd
@@ -52,6 +52,8 @@
+
+
diff --git a/src/Engine/Core/EntityFileParser.cpp b/src/Engine/Core/EntityFileParser.cpp
index 23c0c4c4..2beaac14 100644
--- a/src/Engine/Core/EntityFileParser.cpp
+++ b/src/Engine/Core/EntityFileParser.cpp
@@ -1,6 +1,6 @@
#include "Core/EntityFileParser.h"
-EntityFileParser::EntityFileParser(const EntityFile* entityFile)
+EntityFileParser::EntityFileParser(const EntityFile* entityFile)
: m_EntityFile(entityFile)
{
m_Handler.SetStartEntityCallback(std::bind(&EntityFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
@@ -33,13 +33,20 @@ void EntityFileParser::onStartEntity(EntityID entity, EntityID parent, const std
void EntityFileParser::onStartComponent(EntityID entity, const std::string& component)
{
- EntityID realEntity = m_EntityIDMapper.at(entity);
- m_World->AttachComponent(realEntity, component);
+ if (m_World->GetComponentPools().count(component) != 0) {
+ EntityID realEntity = m_EntityIDMapper.at(entity);
+ m_World->AttachComponent(realEntity, component);
+ } else {
+ LOG_ERROR("Tried to attach unregistered component \"%s\"! to entity #%i. Ignoring.", component.c_str(), entity);
+ }
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
}
void EntityFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map& attributes)
{
+ if (m_World->GetComponentPools().count(componentType) == 0) {
+ return;
+ }
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
@@ -61,6 +68,9 @@ void EntityFileParser::onStartComponentField(EntityID entity, const std::string&
void EntityFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
{
+ if (m_World->GetComponentPools().count(componentType) == 0) {
+ return;
+ }
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
diff --git a/src/Engine/Core/Util/Logging.cpp b/src/Engine/Core/Util/Logging.cpp
index c7612fd8..63a6f380 100644
--- a/src/Engine/Core/Util/Logging.cpp
+++ b/src/Engine/Core/Util/Logging.cpp
@@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int
va_end(args);
if (logLevel == LOG_LEVEL_ERROR) {
- //std::cerr << file << ":" << line << " " << func << std::endl;
- //std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
+ std::cerr << file << ":" << line << " " << func << std::endl;
+ std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
}
diff --git a/src/Engine/Editor/EditorSystem.cpp b/src/Engine/Editor/EditorSystem.cpp
index 4bee1427..47547b8f 100644
--- a/src/Engine/Editor/EditorSystem.cpp
+++ b/src/Engine/Editor/EditorSystem.cpp
@@ -258,16 +258,17 @@ EntityWrapper EditorSystem::importEntity(EntityWrapper parent, boost::filesystem
return EntityWrapper::Invalid;
}
- try {
+ //try {
auto entityFile = ResourceManager::Load(filePath.string());
EntityFilePreprocessor fpp(entityFile);
fpp.RegisterComponents(parent.World);
EntityFileParser fp(entityFile);
EntityID newEntity = fp.MergeEntities(parent.World, parent.ID);
return EntityWrapper(parent.World, newEntity);
- } catch (const std::exception&) {
+ /*} catch (const std::exception& e) {
+ LOG_ERROR("Failed to import entity \"%s\": \"%s\"", filePath.string().c_str(), e.what());
return EntityWrapper::Invalid;
- }
+ }*/
}
void EditorSystem::setWidgetMode(EditorGUI::WidgetMode mode)