diff --git a/library/private/animationManager.h b/library/private/animationManager.h index d5434caae8..32d1e29a76 100644 --- a/library/private/animationManager.h +++ b/library/private/animationManager.h @@ -51,6 +51,10 @@ class animationManager void DisableAllAnimation(); int GetAnimationIndex(); + /** + * Return the current animation name if any + * Can be called before initialization safely + */ std::string GetAnimationName(); /** diff --git a/library/src/animationManager.cxx b/library/src/animationManager.cxx index f610163f5a..44a71be3f6 100644 --- a/library/src/animationManager.cxx +++ b/library/src/animationManager.cxx @@ -19,6 +19,7 @@ namespace f3d::detail bool animationManager::Initialize( const options* options, window* window, interactor_impl* interactor, vtkImporter* importer) { + assert(importer); this->HasAnimation = false; this->Playing = false; this->CurrentTime = 0; @@ -260,6 +261,7 @@ void animationManager::Tick() //---------------------------------------------------------------------------- bool animationManager::LoadAtTime(double timeValue) { + assert(this->Importer); if (!this->HasAnimation) { return false; @@ -316,6 +318,11 @@ int animationManager::GetAnimationIndex() // --------------------------------------------------------------------------------- std::string animationManager::GetAnimationName() { + if (!this->Importer) + { + return ""; + } + if (this->AnimationIndex == -1) { return "All Animations"; @@ -325,6 +332,7 @@ std::string animationManager::GetAnimationName() //---------------------------------------------------------------------------- void animationManager::EnableAllAnimation() { + assert(this->Importer); if (this->AnimationIndex == this->AvailAnimations - 1) { for (int i = 0; i < this->AvailAnimations; i++) @@ -340,6 +348,7 @@ void animationManager::EnableAllAnimation() //---------------------------------------------------------------------------- void animationManager::DisableAllAnimation() { + assert(this->Importer); if (this->AnimationIndex == this->AvailAnimations - 1) { for (int i = 0; i < this->AvailAnimations; i++) @@ -359,4 +368,4 @@ void animationManager::GetTimeRange(double timeRange[2]) timeRange[0] = this->TimeRange[0]; timeRange[1] = this->TimeRange[1]; } -} \ No newline at end of file +}