be more aggressive about putting entities into the missing-its-parent list

This commit is contained in:
Seth Alves 2016-03-13 08:35:21 -07:00
parent 0a2fb77698
commit 415f21c189

View file

@ -86,6 +86,11 @@ void EntityTree::postAddEntity(EntityItemPointer entity) {
if (_simulation) {
_simulation->addEntity(entity);
}
if (!entity->isParentIDValid()) {
_missingParent.append(entity);
}
_isDirty = true;
maybeNotifyNewCollisionSoundURL("", entity->getCollisionSoundURL());
emit addingEntity(entity->getEntityItemID());
@ -252,6 +257,9 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
_missingParent.append(childEntity);
continue;
}
if (!childEntity->isParentIDValid()) {
_missingParent.append(childEntity);
}
UpdateEntityOperator theChildOperator(getThisPointer(), containingElement, childEntity, queryCube);
recurseTreeWithOperator(&theChildOperator);
@ -1004,15 +1012,20 @@ void EntityTree::fixupMissingParents() {
EntityItemWeakPointer entityWP = iter.next();
EntityItemPointer entity = entityWP.lock();
if (entity) {
bool success;
AACube newCube = entity->getQueryAACube(success);
if (success) {
// this entity's parent (or ancestry) was previously not fully known, and now is. Update its
// location in the EntityTree.
if (entity->isParentIDValid()) {
// this entity's parent was previously not known, and now is. Update its location in the EntityTree...
bool success;
AACube newCube = entity->getQueryAACube(success);
if (!success) {
continue;
}
moveOperator.addEntityToMoveList(entity, newCube);
iter.remove();
entity->markAncestorMissing(false);
} else if (_avatarIDs.contains(entity->getParentID())) {
if (!_childrenOfAvatars.contains(entity->getParentID())) {
_childrenOfAvatars[entity->getParentID()] = QSet<EntityItemID>();
}
_childrenOfAvatars[entity->getParentID()] += entity->getEntityItemID();
iter.remove();
entity->markAncestorMissing(false);