mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 09:59:20 +02:00
Clear entities and avatars on exit
This commit is contained in:
parent
4bf98a80b9
commit
790e325248
3 changed files with 16 additions and 1 deletions
|
@ -1233,6 +1233,9 @@ void Application::cleanupBeforeQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
_entityClipboard->eraseAllOctreeElements();
|
||||||
|
_entityClipboard.reset();
|
||||||
|
|
||||||
EntityTreePointer tree = getEntities()->getTree();
|
EntityTreePointer tree = getEntities()->getTree();
|
||||||
tree->setSimulation(nullptr);
|
tree->setSimulation(nullptr);
|
||||||
|
|
||||||
|
@ -1242,7 +1245,7 @@ Application::~Application() {
|
||||||
_physicsEngine->setCharacterController(nullptr);
|
_physicsEngine->setCharacterController(nullptr);
|
||||||
|
|
||||||
// remove avatars from physics engine
|
// remove avatars from physics engine
|
||||||
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
|
DependencyManager::get<AvatarManager>()->clearAllAvatars();
|
||||||
VectorOfMotionStates motionStates;
|
VectorOfMotionStates motionStates;
|
||||||
DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates);
|
DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates);
|
||||||
_physicsEngine->removeObjects(motionStates);
|
_physicsEngine->removeObjects(motionStates);
|
||||||
|
|
|
@ -250,6 +250,17 @@ void AvatarManager::clearOtherAvatars() {
|
||||||
_myAvatar->clearLookAtTargetAvatar();
|
_myAvatar->clearLookAtTargetAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarManager::clearAllAvatars() {
|
||||||
|
clearOtherAvatars();
|
||||||
|
|
||||||
|
QWriteLocker (locker&_hashLock);
|
||||||
|
|
||||||
|
_myAvatar->die();
|
||||||
|
_myAvatar.reset();
|
||||||
|
|
||||||
|
_avatarHash.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "setLocalLights", Q_ARG(const QVector<AvatarManager::LocalLight>&, localLights));
|
QMetaObject::invokeMethod(this, "setLocalLights", Q_ARG(const QVector<AvatarManager::LocalLight>&, localLights));
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
void updateOtherAvatars(float deltaTime);
|
void updateOtherAvatars(float deltaTime);
|
||||||
|
|
||||||
void clearOtherAvatars();
|
void clearOtherAvatars();
|
||||||
|
void clearAllAvatar();
|
||||||
|
|
||||||
bool shouldShowReceiveStats() const { return _shouldShowReceiveStats; }
|
bool shouldShowReceiveStats() const { return _shouldShowReceiveStats; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue