From 473da0905229366868bfac970dc97b0d1a3fd060 Mon Sep 17 00:00:00 2001 From: Viktor Kovacs Date: Fri, 2 Apr 2021 10:05:18 +0200 Subject: [PATCH] Add function to reload the same model again. --- source/external/three.model.loader.js | 15 +++++++++++++-- source/viewer/domviewer.js | 4 ++-- website/o3dv/loader.js | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/external/three.model.loader.js b/source/external/three.model.loader.js index 7e6157e..6e7a0d2 100644 --- a/source/external/three.model.loader.js +++ b/source/external/three.model.loader.js @@ -44,11 +44,22 @@ OV.ThreeModelLoader = class obj.OnFilesLoaded (); }); } + + ReloadFiles () + { + if (this.inProgress) { + return; + } + + this.inProgress = true; + this.callbacks.onLoadStart (); + this.OnFilesLoaded (); + } OnFilesLoaded () { let obj = this; - this.callbacks.onFilesLoaded (); + this.callbacks.onImportStart (); OV.RunTaskAsync (function () { obj.importer.Import ({ success : function (importResult) { @@ -65,7 +76,7 @@ OV.ThreeModelLoader = class OnModelImported (importResult) { let obj = this; - this.callbacks.onModelImported (); + this.callbacks.onVisualizationStart (); OV.ConvertModelToThreeMeshes (importResult.model, { onTextureLoaded : function () { obj.callbacks.onTextureLoaded (); diff --git a/source/viewer/domviewer.js b/source/viewer/domviewer.js index 45f9c90..4692c74 100644 --- a/source/viewer/domviewer.js +++ b/source/viewer/domviewer.js @@ -23,10 +23,10 @@ OV.Init3DViewerElements = function () element.appendChild (progressDiv); progressDiv.innerHTML = 'Loading model...'; }, - onFilesLoaded : function () { + onImportStart : function () { progressDiv.innerHTML = 'Importing model...'; }, - onModelImported : function () { + onVisualizationStart : function () { progressDiv.innerHTML = 'Visualizing model...'; }, onModelFinished : function (importResult, threeMeshes) { diff --git a/website/o3dv/loader.js b/website/o3dv/loader.js index 5060807..d84bd47 100644 --- a/website/o3dv/loader.js +++ b/website/o3dv/loader.js @@ -40,10 +40,10 @@ OV.InitModelLoader = function (modelLoader, callbacks) progressDialog = new OV.ProgressDialog (); progressDialog.Show ('Loading Model'); }, - onFilesLoaded : function () { + onImportStart : function () { progressDialog.SetText ('Importing Model'); }, - onModelImported : function () { + onVisualizationStart : function () { progressDialog.SetText ('Visualizing Model'); }, onModelFinished : function (importResult, threeMeshes) {