Don't save out two bins

This commit is contained in:
Sean Lilley 2017-04-14 12:00:43 -04:00
parent 45feac8dd0
commit a6ff230fc3
1 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,7 @@ var loadObj = require('./loadObj');
var writeUris = require('./writeUris'); var writeUris = require('./writeUris');
var fsExtraOutputJson = Promise.promisify(fsExtra.outputJson); var fsExtraOutputJson = Promise.promisify(fsExtra.outputJson);
var fsExtraRemove = Promise.promisify(fsExtra.remove);
var defaultValue = Cesium.defaultValue; var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined; var defined = Cesium.defined;
@ -117,9 +118,22 @@ function obj2gltf(objPath, gltfPath, options) {
} else { } else {
return GltfPipeline.processJSONToDisk(gltf, gltfPath, pipelineOptions); return GltfPipeline.processJSONToDisk(gltf, gltfPath, pipelineOptions);
} }
})
.then(function() {
return cleanup(gltfPath, options);
}); });
} }
function cleanup(gltfPath, options) {
// gltf-pipeline also saves out a buffer so remove the one generated by obj2gltf
if (!options.bypassPipeline && options.separate) {
var bufferName = path.basename(gltfPath, path.extname(gltfPath));
var bufferUri = bufferName + '.bin';
var bufferPath = path.join(path.dirname(gltfPath), bufferUri);
return fsExtraRemove(bufferPath);
}
}
/** /**
* Default values that will be used when calling obj2gltf(options) unless specified in the options object. * Default values that will be used when calling obj2gltf(options) unless specified in the options object.
*/ */