diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-04-18 10:39:07 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-04-18 10:39:07 +0300 |
commit | 45afacf7a630e7e77cdfc58c1b363e6e0e7747a5 (patch) | |
tree | 8fec5e6702a3061845857db8797507b20803d5bf /io_scene_gltf2/io/imp/gltf2_io_gltf.py | |
parent | 4ef5cd10f6895fbee5704d088fdbc493c0874dd9 (diff) |
glTF importer: use friendly filenames for temp image files
Diffstat (limited to 'io_scene_gltf2/io/imp/gltf2_io_gltf.py')
-rwxr-xr-x | io_scene_gltf2/io/imp/gltf2_io_gltf.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/io_scene_gltf2/io/imp/gltf2_io_gltf.py b/io_scene_gltf2/io/imp/gltf2_io_gltf.py index 3224a4a1..88ba5356 100755 --- a/io_scene_gltf2/io/imp/gltf2_io_gltf.py +++ b/io_scene_gltf2/io/imp/gltf2_io_gltf.py @@ -175,7 +175,7 @@ class glTFImporter(): buffer = self.data.buffers[buffer_idx] if buffer.uri: - data, _file_name = self.load_uri(buffer.uri) + data = self.load_uri(buffer.uri) if data is not None: self.buffers[buffer_idx] = data @@ -185,20 +185,18 @@ class glTFImporter(): self.buffers[buffer_idx] = self.glb_buffer def load_uri(self, uri): - """Loads a URI. - Returns the data and the filename of the resource, if there is one. - """ + """Loads a URI.""" sep = ';base64,' if uri.startswith('data:'): idx = uri.find(sep) if idx != -1: data = uri[idx + len(sep):] - return memoryview(base64.b64decode(data)), None + return memoryview(base64.b64decode(data)) path = join(dirname(self.filename), unquote(uri)) try: with open(path, 'rb') as f_: - return memoryview(f_.read()), basename(path) + return memoryview(f_.read()) except Exception: self.log.error("Couldn't read file: " + path) - return None, None + return None |