Remember visibility status when changing between flat list and tree view.
This commit is contained in:
parent
2ccc67fe1a
commit
ef83c0bfd3
@ -116,7 +116,6 @@ OV.Navigator = class
|
||||
},
|
||||
onViewTypeChanged : () => {
|
||||
this.SetSelection (null);
|
||||
this.ShowAllMeshes (true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -66,7 +66,8 @@ OV.MeshItem = class extends OV.TreeViewButtonItem
|
||||
}
|
||||
if (recurse === OV.NavigatorItemRecurse.Parents) {
|
||||
if (this.parent instanceof OV.NodeItem) {
|
||||
this.parent.SetVisible (this.parent.CalculateIsVisible (), OV.NavigatorItemRecurse.Parents);
|
||||
let parentIsVisible = this.parent.CalculateIsVisible ();
|
||||
this.parent.SetVisible (parentIsVisible, OV.NavigatorItemRecurse.Parents);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,11 +108,14 @@ OV.NodeItem = class extends OV.TreeViewGroupButtonItem
|
||||
CalculateIsVisible ()
|
||||
{
|
||||
let isVisible = false;
|
||||
this.EnumerateMeshItems ((meshItem) => {
|
||||
if (meshItem.IsVisible ()) {
|
||||
isVisible = true;
|
||||
for (let child of this.children) {
|
||||
if (child instanceof OV.NodeItem || child instanceof OV.MeshItem) {
|
||||
if (child.IsVisible ()) {
|
||||
isVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
@ -138,7 +142,8 @@ OV.NodeItem = class extends OV.TreeViewGroupButtonItem
|
||||
}
|
||||
if (recurse === OV.NavigatorItemRecurse.Parents || recurse === OV.NavigatorItemRecurse.All) {
|
||||
if (this.parent instanceof OV.NodeItem) {
|
||||
this.parent.SetVisible (this.parent.CalculateIsVisible (), OV.NavigatorItemRecurse.Parents);
|
||||
let parentIsVisible = this.parent.CalculateIsVisible ();
|
||||
this.parent.SetVisible (parentIsVisible, OV.NavigatorItemRecurse.Parents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,8 +443,22 @@ OV.NavigatorMeshesPanel = class extends OV.NavigatorPanel
|
||||
|
||||
function UpdateView (panel, importResult, isHierarchical)
|
||||
{
|
||||
let hiddenMeshInstanceIds = [];
|
||||
panel.EnumerateMeshItems ((meshItem) => {
|
||||
if (!meshItem.IsVisible ()) {
|
||||
hiddenMeshInstanceIds.push (meshItem.GetMeshInstanceId ());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
panel.ClearMeshTree ();
|
||||
panel.FillMeshTree (importResult.model);
|
||||
|
||||
for (let meshInstanceId of hiddenMeshInstanceIds) {
|
||||
let meshItem = panel.GetMeshItem (meshInstanceId);
|
||||
meshItem.SetVisible (false, OV.NavigatorItemRecurse.Parents);
|
||||
}
|
||||
|
||||
UpdateButtonsStatus (panel.buttons, panel.showTree, isHierarchical);
|
||||
panel.callbacks.onViewTypeChanged ();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user