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 | 574 | _activityTracking.deletedEntityCount++; |
| 575 | 575 | |
| 576 | 576 | EntityItemID entityID(id); |
| 577 | − bool shouldDelete = true; | |
| 577 | + bool shouldSendDeleteToServer = true; | |
| 578 | 578 | |
| 579 | 579 | // If we have a local entity tree set, then also update it. |
| 580 | 580 | if (_entityTree) { |
| @@ -591,16 +591,21 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 10 unmodified lines | ||
| 591 | 591 | auto avatarHashMap = DependencyManager::get<AvatarHashMap>(); |
| 592 | 592 | AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID); |
| 593 | 593 | myAvatar->insertDetachedEntityID(id); |
| 594 | − shouldDelete = false; | |
| 594 | + shouldSendDeleteToServer = false; | |
| 595 | 595 | return; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | if (entity->getLocked()) { |
| 599 | − shouldDelete = false; | |
| 599 | + shouldSendDeleteToServer = false; | |
| 600 | 600 | } else { |
| 601 | 601 | // only delete local entities, server entities will round trip through the server filters |
| 602 | 602 | if (entity->getClientOnly() || _entityTree->isServerlessMode()) { |
| 603 | + shouldSendDeleteToServer = false; | |
| 603 | 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 | 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 | 617 | getEntityPacketSender()->queueEraseEntityMessage(entityID); |
| 613 | 618 | } |
| 614 | 619 | } |