Handle multiple zip files.
This commit is contained in:
parent
87a7fffc4f
commit
30830e8431
@ -225,7 +225,8 @@ OV.Importer = class
|
||||
}
|
||||
OV.LoadExternalLibrary ('loaders/fflate.min.js').then (() => {
|
||||
for (let i = 0; i < archives.length; i++) {
|
||||
const archiveBuffer = new Uint8Array (archives[0].content);
|
||||
const archiveFile = archives[i];
|
||||
const archiveBuffer = new Uint8Array (archiveFile.content);
|
||||
const decompressed = fflate.unzipSync (archiveBuffer);
|
||||
for (const fileName in decompressed) {
|
||||
if (Object.prototype.hasOwnProperty.call (decompressed, fileName)) {
|
||||
|
||||
BIN
test/testfiles/zip/cube_with_materials_notexture.zip
Normal file
BIN
test/testfiles/zip/cube_with_materials_notexture.zip
Normal file
Binary file not shown.
@ -302,5 +302,24 @@ describe ('Importer Test', function () {
|
||||
assert.fail ();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it ('Multiple Zip Files', function (done) {
|
||||
let files = [
|
||||
new FileObject ('zip', 'cube_with_materials_notexture.zip'),
|
||||
new FileObject ('zip', 'textures.zip')
|
||||
];
|
||||
ImportFiles (files, {
|
||||
success : function (importer, importResult) {
|
||||
assert (!OV.IsModelEmpty (importResult.model));
|
||||
console.log (importResult.usedFiles);
|
||||
assert.deepStrictEqual (importResult.usedFiles, ['cube_with_materials.obj', 'cube_with_materials.mtl', 'cube_texture.png']);
|
||||
assert.deepStrictEqual (importResult.missingFiles, []);
|
||||
done ();
|
||||
},
|
||||
error : function (importer, importError) {
|
||||
assert.fail ();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user