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) => {
this.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
},
onSelectionRemoved : () => {
onViewTypeChanged : () => {
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 = {
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 = $('<div>').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) {