Fix bug in actors duplicate action due to incorrect actors list setup
#2309
This commit is contained in:
@@ -92,11 +92,12 @@ namespace FlaxEditor.SceneGraph
|
|||||||
|
|
||||||
private static void FillTree(SceneGraphNode node, List<SceneGraphNode> result)
|
private static void FillTree(SceneGraphNode node, List<SceneGraphNode> result)
|
||||||
{
|
{
|
||||||
result.AddRange(node.ChildNodes);
|
if (result.Contains(node))
|
||||||
for (int i = 0; i < node.ChildNodes.Count; i++)
|
return;
|
||||||
{
|
result.Add(node);
|
||||||
FillTree(node.ChildNodes[i], result);
|
var children = node.ChildNodes;
|
||||||
}
|
for (int i = 0; i < children.Count; i++)
|
||||||
|
FillTree(children[i], result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -109,21 +110,9 @@ namespace FlaxEditor.SceneGraph
|
|||||||
{
|
{
|
||||||
if (nodes == null || result == null)
|
if (nodes == null || result == null)
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
|
|
||||||
result.Clear();
|
result.Clear();
|
||||||
|
|
||||||
for (var i = 0; i < nodes.Count; i++)
|
for (var i = 0; i < nodes.Count; i++)
|
||||||
{
|
FillTree(nodes[i], result);
|
||||||
var target = nodes[i];
|
|
||||||
|
|
||||||
// Check if has been already added
|
|
||||||
if (result.Contains(target))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Add whole child tree to the results
|
|
||||||
result.Add(target);
|
|
||||||
FillTree(target, result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -150,7 +139,6 @@ namespace FlaxEditor.SceneGraph
|
|||||||
if (node == null || result == null)
|
if (node == null || result == null)
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
result.Clear();
|
result.Clear();
|
||||||
result.Add(node);
|
|
||||||
FillTree(node, result);
|
FillTree(node, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user