@@ -413,20 +413,6 @@ struct vtkF3DQuakeMDLImporter::vtkInternals
413
413
return ret;
414
414
}
415
415
416
- // ----------------------------------------------------------------------------
417
- void ImportActors (vtkRenderer* renderer)
418
- {
419
- vtkNew<vtkActor> actor;
420
- vtkNew<vtkPolyDataMapper> mapper;
421
- mapper->SetInputData (this ->AnimationFrames [0 ][0 ]);
422
- actor->SetMapper (mapper);
423
- actor->GetProperty ()->SetInterpolationToPBR ();
424
- actor->GetProperty ()->SetBaseColorTexture (Texture);
425
- actor->GetProperty ()->SetBaseIOR (1.0 );
426
- renderer->AddActor (actor);
427
- this ->Mapper = mapper;
428
- }
429
-
430
416
// ----------------------------------------------------------------------------
431
417
vtkF3DQuakeMDLImporter* Parent;
432
418
std::string Description;
@@ -437,7 +423,7 @@ struct vtkF3DQuakeMDLImporter::vtkInternals
437
423
std::vector<std::vector<double >> AnimationTimes;
438
424
std::vector<std::vector<vtkSmartPointer<vtkPolyData>>> AnimationFrames;
439
425
440
- vtkIdType ActiveAnimation = 0 ;
426
+ vtkIdType ActiveAnimation = - 1 ;
441
427
};
442
428
443
429
// ----------------------------------------------------------------------------
@@ -455,26 +441,41 @@ int vtkF3DQuakeMDLImporter::ImportBegin()
455
441
// ----------------------------------------------------------------------------
456
442
void vtkF3DQuakeMDLImporter::ImportActors (vtkRenderer* renderer)
457
443
{
458
- this ->Internals ->ImportActors (renderer);
444
+ vtkNew<vtkActor> actor;
445
+ vtkNew<vtkPolyDataMapper> mapper;
446
+ mapper->SetInputData (this ->Internals ->AnimationFrames [0 ][0 ]);
447
+ actor->SetMapper (mapper);
448
+ actor->GetProperty ()->SetInterpolationToPBR ();
449
+ actor->GetProperty ()->SetBaseColorTexture (this ->Internals ->Texture );
450
+ actor->GetProperty ()->SetBaseIOR (1.0 );
451
+ renderer->AddActor (actor);
452
+ this ->Internals ->Mapper = mapper;
453
+
454
+ #if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 3, 20240707)
455
+ this ->ActorCollection ->AddItem (actor);
456
+ #endif
459
457
}
460
458
461
459
// ----------------------------------------------------------------------------
462
460
bool vtkF3DQuakeMDLImporter::UpdateAtTimeValue (double timeValue)
463
461
{
464
- const std::vector<double >& times =
465
- this ->Internals ->AnimationTimes [this ->Internals ->ActiveAnimation ];
462
+ if (this ->Internals ->ActiveAnimation != -1 )
463
+ {
464
+ const std::vector<double >& times =
465
+ this ->Internals ->AnimationTimes [this ->Internals ->ActiveAnimation ];
466
466
467
- // Find frameIndex for the provided timeValue so that t0 <= timeValue < t1
467
+ // Find frameIndex for the provided timeValue so that t0 <= timeValue < t1
468
468
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;
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;
475
475
476
- this ->Internals ->Mapper ->SetInputData (
477
- this ->Internals ->AnimationFrames [this ->Internals ->ActiveAnimation ][frameIndex]);
476
+ this ->Internals ->Mapper ->SetInputData (
477
+ this ->Internals ->AnimationFrames [this ->Internals ->ActiveAnimation ][frameIndex]);
478
+ }
478
479
return true ;
479
480
}
480
481
0 commit comments