From 1e4e2cc1b4810247bb26c36d2d393a64d249d8f7 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 16 May 2017 16:22:40 -0700 Subject: [PATCH] when a parent entity is deleted, delete its children in the local tree, rather than waiting for the server to tell us about it --- libraries/entities/src/EntityTree.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 457b7c21f6..6975d017b0 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -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;