Fix hotloading making models disappear.
The actors were always hotloaded because of a bad logic change in
76acc4e146
.
Fixes #6228
Differential Revision: https://code.wildfiregames.com/D4175
This was SVN commit r25805.
This commit is contained in:
parent
8c7d77a610
commit
a541f3a317
@ -157,10 +157,15 @@ void CObjectManager::UnloadObjects()
|
||||
|
||||
Status CObjectManager::ReloadChangedFile(const VfsPath& path)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// Mark old entries as outdated so we don't reload them from the cache
|
||||
for (std::pair<const ObjectKey, Hotloadable<CObjectEntry>>& object : m_Objects)
|
||||
if (!object.second.outdated && object.second.obj->m_Base->UsesFile(path))
|
||||
{
|
||||
object.second.outdated = true;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual);
|
||||
|
||||
@ -168,7 +173,9 @@ Status CObjectManager::ReloadChangedFile(const VfsPath& path)
|
||||
for (std::pair<const CStrW, Hotloadable<CActorDef>>& actor : m_ActorDefs)
|
||||
{
|
||||
if (!actor.second.outdated && actor.second.obj->UsesFile(path))
|
||||
{
|
||||
actor.second.outdated = true;
|
||||
changed = true;
|
||||
|
||||
// Slightly ugly hack: The graphics system doesn't preserve enough information to regenerate the
|
||||
// object with all correct variations, and we don't want to waste space storing it just for the
|
||||
@ -177,6 +184,12 @@ Status CObjectManager::ReloadChangedFile(const VfsPath& path)
|
||||
for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit)
|
||||
static_cast<ICmpVisual*>(eit->second)->Hotload(actor.first);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
// Trigger an interpolate call - needed because the game may be paused & if so, models disappear.
|
||||
m_Simulation.Interpolate(0.f, 0.f, 0.f);
|
||||
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user