Fix bug with null object being selected in prefab
This commit is contained in:
@@ -3,11 +3,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FlaxEditor.Gizmo;
|
|
||||||
using FlaxEditor.GUI.Tree;
|
using FlaxEditor.GUI.Tree;
|
||||||
using FlaxEditor.SceneGraph;
|
using FlaxEditor.SceneGraph;
|
||||||
using FlaxEditor.SceneGraph.GUI;
|
using FlaxEditor.SceneGraph.GUI;
|
||||||
using FlaxEditor.Viewport.Cameras;
|
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
|
|
||||||
namespace FlaxEditor.Windows.Assets
|
namespace FlaxEditor.Windows.Assets
|
||||||
@@ -64,8 +62,11 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
private void OnSelectionUndo(SceneGraphNode[] toSelect)
|
private void OnSelectionUndo(SceneGraphNode[] toSelect)
|
||||||
{
|
{
|
||||||
Selection.Clear();
|
Selection.Clear();
|
||||||
Selection.AddRange(toSelect);
|
foreach (var e in toSelect)
|
||||||
|
{
|
||||||
|
if (e != null)
|
||||||
|
Selection.Add(e);
|
||||||
|
}
|
||||||
OnSelectionChanges();
|
OnSelectionChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,11 +119,13 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
/// <param name="nodes">The nodes.</param>
|
/// <param name="nodes">The nodes.</param>
|
||||||
public void Select(List<SceneGraphNode> nodes)
|
public void Select(List<SceneGraphNode> nodes)
|
||||||
{
|
{
|
||||||
|
nodes?.RemoveAll(x => x == null);
|
||||||
if (nodes == null || nodes.Count == 0)
|
if (nodes == null || nodes.Count == 0)
|
||||||
{
|
{
|
||||||
Deselect();
|
Deselect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.ArraysEqual(Selection, nodes))
|
if (Utils.ArraysEqual(Selection, nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user