diff --git a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs index 33f0be334..bf087feda 100644 --- a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs @@ -27,16 +27,6 @@ namespace FlaxEditor.CustomEditors.Editors element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; } - private void GetActorsTree(List list, Actor a) - { - list.Add(a); - int cnt = a.ChildrenCount; - for (int i = 0; i < cnt; i++) - { - GetActorsTree(list, a.GetChild(i)); - } - } - private void OnSelectedIndexChanged(ComboBox comboBox) { int value = comboBox.SelectedIndex; @@ -60,7 +50,7 @@ namespace FlaxEditor.CustomEditors.Editors // Note: this possibly breaks the design a little bit // But it's the easiest way to set value for selected actor and its children with one undo action List actors = new List(32); - GetActorsTree(actors, actor); + Utilities.Utils.GetActorsTree(actors, actor); if (Presenter.Undo != null) { using (new UndoMultiBlock(Presenter.Undo, actors.ToArray(), "Change layer")) diff --git a/Source/Editor/CustomEditors/Editors/ActorStaticFlagsEditor.cs b/Source/Editor/CustomEditors/Editors/ActorStaticFlagsEditor.cs index 4d7e4f0ef..f93ac7cdd 100644 --- a/Source/Editor/CustomEditors/Editors/ActorStaticFlagsEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ActorStaticFlagsEditor.cs @@ -10,16 +10,6 @@ namespace FlaxEditor.CustomEditors.Editors /// public sealed class ActorStaticFlagsEditor : EnumEditor { - private void GetActorsTree(List list, Actor a) - { - list.Add(a); - int cnt = a.ChildrenCount; - for (int i = 0; i < cnt; i++) - { - GetActorsTree(list, a.GetChild(i)); - } - } - /// protected override void OnValueChanged() { @@ -40,7 +30,7 @@ namespace FlaxEditor.CustomEditors.Editors // Note: this possibly breaks the design a little bit // But it's the easiest way to set value for selected actor and its children with one undo action List actors = new List(32); - GetActorsTree(actors, actor); + Utilities.Utils.GetActorsTree(actors, actor); if (Presenter.Undo != null && Presenter.Undo.Enabled) { using (new UndoMultiBlock(Presenter.Undo, actors.ToArray(), "Change static flags")) diff --git a/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs b/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs index 8845c24bf..d00bfa10a 100644 --- a/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs +++ b/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs @@ -629,7 +629,7 @@ namespace FlaxEditor.SceneGraph.GUI { // Set all Actors static flags to match parents List childActors = new List(); - GetActorsTree(childActors, actor); + Utilities.Utils.GetActorsTree(childActors, actor); foreach (var child in childActors) { child.StaticFlags = spawnParent.StaticFlags; @@ -679,16 +679,6 @@ namespace FlaxEditor.SceneGraph.GUI return result; } - - private void GetActorsTree(List list, Actor a) - { - list.Add(a); - int cnt = a.ChildrenCount; - for (int i = 0; i < cnt; i++) - { - GetActorsTree(list, a.GetChild(i)); - } - } private bool ValidateDragActor(ActorNode actorNode) { diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 5f836e069..7397b743e 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -102,6 +102,16 @@ namespace FlaxEditor.Utilities return str; } + internal static void GetActorsTree(List list, Actor a) + { + list.Add(a); + int cnt = a.ChildrenCount; + for (int i = 0; i < cnt; i++) + { + GetActorsTree(list, a.GetChild(i)); + } + } + /// /// The colors for the keyframes used by the curve editor. ///