Send only file names to the file selector callback.
This commit is contained in:
parent
db57efeaf1
commit
07fe1d5509
@ -162,7 +162,8 @@ OV.Importer = class
|
|||||||
let mainFile = importableFiles[0];
|
let mainFile = importableFiles[0];
|
||||||
this.ImportLoadedMainFile (mainFile, settings, callbacks);
|
this.ImportLoadedMainFile (mainFile, settings, callbacks);
|
||||||
} else {
|
} else {
|
||||||
callbacks.onSelectMainFile (importableFiles, (mainFileIndex) => {
|
let fileNames = importableFiles.map (importableFile => importableFile.file.name);
|
||||||
|
callbacks.onSelectMainFile (fileNames, (mainFileIndex) => {
|
||||||
if (mainFileIndex === null) {
|
if (mainFileIndex === null) {
|
||||||
callbacks.onImportError (new OV.ImportError (OV.ImportErrorCode.NoImportableFile, null));
|
callbacks.onImportError (new OV.ImportError (OV.ImportErrorCode.NoImportableFile, null));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -36,11 +36,11 @@ OV.ThreeModelLoader = class
|
|||||||
onFilesLoaded : () => {
|
onFilesLoaded : () => {
|
||||||
this.callbacks.onImportStart ();
|
this.callbacks.onImportStart ();
|
||||||
},
|
},
|
||||||
onSelectMainFile : (files, selectFile) => {
|
onSelectMainFile : (fileNames, selectFile) => {
|
||||||
if (!this.callbacks.onSelectMainFile) {
|
if (!this.callbacks.onSelectMainFile) {
|
||||||
selectFile (0);
|
selectFile (0);
|
||||||
} else {
|
} else {
|
||||||
this.callbacks.onSelectMainFile (files, selectFile);
|
this.callbacks.onSelectMainFile (fileNames, selectFile);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onImportSuccess : (importResult) => {
|
onImportSuccess : (importResult) => {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ OV.InitModelLoader = function (modelLoader, callbacks)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ShowFileSelectorDialog (files, onSelect)
|
function ShowFileSelectorDialog (fileNames, onSelect)
|
||||||
{
|
{
|
||||||
let dialog = new OV.ButtonDialog ();
|
let dialog = new OV.ButtonDialog ();
|
||||||
let contentDiv = dialog.Init ('Select Model', [
|
let contentDiv = dialog.Init ('Select Model', [
|
||||||
@ -45,11 +45,11 @@ OV.InitModelLoader = function (modelLoader, callbacks)
|
|||||||
let fileListSection = OV.AddDiv (contentDiv, 'ov_dialog_section');
|
let fileListSection = OV.AddDiv (contentDiv, 'ov_dialog_section');
|
||||||
let fileList = OV.AddDiv (fileListSection, 'ov_dialog_import_file_list ov_thin_scrollbar');
|
let fileList = OV.AddDiv (fileListSection, 'ov_dialog_import_file_list ov_thin_scrollbar');
|
||||||
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < fileNames.length; i++) {
|
||||||
let file = files[i];
|
let fileName = fileNames[i];
|
||||||
let fileLink = OV.AddDiv (fileList, 'ov_dialog_file_link');
|
let fileLink = OV.AddDiv (fileList, 'ov_dialog_file_link');
|
||||||
OV.AddSvgIconElement (fileLink, 'meshes', 'ov_file_link_img');
|
OV.AddSvgIconElement (fileLink, 'meshes', 'ov_file_link_img');
|
||||||
OV.AddDiv (fileLink, 'ov_dialog_file_link_text', file.file.name);
|
OV.AddDiv (fileLink, 'ov_dialog_file_link_text', fileName);
|
||||||
fileLink.addEventListener ('click', () => {
|
fileLink.addEventListener ('click', () => {
|
||||||
dialog.SetCloseHandler (null);
|
dialog.SetCloseHandler (null);
|
||||||
dialog.Hide ();
|
dialog.Hide ();
|
||||||
@ -79,9 +79,9 @@ OV.InitModelLoader = function (modelLoader, callbacks)
|
|||||||
progressDialog.Init ('Loading Model');
|
progressDialog.Init ('Loading Model');
|
||||||
progressDialog.Show ();
|
progressDialog.Show ();
|
||||||
},
|
},
|
||||||
onSelectMainFile : (files, selectFile) => {
|
onSelectMainFile : (fileNames, selectFile) => {
|
||||||
progressDialog.Hide ();
|
progressDialog.Hide ();
|
||||||
modalDialog = ShowFileSelectorDialog (files, (index) => {
|
modalDialog = ShowFileSelectorDialog (fileNames, (index) => {
|
||||||
progressDialog.Show ();
|
progressDialog.Show ();
|
||||||
selectFile (index);
|
selectFile (index);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user