18 #include "precompiled.h"
32 template<
typename T,
typename S>
43 template<
typename S>
bool operator()(
const S& v) {
return v.second ==
x; }
77 ENSURE(!objectname.empty());
81 std::map<CStrW, CObjectBase*>::iterator it =
m_ObjectBases.find(objectname);
91 if (obj->Load(pathname))
99 LOGERROR(L
"CObjectManager::FindObjectBase(): Cannot find object '%ls'", objectname.c_str());
106 std::vector<std::set<CStr> > selections;
122 PROFILE(
"object variation loading");
129 std::map<ObjectKey, CObjectEntry*>::iterator it =
m_Objects.find(
key);
130 if (it !=
m_Objects.end() && !it->second->m_Outdated)
148 if (! obj->BuildVariation(selections, choices, *
this))
169 std::map<ObjectKey, CObjectEntry*>::iterator it;
182 delete_pair_2nd<ObjectKey, CObjectEntry*>
189 delete_pair_2nd<CStrW, CObjectBase*>
197 for (std::map<ObjectKey, CObjectEntry*>::iterator it =
m_Objects.begin(); it !=
m_Objects.end(); ++it)
198 if (it->second->m_Base->UsesFile(path))
199 it->second->m_Outdated =
true;
204 if (it->second->UsesFile(path))
206 it->second->Reload();
213 for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit)
214 static_cast<ICmpVisual*>(eit->second)->Hotload(it->first);
Path VfsPath
VFS path of the form "(dir/)*file?".
CObjectEntry * FindObject(const CStrW &objname)
CObjectBase * FindObjectBase(const CStrW &objname)
std::vector< u8 > ActorVariation
static void delete_pair_2nd(std::pair< T, S > v)
const InterfaceListUnordered & GetEntitiesWithInterfaceUnordered(int iid)
Returns a list of components implementing the given interface, and their associated entities...
const entity_id_t SYSTEM_ENTITY
Entity ID for singleton 'system' components.
Public API for simulation system.
Status ReloadChangedFile(const VfsPath &path)
Reload any scripts that were loaded from the given filename.
CTerrain * GetTerrain()
Get the terrain object that actors managed by this manager should be linked with (primarily for the p...
CMeshManager & m_MeshManager
CObjectEntry * FindObjectVariation(const CStrW &objname, const std::vector< std::set< CStr > > &selections)
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
second_equals(const T &x)
std::vector< u8 > CalculateVariationKey(const std::vector< std::set< CStr > > &selections)
void UnregisterFileReloadFunc(FileReloadFunc func, void *obj)
delete a callback function registered with RegisterFileReloadFunc (removes any with the same func and...
void RegisterFileReloadFunc(FileReloadFunc func, void *obj)
register a callback function to be called by ReloadChangedFiles
const String & string() const
CSkeletonAnimManager & m_SkeletonAnimManager
bool operator()(const S &v)
i64 Status
Error handling system.
#define T(string_literal)
std::map< CStrW, CObjectBase * > m_ObjectBases
bool operator<(const CObjectManager::ObjectKey &a) const
A simplified syntax for accessing entity components.
virtual CTerrain * GetCTerrain()=0
static Status ReloadChangedFileCB(void *param, const VfsPath &path)
boost::unordered_map< entity_id_t, IComponent * > InterfaceListUnordered
void DeleteObject(CObjectEntry *entry)
std::map< ObjectKey, CObjectEntry * > m_Objects
CObjectManager(CMeshManager &meshManager, CSkeletonAnimManager &skeletonAnimManager, CSimulation2 &simulation)
CSimulation2 & m_Simulation