Merge pull request #2753 from OpenSpace/issue/2679

Don't call update function unless layer has been initialized
This commit is contained in:
Ylva Selling
2023-06-13 10:53:17 -04:00
committed by GitHub
3 changed files with 8 additions and 1 deletions
+5
View File
@@ -384,6 +384,7 @@ void Layer::initialize() {
if (_tileProvider) {
_tileProvider->initialize();
}
_isInitialized = true;
}
void Layer::deinitialize() {
@@ -438,6 +439,10 @@ bool Layer::enabled() const {
return _enabled;
}
bool Layer::isInitialized() const {
return _isInitialized;
}
TileProvider* Layer::tileProvider() const {
return _tileProvider.get();
}
+2
View File
@@ -58,6 +58,7 @@ public:
TileDepthTransform depthTransform() const;
void setEnabled(bool enabled);
bool enabled() const;
bool isInitialized() const;
TileProvider* tileProvider() const;
glm::vec3 solidColor() const;
const LayerRenderSettings& renderSettings() const;
@@ -99,6 +100,7 @@ private:
const layers::Group::ID _layerGroupId;
std::function<void(Layer*)> _onChangeCallback;
bool _isInitialized = false;
};
} // namespace openspace::globebrowsing
+1 -1
View File
@@ -91,7 +91,7 @@ void LayerGroup::update() {
_activeLayers.clear();
for (const std::unique_ptr<Layer>& layer : _layers) {
if (layer->enabled()) {
if (layer->enabled() && layer->isInitialized()) {
layer->update();
_activeLayers.push_back(layer.get());
}