Merge pull request #9390 from sethalves/load-models-in-keyhole

fix physics not starting up when a model is close behind
This commit is contained in:
Seth Alves 2017-01-16 18:06:23 -08:00 committed by GitHub
commit f900629cdb
2 changed files with 10 additions and 2 deletions

View file

@ -5297,15 +5297,17 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
if (_nearbyEntitiesStabilityCount >= MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT) {
// We've seen the same number of nearby entities for several stats packets in a row. assume we've got all
// the local entities.
bool result = true;
foreach (EntityItemPointer entity, entities) {
if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {
static QString repeatedMessage =
LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*");
qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();
return false;
// don't break here because we want all the relevant entities to start their downloads
result = false;
}
}
return true;
return result;
}
return false;
}

View file

@ -646,6 +646,12 @@ bool RenderableModelEntityItem::isReadyToComputeShape() {
// the model is still being downloaded.
return false;
} else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) {
if (!_model) {
EntityTreePointer tree = getTree();
if (tree) {
QMetaObject::invokeMethod(tree.get(), "callLoader", Qt::QueuedConnection, Q_ARG(EntityItemID, getID()));
}
}
return (_model && _model->isLoaded());
}
return true;