mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-11-23 08:34:14 -05:00
Remove double quotes in the mtl and texture paths so that the file can be read properly
This commit is contained in:
parent
2d19cab824
commit
b99d243f4d
@ -101,6 +101,8 @@ function loadMtl(mtlPath, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function normalizeTexturePath(texturePath, mtlDirectory) {
|
function normalizeTexturePath(texturePath, mtlDirectory) {
|
||||||
|
//Remove double quotes around the texture file if it exists
|
||||||
|
texturePath = texturePath.replace(/^"(.+)"$/, "$1");
|
||||||
// Removes texture options from texture name
|
// Removes texture options from texture name
|
||||||
// Assumes no spaces in texture name
|
// Assumes no spaces in texture name
|
||||||
const re = /-(bm|t|s|o|blendu|blendv|boost|mm|texres|clamp|imfchan|type)/;
|
const re = /-(bm|t|s|o|blendu|blendv|boost|mm|texres|clamp|imfchan|type)/;
|
||||||
|
@ -519,6 +519,8 @@ function loadObj(objPath, options) {
|
|||||||
function getMtlPaths(mtllibLine) {
|
function getMtlPaths(mtllibLine) {
|
||||||
// Handle paths with spaces. E.g. mtllib my material file.mtl
|
// Handle paths with spaces. E.g. mtllib my material file.mtl
|
||||||
const mtlPaths = [];
|
const mtlPaths = [];
|
||||||
|
//Remove double quotes around the mtl file if it exists
|
||||||
|
mtllibLine = mtllibLine.replace(/^"(.+)"$/, "$1");
|
||||||
const splits = mtllibLine.split(" ");
|
const splits = mtllibLine.split(" ");
|
||||||
const length = splits.length;
|
const length = splits.length;
|
||||||
let startIndex = 0;
|
let startIndex = 0;
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
"jasmine": "^5.0.0",
|
"jasmine": "^5.0.0",
|
||||||
"jasmine-spec-reporter": "^7.0.0",
|
"jasmine-spec-reporter": "^7.0.0",
|
||||||
"jsdoc": "^4.0.0",
|
"jsdoc": "^4.0.0",
|
||||||
|
"lint-staged": "^14.0.1",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"prettier": "3.0.3",
|
"prettier": "3.0.3"
|
||||||
"lint-staged": "^14.0.1"
|
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(js|ts)": [
|
"*.(js|ts)": [
|
||||||
@ -72,4 +72,4 @@
|
|||||||
"bin": {
|
"bin": {
|
||||||
"obj2gltf": "./bin/obj2gltf.js"
|
"obj2gltf": "./bin/obj2gltf.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user