mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +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) {
|
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);
|
setParentID(value);
|
||||||
// children are forced to be kinematic
|
// children are forced to be kinematic
|
||||||
// may need to not collide with own avatar
|
// may need to not collide with own avatar
|
||||||
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP);
|
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP);
|
||||||
|
|
||||||
EntityTreePointer tree = getTree();
|
|
||||||
if (tree) {
|
if (tree) {
|
||||||
tree->addToNeedsParentFixupList(getThisPointer());
|
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) {
|
void EntityTree::addToNeedsParentFixupList(EntityItemPointer entity) {
|
||||||
QWriteLocker locker(&_needsParentFixupLock);
|
QWriteLocker locker(&_needsParentFixupLock);
|
||||||
_needsParentFixup.append(entity);
|
_needsParentFixup.append(entity);
|
||||||
|
|
|
@ -254,6 +254,7 @@ public:
|
||||||
void knowAvatarID(QUuid avatarID) { _avatarIDs += avatarID; }
|
void knowAvatarID(QUuid avatarID) { _avatarIDs += avatarID; }
|
||||||
void forgetAvatarID(QUuid avatarID) { _avatarIDs -= avatarID; }
|
void forgetAvatarID(QUuid avatarID) { _avatarIDs -= avatarID; }
|
||||||
void deleteDescendantsOfAvatar(QUuid avatarID);
|
void deleteDescendantsOfAvatar(QUuid avatarID);
|
||||||
|
void removeFromChildrenOfAvatars(EntityItemPointer entity);
|
||||||
|
|
||||||
void addToNeedsParentFixupList(EntityItemPointer entity);
|
void addToNeedsParentFixupList(EntityItemPointer entity);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue