diff --git a/src/RWMesh/RWMesh_MaterialMap.cxx b/src/RWMesh/RWMesh_MaterialMap.cxx index edbc8d93f7..fcfb73ff3e 100644 --- a/src/RWMesh/RWMesh_MaterialMap.cxx +++ b/src/RWMesh/RWMesh_MaterialMap.cxx @@ -167,7 +167,9 @@ bool RWMesh_MaterialMap::CopyTexture (TCollection_AsciiString& theResTexture, TCollection_AsciiString aTexFileName; TCollection_AsciiString aTextureSrc = theTexture->FilePath(); - if (!aTextureSrc.IsEmpty()) + if (!aTextureSrc.IsEmpty() + && theTexture->FileOffset() <= 0 + && theTexture->FileLength() <= 0) { TCollection_AsciiString aSrcTexFolder; OSD_Path::FolderAndFileFromPath (aTextureSrc, aSrcTexFolder, aTexFileName); diff --git a/tests/de_mesh/gltf_write/lantern b/tests/de_mesh/gltf_write/lantern new file mode 100644 index 0000000000..fb9eaa2542 --- /dev/null +++ b/tests/de_mesh/gltf_write/lantern @@ -0,0 +1,19 @@ +puts "========" +puts "0031816: Data Exchange - RWMesh_MaterialMap::CopyTexture() copies glb file instead of a texture inside it" +puts "========" + +catch { Close D1 } +ReadGltf D1 [locate_data_file bug30691_Lantern.glb] + +set aTmpGltfBase "${imagedir}/${casename}_tmp" +set aTmpGltf "${aTmpGltfBase}.gltf" +lappend occ_tmp_files $aTmpGltf +lappend occ_tmp_files "${aTmpGltfBase}.bin" +lappend occ_tmp_files "${aTmpGltfBase}_textures" + +WriteGltf D1 "$aTmpGltf" + +ReadGltf D "$aTmpGltf" +XGetOneShape s D +checknbshapes s -face 3 -compound 1 +checktrinfo s -tri 5394 -nod 4145