mirror of
https://github.com/overte-org/overte.git
synced 2025-06-05 15:10:37 +02:00
Don't fire onGeoMappLoading twice
This commit is contained in:
parent
05895f628a
commit
c8aeecdabd
1 changed files with 11 additions and 5 deletions
|
@ -46,6 +46,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GeometryResource::Pointer _geometryResource;
|
GeometryResource::Pointer _geometryResource;
|
||||||
|
QMetaObject::Connection _connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
||||||
|
@ -77,21 +78,26 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
||||||
if (_geometryResource->isLoaded()) {
|
if (_geometryResource->isLoaded()) {
|
||||||
onGeometryMappingLoaded(!_geometryResource->getURL().isEmpty());
|
onGeometryMappingLoaded(!_geometryResource->getURL().isEmpty());
|
||||||
} else {
|
} else {
|
||||||
connect(_geometryResource.data(), &Resource::finished, this, &GeometryMappingResource::onGeometryMappingLoaded);
|
if (_connection) {
|
||||||
|
disconnect(_connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
_connection = connect(_geometryResource.data(), &Resource::finished,
|
||||||
|
this, &GeometryMappingResource::onGeometryMappingLoaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryMappingResource::onGeometryMappingLoaded(bool success) {
|
void GeometryMappingResource::onGeometryMappingLoaded(bool success) {
|
||||||
if (success) {
|
if (success && _geometryResource) {
|
||||||
_geometry = _geometryResource->_geometry;
|
_geometry = _geometryResource->_geometry;
|
||||||
_shapes = _geometryResource->_shapes;
|
_shapes = _geometryResource->_shapes;
|
||||||
_meshes = _geometryResource->_meshes;
|
_meshes = _geometryResource->_meshes;
|
||||||
_materials = _geometryResource->_materials;
|
_materials = _geometryResource->_materials;
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid holding onto extra references
|
// Avoid holding onto extra references
|
||||||
_geometryResource.reset();
|
_geometryResource.reset();
|
||||||
|
}
|
||||||
|
|
||||||
finishedLoading(success);
|
finishedLoading(success);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue