Skip to content

Commit 5b0958f

Browse files
author
Benjamin Délèze
authored
Fix OBJ DAE (#6030)
* Fix OBJ DAE * tolowercase
1 parent 254967d commit 5b0958f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

resources/web/wwi/nodes/WbCadShape.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ export default class WbCadShape extends WbBaseNode {
3232
#wrenTransforms;
3333
constructor(id, url, ccw, castShadows, isPickable, prefix) {
3434
super(id);
35-
if (url.endsWith('.obj') || url.endsWith('.dae'))
35+
if (url.toLowerCase().endsWith('.obj') || url.toLowerCase().endsWith('.dae'))
3636
this.#url = url;
3737

3838
if (typeof this.#url === 'undefined') { // no '.dae' or '.obj' was provided
3939
console.error('Invalid URL. CadShape node expects file in Collada (".dae") or Wavefront (".obj") format.');
4040
return;
4141
}
4242

43-
this.#isCollada = this.#url.endsWith('.dae');
43+
this.#isCollada = this.#url.toLowerCase().endsWith('.dae');
4444

4545
this.prefix = prefix;
4646

@@ -96,7 +96,7 @@ export default class WbCadShape extends WbBaseNode {
9696
}
9797

9898
set url(newUrl) {
99-
if (newUrl.endsWith('.obj') || newUrl.endsWith('.dae'))
99+
if (newUrl.toLowerCase().endsWith('.obj') || newUrl.toLowerCase().endsWith('.dae'))
100100
this.#url = newUrl;
101101
else
102102
console.error('Unknown file provided to CadShape node: ' + newUrl);
@@ -477,7 +477,7 @@ export default class WbCadShape extends WbBaseNode {
477477

478478
#updateUrl() {
479479
if (this.#url)
480-
this.#isCollada = this.#url.endsWith('.dae');
480+
this.#isCollada = this.#url.toLowerCase().endsWith('.dae');
481481

482482
MeshLoader.loadMeshData(WbWorld.instance.prefix, this.#url).then(meshContent => {
483483
this.scene = meshContent[0];

resources/web/wwi/nodes/WbMesh.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class WbMesh extends WbTriangleMeshGeometry {
2020
this.#name = name;
2121
this.#materialIndex = materialIndex;
2222
if (this.#url)
23-
this.#isCollada = this.#url.endsWith('.dae');
23+
this.#isCollada = this.#url.toLowerCase().endsWith('.dae');
2424
}
2525

2626
get nodeType() {
@@ -182,7 +182,7 @@ export default class WbMesh extends WbTriangleMeshGeometry {
182182

183183
#updateUrl() {
184184
if (this.#url) {
185-
this.#isCollada = this.#url.endsWith('.dae');
185+
this.#isCollada = this.#url.toLowerCase().endsWith('.dae');
186186

187187
MeshLoader.loadMeshData(WbWorld.instance.prefix, this.#url).then(meshContent => {
188188
this.scene = meshContent[0];

0 commit comments

Comments
 (0)