mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
Merge pull request #7702 from zzmp/fix/clear-octree-on-exit
Clear entities and avatars on exit
This commit is contained in:
commit
3298883774
3 changed files with 16 additions and 2 deletions
|
@ -1235,6 +1235,9 @@ void Application::cleanupBeforeQuit() {
|
|||
}
|
||||
|
||||
Application::~Application() {
|
||||
_entityClipboard->eraseAllOctreeElements();
|
||||
_entityClipboard.reset();
|
||||
|
||||
EntityTreePointer tree = getEntities()->getTree();
|
||||
tree->setSimulation(nullptr);
|
||||
|
||||
|
@ -1244,7 +1247,7 @@ Application::~Application() {
|
|||
_physicsEngine->setCharacterController(nullptr);
|
||||
|
||||
// remove avatars from physics engine
|
||||
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
|
||||
DependencyManager::get<AvatarManager>()->clearAllAvatars();
|
||||
VectorOfMotionStates motionStates;
|
||||
DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates);
|
||||
_physicsEngine->removeObjects(motionStates);
|
||||
|
|
|
@ -77,7 +77,6 @@ AvatarManager::AvatarManager(QObject* parent) :
|
|||
}
|
||||
|
||||
AvatarManager::~AvatarManager() {
|
||||
_myAvatar->die();
|
||||
}
|
||||
|
||||
void AvatarManager::init() {
|
||||
|
@ -250,6 +249,17 @@ void AvatarManager::clearOtherAvatars() {
|
|||
_myAvatar->clearLookAtTargetAvatar();
|
||||
}
|
||||
|
||||
void AvatarManager::clearAllAvatars() {
|
||||
clearOtherAvatars();
|
||||
|
||||
QWriteLocker locker(&_hashLock);
|
||||
|
||||
_myAvatar->die();
|
||||
_myAvatar.reset();
|
||||
|
||||
_avatarHash.clear();
|
||||
}
|
||||
|
||||
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setLocalLights", Q_ARG(const QVector<AvatarManager::LocalLight>&, localLights));
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
void updateOtherAvatars(float deltaTime);
|
||||
|
||||
void clearOtherAvatars();
|
||||
void clearAllAvatars();
|
||||
|
||||
bool shouldShowReceiveStats() const { return _shouldShowReceiveStats; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue