Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Add more nodes that return slot collections (and add my Neos path to csproj) #150

Merged
merged 12 commits into from
Sep 15, 2023
27 changes: 27 additions & 0 deletions NEOSPlus/Logix/Slots/GetAllChildren.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using FrooxEngine;
using FrooxEngine.LogiX;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get All Children")]
public class GetAllChildren : LogixNode
{
public readonly Input<Slot> Instance;

public readonly Output<List<Slot>> FoundChildren;

protected override void OnEvaluate()
{
Slot slot = Instance.Evaluate();
if (slot != null)
{
FoundChildren.Value = slot.GetAllChildren();
}
else
{
FoundChildren.Value = null;
}
}
}
29 changes: 29 additions & 0 deletions NEOSPlus/Logix/Slots/GetAllParents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using FrooxEngine;
using FrooxEngine.LogiX;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get All Parents")]
public class GetAllParents : LogixNode
{
public readonly Input<Slot> Instance;

public readonly Output<List<Slot>> FoundParents;

protected override void OnEvaluate()
{
Slot slot = Instance.Evaluate();
if (slot != null)
{
List<Slot> list = new List<Slot>();
slot.GetAllParents(list);
FoundParents.Value = list;
}
else
{
FoundParents.Value = null;
}
}
}
53 changes: 53 additions & 0 deletions NEOSPlus/Logix/Slots/GetChildrenWithName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using FrooxEngine;
using FrooxEngine.LogiX;
using FrooxEngine.LogiX.WorldModel;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get Children With Name")]
public class GetChildrenWithName : LogixNode
{
public readonly Input<Slot> Instance;

public readonly Input<string> Name;

public readonly Output<List<Slot>> FoundChildren;

private void InternalGetChildrenWithName(Slot s, List<Slot> slots, string name)
{
if (s.Name == name)
{
slots.Add(s);
}
if (s.ChildrenCount <= 0)
{
return;
}
foreach (Slot child in s.Children)
{
InternalGetChildrenWithName(child, slots, name);
}

}

protected override void OnEvaluate()
{
Slot slot = Instance.Evaluate();
string name = Name.Evaluate();
if (slot != null && name != null)
{
List<Slot> list = new List<Slot>();
foreach (Slot child in slot.Children)
{
InternalGetChildrenWithName(child, list, name);
}
FoundChildren.Value = list;
}
else
{
FoundChildren.Value = null;
}
}
}
2 changes: 2 additions & 0 deletions NEOSPlus/Logix/Slots/GetChildrenWithTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using FrooxEngine.LogiX;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get Children With Tag")]
public class GetChildrenWithTag : LogixNode
Expand Down
46 changes: 46 additions & 0 deletions NEOSPlus/Logix/Slots/GetParentsWithName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using FrooxEngine;
using FrooxEngine.LogiX;
using FrooxEngine.LogiX.WorldModel;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get Parents With Name")]
public class GetParentsWithName : LogixNode
{
public readonly Input<Slot> Instance;

public readonly Input<string> Name;

public readonly Output<List<Slot>> FoundParents;

private void InternalGetParentsWithName(Slot s, List<Slot> slots, string name)
{
if (s.Name == name)
{
slots.Add(s);
}
if (s.Parent == null)
{
return;
}
InternalGetParentsWithName(s.Parent, slots, name);
}

protected override void OnEvaluate()
{
Slot slot = Instance.Evaluate();
string name = Name.Evaluate();
if (slot != null && name != null && slot.Parent != null)
{
List<Slot> list = new List<Slot>();
InternalGetParentsWithName(slot.Parent, list, name);
FoundParents.Value = list;
}
else
{
FoundParents.Value = null;
}
}
}
46 changes: 46 additions & 0 deletions NEOSPlus/Logix/Slots/GetParentsWithTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using FrooxEngine;
using FrooxEngine.LogiX;
using FrooxEngine.LogiX.WorldModel;
using System.Collections.Generic;

namespace FrooxEngine.LogiX.Slots;

[Category("LogiX/NeosPlus/Slots")]
[NodeName("Get Parents With Tag")]
public class GetParentsWithTag : LogixNode
{
public readonly Input<Slot> Instance;

public readonly Input<string> Tag;

public readonly Output<List<Slot>> FoundParents;

private void InternalGetParentsWithTag(Slot s, List<Slot> slots, string tag)
{
if (s.Tag == tag)
{
slots.Add(s);
}
if (s.Parent == null)
{
return;
}
InternalGetParentsWithTag(s.Parent, slots, tag);
}

protected override void OnEvaluate()
{
Slot slot = Instance.Evaluate();
string tag = Tag.Evaluate();
if (slot != null && tag != null && slot.Parent != null)
{
List<Slot> list = new List<Slot>();
InternalGetParentsWithTag(slot.Parent, list, tag);
FoundParents.Value = list;
}
else
{
FoundParents.Value = null;
}
}
}
1 change: 1 addition & 0 deletions NEOSPlus/NEOSPlus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<NeosPath Condition="Exists('/mnt/LocalDisk/SteamLibrary/steamapps/common/NeosVR/')">/mnt/LocalDisk/SteamLibrary/steamapps/common/NeosVR/</NeosPath>
<NeosPath Condition="Exists('C:\Neos\app\')">C:\Neos\app\</NeosPath>
<NeosPath Condition="Exists('E:\Neos\app\')">E:\Neos\app\</NeosPath>
<NeosPath Condition="Exists('G:\Neos\app\')">G:\Neos\app\</NeosPath>
<NeosPath Condition="Exists('E:\SteamLibrary/steamapps/common/NeosVR/')">E:\SteamLibrary/steamapps/common/NeosVR/</NeosPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AutoPostX|AnyCPU' ">
Expand Down
Loading