Separated Assets to Resources (Engine assets) and Assets (Project specific)

+ AssetHierarchy: Exposed RootNode
+ ContentBrowserWindow: Fixed Empty Folder not being Leaf-Node
+ TreeNode: Added IsParentOf, IsChildOf and IsInSubtree.
    + Fixed InternalDeleteTreeAndChildren for null trees
This commit is contained in:
Simon Lübeß
2023-07-30 20:30:06 +02:00
parent 20dae92be7
commit c1a87ed946
85 changed files with 413 additions and 240 deletions
+31
View File
@@ -65,6 +65,34 @@ namespace GlitchyEngine.Collections
DepthFirst
}
public bool IsParentOf(TreeNode<T> wantedChild)
{
return wantedChild.IsChildOf(this);
}
public bool IsChildOf(TreeNode<T> wantedParent)
{
TreeNode<T> currentParent = Parent;
while (currentParent != null)
{
if (currentParent == wantedParent)
return true;
currentParent = currentParent.Parent;
}
return false;
}
public bool IsInSubtree(TreeNode<T> subtree)
{
if (this == subtree)
return true;
return IsChildOf(subtree);
}
public void ForEach(ElementFunc func, IterationMode iterationMode = .DepthFirst)
{
if (iterationMode == .BreadthFirst)
@@ -123,6 +151,9 @@ namespace GlitchyEngine.Collections
private static void InternalDeleteTreeAndChildren<T>(TreeNode<T> tree) where T : class, delete
{
if (tree == null)
return;
for (var child in tree.Children)
{
InternalDeleteTreeAndChildren(child);