Add support for reading glTF files

Contributes to issue CURA-6739.
This commit is contained in:
Ghostkeeper 2019-08-29 15:14:35 +02:00
parent 3a3ba6d590
commit e761b2c2a7
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 23 additions and 1 deletions

View file

@ -27,7 +27,7 @@ class TrimeshReader(MeshReader):
def __init__(self) -> None:
super().__init__()
self._supported_extensions = [".dae", ".ply"]
self._supported_extensions = [".dae", ".gltf", ".glb", ".ply"]
MimeTypeDatabase.addMimeType(
MimeType(
name = "model/vnd.collada+xml",
@ -35,6 +35,20 @@ class TrimeshReader(MeshReader):
suffixes = ["dae"]
)
)
MimeTypeDatabase.addMimeType(
MimeType(
name = "model/gltf-binary",
comment = "glTF Binary",
suffixes = ["glb"]
)
)
MimeTypeDatabase.addMimeType(
MimeType(
name = "model/gltf+json",
comment = "glTF Embedded JSON",
suffixes = ["gltf"]
)
)
MimeTypeDatabase.addMimeType(
MimeType(
name = "application/x-ply", # Wikipedia lists the MIME type as "text/plain" but that won't do as it's not unique to PLY files.