Move incompatible argument checking to bin file

This commit is contained in:
Sean Lilley 2017-07-28 17:34:56 -04:00
parent 3da691df62
commit 487eca91f8
2 changed files with 19 additions and 13 deletions

View File

@ -122,6 +122,16 @@ var argv = yargs
}
}).parse(args);
if (argv.metallicRoughness + argv.specularGlossiness + argv.materialsCommon > 1) {
console.error('Only one material type may be set from [--metallicRoughness, --specularGlossiness, --materialsCommon].');
process.exit(1);
}
if (defined(argv.metallicRoughnessOcclusionTexture) && defined(argv.specularGlossinessTexture)) {
console.error('--metallicRoughnessOcclusionTexture and --specularGlossinessTexture cannot both be set.');
process.exit(1);
}
var objPath = argv.i;
var gltfPath = argv.o;
@ -157,7 +167,6 @@ var options = {
console.time('Total');
try {
obj2gltf(objPath, gltfPath, options)
.then(function() {
console.timeEnd('Total');
@ -165,6 +174,3 @@ try {
.catch(function(error) {
console.log(error.message);
});
} catch(error) {
console.log(error.message);
}

View File

@ -83,11 +83,11 @@ function obj2gltf(objPath, gltfPath, options) {
}
if (metallicRoughness + specularGlossiness + materialsCommon > 1) {
throw new DeveloperError('Only one material type may be set from [--metallicRoughness, --specularGlossiness, --materialsCommon].');
throw new DeveloperError('Only one material type may be set from [metallicRoughness, specularGlossiness, materialsCommon].');
}
if (defined(overridingImages.metallicRoughnessOcclusionTexture) && defined(overridingImages.specularGlossinessTexture)) {
throw new DeveloperError('options.overridingImages.metallicRoughnessOcclusionTexture and options.overridingImages.specularGlossinessTexture cannot both be defined.');
throw new DeveloperError('metallicRoughnessOcclusionTexture and specularGlossinessTexture cannot both be defined.');
}
if (defined(overridingImages.metallicRoughnessOcclusionTexture)) {