mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-28 22:49:54 +02:00
Merge pull request #6917 from AndrewMeadows/cf-empty-model-url
fix crash for empty modelUrl in ModelEntityItem
This commit is contained in:
commit
15ff106947
1 changed files with 11 additions and 6 deletions
|
@ -480,12 +480,17 @@ Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
|
||||||
} else { // we already have the model we want...
|
} else { // we already have the model we want...
|
||||||
result = _model;
|
result = _model;
|
||||||
}
|
}
|
||||||
} else { // if our desired URL is empty, we may need to delete our existing model
|
} else if (_model) {
|
||||||
if (_model) {
|
// remove from scene
|
||||||
_myRenderer->releaseModel(_model);
|
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||||
result = _model = NULL;
|
render::PendingChanges pendingChanges;
|
||||||
_needsInitialSimulation = true;
|
_model->removeFromScene(scene, pendingChanges);
|
||||||
}
|
scene->enqueuePendingChanges(pendingChanges);
|
||||||
|
|
||||||
|
// release interest
|
||||||
|
_myRenderer->releaseModel(_model);
|
||||||
|
result = _model = NULL;
|
||||||
|
_needsInitialSimulation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue