mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-31 03:53:13 -05:00
Don't save out two bins
This commit is contained in:
parent
45feac8dd0
commit
a6ff230fc3
@ -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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user