diff --git a/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.cxx b/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.cxx index 52cbc1072f..3fc1943471 100644 --- a/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.cxx +++ b/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -2460,6 +2461,18 @@ void RWGltf_GltfJsonParser::bindNamedShape(TopoDS_Shape& the bool RWGltf_GltfJsonParser::fillMeshData( const Handle(RWGltf_GltfLatePrimitiveArray)& theMeshData) const { + if (myStream == nullptr) + { + const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem(); + myStream = aFileSystem->OpenIStream(myFilePath, std::ios::in | std::ios::binary); + } + + if (myStream == nullptr) + { + reportGltfError("Buffer '" + myFilePath + "' isn't defined."); + return false; + } + for (NCollection_Sequence::Iterator aDataIter(theMeshData->Data()); aDataIter.More(); aDataIter.Next()) diff --git a/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.hxx b/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.hxx index e897d5bfaf..7982d2e41d 100644 --- a/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.hxx +++ b/src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.hxx @@ -445,7 +445,7 @@ protected: // clang-format on TColStd_IndexedDataMapOfStringString* myMetadata; //!< file metadata - std::shared_ptr myStream; //!< input stream + mutable std::shared_ptr myStream; //!< input stream NCollection_DataMap myMaterialsPbr;