when a parent entity is deleted, delete its children in the local tree, rather than waiting for the server to tell us about it

This commit is contained in:
Seth Alves 2017-05-16 16:22:40 -07:00
parent 9a4b624029
commit 1e4e2cc1b4

View file

@ -452,6 +452,13 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign
// NOTE: callers must lock the tree before using this method
DeleteEntityOperator theOperator(getThisPointer(), entityID);
existingEntity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
auto descendantID = descendant->getID();
theOperator.addEntityIDToDeleteList(descendantID);
emit deletingEntity(descendantID);
});
recurseTreeWithOperator(&theOperator);
processRemovedEntities(theOperator);
_isDirty = true;