send update for AvatarEntity on deleteGrab

This commit is contained in:
Andrew Meadows 2019-02-12 12:50:47 -08:00
parent fab3e5e3fd
commit 3ea6241cc9
4 changed files with 22 additions and 3 deletions

View file

@ -5312,3 +5312,15 @@ void MyAvatar::releaseGrab(const QUuid& grabID) {
}
}
void MyAvatar::sendPacket(const QUuid& entityID, const EntityItemProperties& properties) const {
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
if (entityTree) {
entityTree->withWriteLock([&] {
// force an update packet
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entityID, properties);
});
}
}

View file

@ -1882,6 +1882,7 @@ private:
bool didTeleport();
bool getIsAway() const { return _isAway; }
void setAway(bool value);
void sendPacket(const QUuid& entityID, const EntityItemProperties& properties) const override;
std::mutex _pinnedJointsMutex;
std::vector<int> _pinnedJoints;

View file

@ -363,6 +363,13 @@ bool Avatar::applyGrabChanges() {
target->removeGrab(grab);
_avatarGrabs.erase(itr);
grabAddedOrRemoved = true;
if (isMyAvatar()) {
const EntityItemPointer& entity = std::dynamic_pointer_cast<EntityItem>(target);
if (entity && entity->getEntityHostType() == entity::HostType::AVATAR && entity->getSimulationOwner().getID() == getID()) {
EntityItemProperties properties = entity->getProperties();
sendPacket(entity->getID(), properties);
}
}
} else {
undeleted.push_back(id);
}

View file

@ -25,6 +25,7 @@
#include <render/Scene.h>
#include <graphics-scripting/Forward.h>
#include <GLMHelpers.h>
#include <EntityItem.h>
#include <Grab.h>
#include <ThreadSafeValueCache.h>
@ -601,6 +602,7 @@ protected:
// protected methods...
bool isLookingAtMe(AvatarSharedPointer avatar) const;
virtual void sendPacket(const QUuid& entityID, const EntityItemProperties& properties) const { }
bool applyGrabChanges();
void relayJointDataToChildren();
@ -645,9 +647,6 @@ protected:
bool success { false };
};
//using MapOfAvatarEntityDataHashes = QMap<QUuid, AvatarEntityDataHash>;
//MapOfAvatarEntityDataHashes _avatarEntityDataHashes;
uint64_t _lastRenderUpdateTime { 0 };
int _leftPointerGeometryID { 0 };
int _rightPointerGeometryID { 0 };