mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +02:00
Don't cache nested geometries
This commit is contained in:
parent
4d47126ae4
commit
aa038bac58
2 changed files with 15 additions and 3 deletions
|
@ -67,7 +67,15 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
|||
|
||||
// Get the raw GeometryResource, not the wrapped NetworkGeometry
|
||||
_geometryResource = modelCache->getResource(url, QUrl(), true, &extra).staticCast<GeometryResource>();
|
||||
connect(_geometryResource.data(), &Resource::finished, this, &GeometryMappingResource::onGeometryMappingLoaded);
|
||||
|
||||
if (_geometryResource->isLoaded()) {
|
||||
onGeometryMappingLoaded(!_geometryResource->getURL().isEmpty());
|
||||
} else {
|
||||
connect(_geometryResource.data(), &Resource::finished, this, &GeometryMappingResource::onGeometryMappingLoaded);
|
||||
}
|
||||
|
||||
// Avoid caching nested resources - their references will be held by the parent
|
||||
_geometryResource->_isCacheable = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +298,7 @@ NetworkGeometry::NetworkGeometry(const GeometryResource::Pointer& networkGeometr
|
|||
connect(_resource.data(), &Resource::finished, this, &NetworkGeometry::resourceFinished);
|
||||
connect(_resource.data(), &Resource::onRefresh, this, &NetworkGeometry::resourceRefreshed);
|
||||
if (_resource->isLoaded()) {
|
||||
resourceFinished(true);
|
||||
resourceFinished(!_resource->getURL().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,11 @@ public:
|
|||
virtual bool areTexturesLoaded() const { return isLoaded() && Geometry::areTexturesLoaded(); }
|
||||
|
||||
protected:
|
||||
virtual bool isCacheable() const override { return _loaded; }
|
||||
friend class GeometryMappingResource;
|
||||
|
||||
virtual bool isCacheable() const override { return _loaded && _isCacheable; }
|
||||
|
||||
bool _isCacheable { true };
|
||||
};
|
||||
|
||||
class NetworkGeometry : public QObject {
|
||||
|
|
Loading…
Reference in a new issue