Merge pull request #13693 from NissimHadar/bug16943

Corrects loading of texture and default visibility.
This commit is contained in:
John Conklin II 2018-07-26 09:10:55 -07:00 committed by GitHub
commit 5efd981ecd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -27,10 +27,6 @@ ModelOverlay::ModelOverlay()
{
_model->setLoadingPriority(_loadPriority);
_isLoaded = false;
// Don't show overlay until textures have loaded
_visible = false;
render::ScenePointer scene = qApp->getMain3DScene();
_model->setVisibleInScene(false, scene);
}
@ -136,11 +132,13 @@ void ModelOverlay::update(float deltatime) {
}
scene->enqueueTransaction(transaction);
if (_texturesDirty && !_modelTextures.isEmpty()) {
_texturesDirty = false;
_model->setTextures(_modelTextures);
}
if (!_texturesLoaded && _model->getGeometry() && _model->getGeometry()->areTexturesLoaded()) {
_texturesLoaded = true;
if (!_modelTextures.isEmpty()) {
_model->setTextures(_modelTextures);
}
_model->setVisibleInScene(getVisible(), scene);
_model->updateRenderItems();
@ -242,6 +240,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
_texturesLoaded = false;
QVariantMap textureMap = texturesValue.toMap();
_modelTextures = textureMap;
_texturesDirty = true;
}
auto groupCulledValue = properties["isGroupCulled"];

View file

@ -94,6 +94,7 @@ private:
ModelPointer _model;
QVariantMap _modelTextures;
bool _texturesLoaded { false };
bool _texturesDirty { false };
render::ItemIDs _subRenderItemIDs;