mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:57:59 +02:00
Addressing some feedback. Making the .obj.gz checks more specific and adding an exception if gunzip fails.
This commit is contained in:
parent
781e2f409f
commit
f8c30c70e8
1 changed files with 5 additions and 2 deletions
|
@ -175,7 +175,7 @@ void GeometryReader::run() {
|
||||||
if (!urlname.isEmpty() && !_url.path().isEmpty() &&
|
if (!urlname.isEmpty() && !_url.path().isEmpty() &&
|
||||||
(_url.path().toLower().endsWith(".fbx") ||
|
(_url.path().toLower().endsWith(".fbx") ||
|
||||||
_url.path().toLower().endsWith(".obj") ||
|
_url.path().toLower().endsWith(".obj") ||
|
||||||
_url.path().toLower().endsWith(".gz"))) {
|
_url.path().toLower().endsWith(".obj.gz"))) {
|
||||||
FBXGeometry::Pointer fbxGeometry;
|
FBXGeometry::Pointer fbxGeometry;
|
||||||
|
|
||||||
if (_url.path().toLower().endsWith(".fbx")) {
|
if (_url.path().toLower().endsWith(".fbx")) {
|
||||||
|
@ -185,11 +185,14 @@ void GeometryReader::run() {
|
||||||
}
|
}
|
||||||
} else if (_url.path().toLower().endsWith(".obj")) {
|
} else if (_url.path().toLower().endsWith(".obj")) {
|
||||||
fbxGeometry.reset(OBJReader().readOBJ(_data, _mapping, _combineParts, _url));
|
fbxGeometry.reset(OBJReader().readOBJ(_data, _mapping, _combineParts, _url));
|
||||||
} else if (_url.path().toLower().endsWith(".gz")) {
|
} else if (_url.path().toLower().endsWith(".obj.gz")) {
|
||||||
QByteArray uncompressedData;
|
QByteArray uncompressedData;
|
||||||
if (gunzip(_data, uncompressedData)){
|
if (gunzip(_data, uncompressedData)){
|
||||||
fbxGeometry.reset(OBJReader().readOBJ(uncompressedData, _mapping, _combineParts, _url));
|
fbxGeometry.reset(OBJReader().readOBJ(uncompressedData, _mapping, _combineParts, _url));
|
||||||
|
} else {
|
||||||
|
throw QString("failed to decompress .obj.gz" );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw QString("unsupported format");
|
throw QString("unsupported format");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue