Make sure we don't have selections on save

Started work on align object 2
This commit is contained in:
LarsBrubaker 2022-02-26 22:21:29 -08:00
parent 68e60ed897
commit 61e68b6afa
9 changed files with 528 additions and 31 deletions

View file

@ -2135,22 +2135,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (e.InvalidateType.HasFlag(InvalidateType.Name))
{
// clear and restore the selection so we have the name change
var lastSelectedItem = Scene.SelectedItem;
if (!rebuildTreePending)
using (new ClearThenRestorSelection(Scene))
{
rebuildTreePending = true;
UiThread.RunOnIdle(this.RebuildTree);
}
Scene.SelectedItem = null;
// Adding a group of parts to a bed when there are multiple existing parts already selected
// will create duplicates if any of the new parts need to be renamed. Since the old selection
// group will be replaced with a new selection group containing the newly-added parts, just
// clear the selection. (Don't select if the selection was a selection group or has insertion groups
// still processing).
if (!(lastSelectedItem is SelectionGroupObject3D) || !Scene.Children.Any(c => c is InsertionGroupObject3D))
{
Scene.SelectedItem = lastSelectedItem;
if (!rebuildTreePending)
{
rebuildTreePending = true;
UiThread.RunOnIdle(this.RebuildTree);
}
}
}