clear other avatars in agent on avatar mixer disconnect

This commit is contained in:
Stephen Birarda 2018-08-30 15:10:05 -07:00
parent be57789ad8
commit adac872a11
5 changed files with 18 additions and 10 deletions

View file

@ -1192,7 +1192,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
connect(&domainHandler, SIGNAL(connectedToDomain(QUrl)), SLOT(updateWindowTitle()));
connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &Application::clearDomainAvatars);
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, [this]() {
getOverlays().deleteOverlay(getTabletScreenID());
getOverlays().deleteOverlay(getTabletHomeButtonID());
@ -6368,10 +6367,6 @@ void Application::clearDomainOctreeDetails() {
getMyAvatar()->setAvatarEntityDataChanged(true);
}
void Application::clearDomainAvatars() {
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
}
void Application::domainURLChanged(QUrl domainURL) {
// disable physics until we have enough information about our new location to not cause craziness.
resetPhysicsReadyInformation();
@ -6459,9 +6454,6 @@ void Application::nodeKilled(SharedNodePointer node) {
} else if (node->getType() == NodeType::EntityServer) {
// we lost an entity server, clear all of the domain octree details
clearDomainOctreeDetails();
} else if (node->getType() == NodeType::AvatarMixer) {
// our avatar mixer has gone away - clear the hash of avatars
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
} else if (node->getType() == NodeType::AssetServer) {
// asset server going away - check if we have the asset browser showing

View file

@ -437,7 +437,6 @@ private slots:
void onDesktopRootContextCreated(QQmlContext* qmlContext);
void showDesktop();
void clearDomainOctreeDetails();
void clearDomainAvatars();
void onAboutToQuit();
void onPresent(quint32 frameCount);

View file

@ -93,7 +93,7 @@ public:
void postUpdate(float deltaTime, const render::ScenePointer& scene);
void clearOtherAvatars();
void clearOtherAvatars() override;
void deleteAllAvatars();
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);

View file

@ -112,6 +112,12 @@ AvatarHashMap::AvatarHashMap() {
packetReceiver.registerListener(PacketType::BulkAvatarTraits, this, "processBulkAvatarTraits");
connect(nodeList.data(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
connect(nodeList.data(), &NodeList::nodeKilled, this, [this](SharedNodePointer killedNode){
if (killedNode->getType() == NodeType::AvatarMixer) {
clearOtherAvatars();
}
});
}
QVector<QUuid> AvatarHashMap::getAvatarIdentifiers() {
@ -427,3 +433,12 @@ void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& ol
emit avatarSessionChangedEvent(sessionUUID, oldUUID);
}
void AvatarHashMap::clearOtherAvatars() {
QWriteLocker locker(&_hashLock);
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
handleRemovedAvatar(*avatarIterator);
avatarIterator = _avatarHash.erase(avatarIterator);
}
}

View file

@ -101,6 +101,8 @@ public:
void setReplicaCount(int count);
int getReplicaCount() { return _replicas.getReplicaCount(); };
virtual void clearOtherAvatars();
signals:
/**jsdoc