@@ -437,7 +437,7 @@ struct vtkF3DQuakeMDLImporter::vtkInternals
437
437
std::vector<std::vector<double >> AnimationTimes;
438
438
std::vector<std::vector<vtkSmartPointer<vtkPolyData>>> AnimationFrames;
439
439
440
- vtkIdType ActiveAnimation = 0 ;
440
+ vtkIdType ActiveAnimation = - 1 ;
441
441
};
442
442
443
443
// ----------------------------------------------------------------------------
@@ -461,20 +461,23 @@ void vtkF3DQuakeMDLImporter::ImportActors(vtkRenderer* renderer)
461
461
// ----------------------------------------------------------------------------
462
462
bool vtkF3DQuakeMDLImporter::UpdateAtTimeValue (double timeValue)
463
463
{
464
- const std::vector<double >& times =
465
- this ->Internals ->AnimationTimes [this ->Internals ->ActiveAnimation ];
464
+ if (this ->Internals ->ActiveAnimation != -1 )
465
+ {
466
+ const std::vector<double >& times =
467
+ this ->Internals ->AnimationTimes [this ->Internals ->ActiveAnimation ];
466
468
467
- // Find frameIndex for the provided timeValue so that t0 <= timeValue < t1
469
+ // Find frameIndex for the provided timeValue so that t0 <= timeValue < t1
468
470
469
- // First time >= value
470
- const auto found = std::lower_bound (times.begin (), times.end (), timeValue);
471
- // If none, select last, if found, select distance
472
- const size_t i = found == times.end () ? times.size () - 1 : std::distance (times.begin (), found);
473
- // If found time > timeValue, the the previous one
474
- const size_t frameIndex = *found > timeValue && i > 0 ? i - 1 : i;
471
+ // First time >= value
472
+ const auto found = std::lower_bound (times.begin (), times.end (), timeValue);
473
+ // If none, select last, if found, select distance
474
+ const size_t i = found == times.end () ? times.size () - 1 : std::distance (times.begin (), found);
475
+ // If found time > timeValue, the the previous one
476
+ const size_t frameIndex = *found > timeValue && i > 0 ? i - 1 : i;
475
477
476
- this ->Internals ->Mapper ->SetInputData (
477
- this ->Internals ->AnimationFrames [this ->Internals ->ActiveAnimation ][frameIndex]);
478
+ this ->Internals ->Mapper ->SetInputData (
479
+ this ->Internals ->AnimationFrames [this ->Internals ->ActiveAnimation ][frameIndex]);
480
+ }
478
481
return true ;
479
482
}
480
483
0 commit comments