From 52b94e5aa4dddf99eefe15a6fd17cd3d735648da Mon Sep 17 00:00:00 2001 From: kovacsv Date: Thu, 11 Nov 2021 12:41:58 +0100 Subject: [PATCH] Show all meshes on view type change. --- website/o3dv/js/navigator.js | 3 ++- website/o3dv/js/navigatorpanels.js | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/website/o3dv/js/navigator.js b/website/o3dv/js/navigator.js index e1e540a..0ff2cd1 100644 --- a/website/o3dv/js/navigator.js +++ b/website/o3dv/js/navigator.js @@ -114,8 +114,9 @@ OV.Navigator = class onMaterialSelected : (materialIndex) => { this.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex)); }, - onSelectionRemoved : () => { + onViewTypeChanged : () => { this.SetSelection (null); + this.ShowAllMeshes (); } }); diff --git a/website/o3dv/js/navigatorpanels.js b/website/o3dv/js/navigatorpanels.js index f147153..53625f4 100644 --- a/website/o3dv/js/navigatorpanels.js +++ b/website/o3dv/js/navigatorpanels.js @@ -441,6 +441,14 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel } } + function UpdateView (panel, importResult, isHierarchical) + { + panel.ClearMeshTree (); + panel.FillMeshTree (importResult.model); + UpdateButtonsStatus (panel.buttons, panel.showTree, isHierarchical); + panel.callbacks.onViewTypeChanged (); + } + this.buttons = { flatList : { name : 'Flat list', @@ -489,10 +497,7 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel return; } this.showTree = false; - this.ClearMeshTree (); - this.FillMeshTree (importResult.model); - UpdateButtonsStatus (this.buttons, this.showTree, isHierarchical); - this.callbacks.onSelectionRemoved (); + UpdateView (this, importResult, isHierarchical); }); CreateButton (this.buttonsDiv, this.buttons.treeView, null, () => { @@ -500,10 +505,7 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel return; } this.showTree = true; - this.ClearMeshTree (); - this.FillMeshTree (importResult.model); - UpdateButtonsStatus (this.buttons, this.showTree, isHierarchical); - this.callbacks.onSelectionRemoved (); + UpdateView (this, importResult, isHierarchical); }); this.buttons.separator = $('
').addClass ('ov_navigator_buttons_separator').appendTo (this.buttonsDiv); @@ -692,6 +694,8 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel IsolateMesh (meshInstanceId) { + // TODO: slow because of recursion + let isIsolated = this.IsMeshIsolated (meshInstanceId); this.EnumerateMeshItems ((meshItem) => { if (meshItem.GetMeshInstanceId ().IsEqual (meshInstanceId) || isIsolated) {