Skip to content
Snippets Groups Projects
Commit 734b5e7f authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri :speech_balloon: Committed by Kitware Robot
Browse files

Merge topic 'gltf_scene'


48eac350 GLTF document loader caches a default scene

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarbuildbot <buildbot@kitware.com>
Reviewed-by: default avatarAlexy Pellegrini <alexy.pellegrini@kitware.com>
Reviewed-by: default avatarDan Lipsa <dan.lipsa@kitware.com>
Merge-request: !11836
parents 13b84d1b 48eac350
No related branches found
No related tags found
No related merge requests found
## GLTF document loader default scene
The `vtkGLTFDocumentLoader` ensures that the internal cache of scenes is non-empty for consumer code
that have to rely on checking validity of the default scene.
...@@ -1473,6 +1473,12 @@ bool vtkGLTFDocumentLoaderInternals::LoadModelMetaData( ...@@ -1473,6 +1473,12 @@ bool vtkGLTFDocumentLoaderInternals::LoadModelMetaData(
if (!vtkGLTFUtils::GetIntValue(root, "scene", this->Self->GetInternalModel()->DefaultScene)) if (!vtkGLTFUtils::GetIntValue(root, "scene", this->Self->GetInternalModel()->DefaultScene))
{ {
int nbScenes = static_cast<int>(this->Self->GetInternalModel()->Scenes.size()); int nbScenes = static_cast<int>(this->Self->GetInternalModel()->Scenes.size());
if (nbScenes < 1)
{
// In case the file had no scenes, add an empty scene so that downstream code doesn't need to
// check that its default scene index is valid
this->Self->GetInternalModel()->Scenes.resize(1);
}
if (this->Self->GetInternalModel()->DefaultScene < 0 || if (this->Self->GetInternalModel()->DefaultScene < 0 ||
this->Self->GetInternalModel()->DefaultScene >= nbScenes) this->Self->GetInternalModel()->DefaultScene >= nbScenes)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment