Show all meshes on view type change.

This commit is contained in:
kovacsv 2021-11-11 12:41:58 +01:00
parent 267a659dfb
commit 52b94e5aa4
2 changed files with 14 additions and 9 deletions

View File

@ -114,8 +114,9 @@ OV.Navigator = class
onMaterialSelected : (materialIndex) => { onMaterialSelected : (materialIndex) => {
this.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex)); this.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
}, },
onSelectionRemoved : () => { onViewTypeChanged : () => {
this.SetSelection (null); this.SetSelection (null);
this.ShowAllMeshes ();
} }
}); });

View File

@ -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 = { this.buttons = {
flatList : { flatList : {
name : 'Flat list', name : 'Flat list',
@ -489,10 +497,7 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel
return; return;
} }
this.showTree = false; this.showTree = false;
this.ClearMeshTree (); UpdateView (this, importResult, isHierarchical);
this.FillMeshTree (importResult.model);
UpdateButtonsStatus (this.buttons, this.showTree, isHierarchical);
this.callbacks.onSelectionRemoved ();
}); });
CreateButton (this.buttonsDiv, this.buttons.treeView, null, () => { CreateButton (this.buttonsDiv, this.buttons.treeView, null, () => {
@ -500,10 +505,7 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel
return; return;
} }
this.showTree = true; this.showTree = true;
this.ClearMeshTree (); UpdateView (this, importResult, isHierarchical);
this.FillMeshTree (importResult.model);
UpdateButtonsStatus (this.buttons, this.showTree, isHierarchical);
this.callbacks.onSelectionRemoved ();
}); });
this.buttons.separator = $('<div>').addClass ('ov_navigator_buttons_separator').appendTo (this.buttonsDiv); this.buttons.separator = $('<div>').addClass ('ov_navigator_buttons_separator').appendTo (this.buttonsDiv);
@ -692,6 +694,8 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel
IsolateMesh (meshInstanceId) IsolateMesh (meshInstanceId)
{ {
// TODO: slow because of recursion
let isIsolated = this.IsMeshIsolated (meshInstanceId); let isIsolated = this.IsMeshIsolated (meshInstanceId);
this.EnumerateMeshItems ((meshItem) => { this.EnumerateMeshItems ((meshItem) => {
if (meshItem.GetMeshInstanceId ().IsEqual (meshInstanceId) || isIsolated) { if (meshItem.GetMeshInstanceId ().IsEqual (meshInstanceId) || isIsolated) {