mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 08:33:12 +02:00
Fixed avatar parent delete issue
This commit is contained in:
parent
5ccfe3f6e8
commit
ff7c11d48c
2 changed files with 15 additions and 0 deletions
|
@ -438,6 +438,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign
|
|||
return;
|
||||
}
|
||||
|
||||
checkEntity(entityID);
|
||||
emit deletingEntity(entityID);
|
||||
|
||||
// NOTE: callers must lock the tree before using this method
|
||||
|
@ -447,6 +448,17 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign
|
|||
_isDirty = true;
|
||||
}
|
||||
|
||||
void EntityTree::checkEntity(const EntityItemID entityID) {
|
||||
|
||||
EntityItemPointer entity = findEntityByEntityItemID(entityID);
|
||||
|
||||
entity->forEachChild([&](SpatiallyNestablePointer child) {
|
||||
if (child->getNestableType() == NestableType::Avatar) {
|
||||
child->setParentID(nullptr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs, bool force, bool ignoreWarnings) {
|
||||
// NOTE: callers must lock the tree before using this method
|
||||
DeleteEntityOperator theOperator(getThisPointer());
|
||||
|
@ -476,6 +488,7 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs, bool force, bool i
|
|||
}
|
||||
|
||||
// tell our delete operator about this entityID
|
||||
checkEntity(entityID);
|
||||
theOperator.addEntityIDToDeleteList(entityID);
|
||||
emit deletingEntity(entityID);
|
||||
}
|
||||
|
|
|
@ -121,6 +121,8 @@ public:
|
|||
// use this method if you have a pointer to the entity (avoid an extra entity lookup)
|
||||
bool updateEntity(EntityItemPointer entity, const EntityItemProperties& properties, const SharedNodePointer& senderNode = SharedNodePointer(nullptr));
|
||||
|
||||
// check if the avatar is a child of this entity, If so set the avatar parentID to null
|
||||
void checkEntity(const EntityItemID entityID);
|
||||
void deleteEntity(const EntityItemID& entityID, bool force = false, bool ignoreWarnings = true);
|
||||
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false, bool ignoreWarnings = true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue