!B (Sandbox) (CE-21795) Importing models with multisubmaterials via fbx switches...
[CRYENGINE.git] / Code / CryEngine / CrySchematyc2 / BaseEnv / Utils / BaseEnv_EntityMap.cpp
blob63765fe0d224a4a76771940b42a718fada0cc226
1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
4 #include "BaseEnv/Utils/BaseEnv_EntityMap.h"
6 #include <CryEntitySystem/IEntitySystem.h>
8 namespace SchematycBaseEnv
10 void CEntityMap::MarkEntityForDestruction(EntityId entityId)
12 m_entitiesMarkedForDestruction.push_back(entityId);
15 void CEntityMap::DestroyMarkedEntites()
17 EntityIds entitiesMarkedForDestruction = m_entitiesMarkedForDestruction;
18 m_entitiesMarkedForDestruction.clear();
19 for(EntityId entityId : entitiesMarkedForDestruction)
21 gEnv->pEntitySystem->RemoveEntity(entityId);
25 void CEntityMap::AddObject(EntityId entityId, const Schematyc2::ObjectId& objectId)
27 m_entityObjectIds.insert(EntityObjectIds::value_type(entityId, objectId));
30 void CEntityMap::RemoveObject(EntityId entityId)
32 m_entityObjectIds.erase(entityId);
35 Schematyc2::ObjectId CEntityMap::FindObjectId(EntityId entityId) const
37 EntityObjectIds::const_iterator itObjectId = m_entityObjectIds.find(entityId);
38 return itObjectId != m_entityObjectIds.end() ? itObjectId->second : Schematyc2::ObjectId();
41 Schematyc2::IObject* CEntityMap::FindObject(EntityId entityId) const
43 return gEnv->pSchematyc2->GetObjectManager().GetObjectById(FindObjectId(entityId));
46 void CEntityMap::VisitEntities(const EntityMapVisitor& visitor)
48 CRY_ASSERT(visitor);
49 if(visitor)
51 for(EntityObjectIds::value_type& entityObjectId : m_entityObjectIds)
53 visitor(entityObjectId.first);