mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-28 22:29:54 +02:00
delete avatar entity when switching domains
This commit is contained in:
parent
806d9f1436
commit
f6208a394c
2 changed files with 5 additions and 0 deletions
|
@ -615,6 +615,7 @@ public:
|
||||||
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
||||||
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
|
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
|
||||||
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
|
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
|
||||||
|
void insertDetachedEntityID(const QUuid entityID) { _avatarEntityDetached.insert(entityID); }
|
||||||
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
||||||
|
|
||||||
// thread safe
|
// thread safe
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <VariantMapToScriptValue.h>
|
#include <VariantMapToScriptValue.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <SpatialParentFinder.h>
|
#include <SpatialParentFinder.h>
|
||||||
|
#include <AvatarHashMap.h>
|
||||||
|
|
||||||
#include "EntityItemID.h"
|
#include "EntityItemID.h"
|
||||||
#include "EntitiesLogging.h"
|
#include "EntitiesLogging.h"
|
||||||
|
@ -497,8 +498,11 @@ void EntityScriptingInterface::deleteEntity(QUuid id) {
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
const QUuid myNodeID = nodeList->getSessionUUID();
|
const QUuid myNodeID = nodeList->getSessionUUID();
|
||||||
|
auto avatarHashMap = DependencyManager::get<AvatarHashMap>();
|
||||||
|
AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID);
|
||||||
if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) {
|
if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) {
|
||||||
// don't delete other avatar's avatarEntities
|
// don't delete other avatar's avatarEntities
|
||||||
|
myAvatar->insertDetachedEntityID(id);
|
||||||
shouldDelete = false;
|
shouldDelete = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue