mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-02 00:44:43 -05:00
Merge pull request #2753 from OpenSpace/issue/2679
Don't call update function unless layer has been initialized
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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