Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 8 files). Show all
Unified · Split
| @@ -574,7 +574,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 573 unmodified lines | |||
| 574 | _activityTracking.deletedEntityCount++; | 574 | _activityTracking.deletedEntityCount++; |
| 575 | 575 | ||
| 576 | EntityItemID entityID(id); | 576 | EntityItemID entityID(id); |
| 577 | bool shouldDelete = true; | 577 | bool shouldSendDeleteToServer = true; |
| 578 | 578 | ||
| 579 | // If we have a local entity tree set, then also update it. | 579 | // If we have a local entity tree set, then also update it. |
| 580 | if (_entityTree) { | 580 | if (_entityTree) { |
| @@ -591,16 +591,21 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 10 unmodified lines | |||
| 591 | auto avatarHashMap = DependencyManager::get<AvatarHashMap>(); | 591 | auto avatarHashMap = DependencyManager::get<AvatarHashMap>(); |
| 592 | AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID); | 592 | AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID); |
| 593 | myAvatar->insertDetachedEntityID(id); | 593 | myAvatar->insertDetachedEntityID(id); |
| 594 | shouldDelete = false; | 594 | shouldSendDeleteToServer = false; |
| 595 | return; | 595 | return; |
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | if (entity->getLocked()) { | 598 | if (entity->getLocked()) { |
| 599 | shouldDelete = false; | 599 | shouldSendDeleteToServer = false; |
| 600 | } else { | 600 | } else { |
| 601 | // only delete local entities, server entities will round trip through the server filters | 601 | // only delete local entities, server entities will round trip through the server filters |
| 602 | if (entity->getClientOnly() || _entityTree->isServerlessMode()) { | 602 | if (entity->getClientOnly() || _entityTree->isServerlessMode()) { |
| 603 | shouldSendDeleteToServer = false; | ||
| 603 | _entityTree->deleteEntity(entityID); | 604 | _entityTree->deleteEntity(entityID); |
| 605 | |||
| 606 | if (entity->getClientOnly() && getEntityPacketSender()->getMyAvatar()) { | ||
| 607 | getEntityPacketSender()->getMyAvatar()->clearAvatarEntity(entityID, false); | ||
| 608 | } | ||
| 604 | } | 609 | } |
| 605 | } | 610 | } |
| 606 | } | 611 | } |
| @@ -608,7 +613,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 1 unmodified line | |||
| 608 | } | 613 | } |
| 609 | 614 | ||
| 610 | // if at this point, we know the id, and we should still delete the entity, send the update to the entity server | 615 | // if at this point, we know the id, and we should still delete the entity, send the update to the entity server |
| 611 | if (shouldDelete) { | 616 | if (shouldSendDeleteToServer) { |
| 612 | getEntityPacketSender()->queueEraseEntityMessage(entityID); | 617 | getEntityPacketSender()->queueEraseEntityMessage(entityID); |
| 613 | } | 618 | } |
| 614 | } | 619 | } |