Add function to reload the same model again.

This commit is contained in:
Viktor Kovacs 2021-04-02 10:05:18 +02:00
parent b60305dd19
commit 473da09052
3 changed files with 17 additions and 6 deletions

View File

@ -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 ();

View File

@ -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) {

View File

@ -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) {