From ddec4bd8984b3797c59d32e603c8cdf5ed5303fd Mon Sep 17 00:00:00 2001 From: Viktor Kovacs Date: Tue, 20 Apr 2021 11:48:08 +0200 Subject: [PATCH] Clear importer data after import. --- source/import/importer.js | 3 +++ source/import/importerbase.js | 3 +++ test/utils/testfiles.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/source/import/importer.js b/source/import/importer.js index 784fea2..592f843 100644 --- a/source/import/importer.js +++ b/source/import/importer.js @@ -344,6 +344,9 @@ OV.Importer = class onError : function () { let message = importer.GetMessage (); callbacks.onError (new OV.ImportError (OV.ImportErrorCode.ImportFailed, message)); + }, + onComplete : function () { + importer.Clear (); } }); } diff --git a/source/import/importerbase.js b/source/import/importerbase.js index 0dccacf..f9bb20d 100644 --- a/source/import/importerbase.js +++ b/source/import/importerbase.js @@ -36,17 +36,20 @@ OV.ImporterBase = class { if (this.error) { callbacks.onError (); + callbacks.onComplete (); return; } if (OV.IsModelEmpty (this.model)) { this.error = true; callbacks.onError (); + callbacks.onComplete (); return; } OV.FinalizeModel (this.model, this.callbacks.getDefaultMaterial); callbacks.onSuccess (); + callbacks.onComplete (); } CanImportExtension (extension) diff --git a/test/utils/testfiles.js b/test/utils/testfiles.js index fc4d519..58f2a82 100644 --- a/test/utils/testfiles.js +++ b/test/utils/testfiles.js @@ -84,6 +84,9 @@ module.exports = }, onError : function () { onReady (model); + }, + onComplete : function () { + } }); }