History

fix flagging for avatar entity update/delete

Stephen Birarda committed 8 years ago

Commit e33f3491 parent 0f037648 files · +55 −50Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 8 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+9−4
@@ -574,7 +574,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 573 unmodified lines
574574 _activityTracking.deletedEntityCount++;
575575
576576 EntityItemID entityID(id);
577− bool shouldDelete = true;
577+ bool shouldSendDeleteToServer = true;
578578
579579 // If we have a local entity tree set, then also update it.
580580 if (_entityTree) {
@@ -591,16 +591,21 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 10 unmodified lines
591591 auto avatarHashMap = DependencyManager::get<AvatarHashMap>();
592592 AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID);
593593 myAvatar->insertDetachedEntityID(id);
594− shouldDelete = false;
594+ shouldSendDeleteToServer = false;
595595 return;
596596 }
597597
598598 if (entity->getLocked()) {
599− shouldDelete = false;
599+ shouldSendDeleteToServer = false;
600600 } else {
601601 // only delete local entities, server entities will round trip through the server filters
602602 if (entity->getClientOnly() || _entityTree->isServerlessMode()) {
603+ shouldSendDeleteToServer = false;
603604 _entityTree->deleteEntity(entityID);
605+
606+ if (entity->getClientOnly() && getEntityPacketSender()->getMyAvatar()) {
607+ getEntityPacketSender()->getMyAvatar()->clearAvatarEntity(entityID, false);
608+ }
604609 }
605610 }
606611 }
@@ -608,7 +613,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 1 unmodified line
608613 }
609614
610615 // 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) {
612617 getEntityPacketSender()->queueEraseEntityMessage(entityID);
613618 }
614619 }