mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 18:23:22 +02:00
Merge pull request #11488 from sethalves/fix-grab-drop-and-leave-bug
server only deletes an entity if it's still the child of an avatar, not if it has ever been
This commit is contained in:
commit
da3d5a92d9
3 changed files with 14 additions and 2 deletions
|
@ -1570,13 +1570,17 @@ void EntityItem::updatePosition(const glm::vec3& value) {
|
|||
}
|
||||
|
||||
void EntityItem::updateParentID(const QUuid& value) {
|
||||
if (getParentID() != value) {
|
||||
QUuid oldParentID = getParentID();
|
||||
if (oldParentID != value) {
|
||||
EntityTreePointer tree = getTree();
|
||||
if (!oldParentID.isNull()) {
|
||||
tree->removeFromChildrenOfAvatars(getThisPointer());
|
||||
}
|
||||
setParentID(value);
|
||||
// children are forced to be kinematic
|
||||
// may need to not collide with own avatar
|
||||
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP);
|
||||
|
||||
EntityTreePointer tree = getTree();
|
||||
if (tree) {
|
||||
tree->addToNeedsParentFixupList(getThisPointer());
|
||||
}
|
||||
|
|
|
@ -1326,6 +1326,13 @@ void EntityTree::deleteDescendantsOfAvatar(QUuid avatarID) {
|
|||
}
|
||||
}
|
||||
|
||||
void EntityTree::removeFromChildrenOfAvatars(EntityItemPointer entity) {
|
||||
QUuid avatarID = entity->getParentID();
|
||||
if (_childrenOfAvatars.contains(avatarID)) {
|
||||
_childrenOfAvatars[avatarID].remove(entity->getID());
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTree::addToNeedsParentFixupList(EntityItemPointer entity) {
|
||||
QWriteLocker locker(&_needsParentFixupLock);
|
||||
_needsParentFixup.append(entity);
|
||||
|
|
|
@ -254,6 +254,7 @@ public:
|
|||
void knowAvatarID(QUuid avatarID) { _avatarIDs += avatarID; }
|
||||
void forgetAvatarID(QUuid avatarID) { _avatarIDs -= avatarID; }
|
||||
void deleteDescendantsOfAvatar(QUuid avatarID);
|
||||
void removeFromChildrenOfAvatars(EntityItemPointer entity);
|
||||
|
||||
void addToNeedsParentFixupList(EntityItemPointer entity);
|
||||
|
||||
|
|
Loading…
Reference in a new issue