------------------------------------------------------------------------------
| 669 | |
| 670 | //------------------------------------------------------------------------------ |
| 671 | int vtkGLTFReader::RequestInformation( |
| 672 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 673 | { |
| 674 | if (!this->Superclass::RequestInformation(request, inputVector, outputVector)) |
| 675 | { |
| 676 | return 0; |
| 677 | } |
| 678 | |
| 679 | // Read file metadata |
| 680 | // Make sure we have a file to read |
| 681 | |
| 682 | if (this->Stream) |
| 683 | { |
| 684 | // Check for stream change in case the loader was already created |
| 685 | if (this->Loader != nullptr && this->Loader->GetInternalModel() && |
| 686 | (this->Loader->GetInternalModel()->Stream != this->Stream || |
| 687 | this->Stream->GetMTime() != this->LastStreamTimeStamp)) |
| 688 | { |
| 689 | this->IsMetaDataLoaded = false; |
| 690 | this->IsModelLoaded = false; |
| 691 | this->Textures.clear(); |
| 692 | } |
| 693 | |
| 694 | this->InitializeLoader(); |
| 695 | if (!this->Loader->LoadModelMetaDataFromStream(this->Stream, this->URILoader)) |
| 696 | { |
| 697 | vtkErrorMacro("Error loading model metadata from stream"); |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | this->LastStreamTimeStamp = this->Stream->GetMTime(); |
| 702 | |
| 703 | vtkNew<vtkEventForwarderCommand> forwarder; |
| 704 | forwarder->SetTarget(this); |
| 705 | this->Loader->AddObserver(vtkCommand::ProgressEvent, forwarder); |
| 706 | |
| 707 | this->CreateAnimationSelection(); |
| 708 | this->CreateSceneNamesArray(); |
| 709 | this->SetCurrentScene(this->Loader->GetInternalModel()->DefaultScene); |
| 710 | this->IsMetaDataLoaded = true; |
| 711 | } |
| 712 | else if (this->FileName) |
| 713 | { |
| 714 | std::string fileNameAsString(this->FileName); |
| 715 | |
| 716 | if (fileNameAsString.find('\\') != std::string::npos) |
| 717 | { |
| 718 | vtksys::SystemTools::ConvertToUnixSlashes(fileNameAsString); |
| 719 | } |
| 720 | |
| 721 | if (!vtksys::SystemTools::FileIsFullPath(fileNameAsString)) |
| 722 | { |
| 723 | fileNameAsString = vtksys::SystemTools::CollapseFullPath(fileNameAsString); |
| 724 | } |
| 725 | |
| 726 | if (this->FileName != fileNameAsString) |
| 727 | { |
| 728 | this->SetFileName(fileNameAsString.c_str()); |
nothing calls this directly
no test coverage detected