mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Don't call update function unless layer has been initialized
This commit is contained in:
@@ -438,6 +438,10 @@ bool Layer::enabled() const {
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
bool Layer::isInitialized() const {
|
||||
return _isInitialized;
|
||||
}
|
||||
|
||||
TileProvider* Layer::tileProvider() const {
|
||||
return _tileProvider.get();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user