Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -498,12 +498,12 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 497 unmodified lines | |||
| 498 | 498 | ||
| 499 | auto nodeList = DependencyManager::get<NodeList>(); | 499 | auto nodeList = DependencyManager::get<NodeList>(); |
| 500 | const QUuid myNodeID = nodeList->getSessionUUID(); | 500 | const QUuid myNodeID = nodeList->getSessionUUID(); |
| 501 | auto avatarHashMap = DependencyManager::get<AvatarHashMap>(); | ||
| 502 | AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID); | ||
| 503 | if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) { | 501 | if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) { |
| 504 | // don't delete other avatar's avatarEntities | 502 | // don't delete other avatar's avatarEntities |
| 505 | // If you actually own the entity but the onwership is not set because of a domain switch | 503 | // If you actually own the entity but the onwership property is not set because of a domain switch |
| 506 | // the line below make sure the entity is deleted. | 504 | // The lines below makes sure the entity is deleted once its properties are set. |
| 505 | auto avatarHashMap = DependencyManager::get<AvatarHashMap>(); | ||
| 506 | AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID); | ||
| 507 | myAvatar->insertDetachedEntityID(id); | 507 | myAvatar->insertDetachedEntityID(id); |
| 508 | shouldDelete = false; | 508 | shouldDelete = false; |
| 509 | return; | 509 | return; |