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

Commit

Permalink
Added GetValue<T> LogiX Node
Browse files Browse the repository at this point in the history
Added GetValue<T> LogiX Node
  • Loading branch information
Xlinka authored Jul 6, 2023
2 parents 57f611e + 91122e2 commit a638256
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
41 changes: 41 additions & 0 deletions NEOSPlus/Logix/Operators/GetValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using BaseX;
using System;
using System.Linq;

namespace FrooxEngine.LogiX.Operators
{
/// <summary>
/// Retrieves the value of any <c>IValue&lt;T\&gt;</c> data type.
/// </summary>
/// <remarks>
/// By JackTheFoxOtter
/// </remarks>
/// <typeparam name="T"></typeparam>
[Category("LogiX/Operators")]
[NodeName("Get Value")]
public class GetValue<T> : LogixOperator<T>
{
public readonly Input<IValue<T>> Target;
public override T Content
{
get
{
IValue<T> evaluatedTarget = Target.EvaluateRaw();
if (evaluatedTarget != null)
return evaluatedTarget.Value;
return default;
}
}

protected override Type FindOverload(NodeTypes connectingTypes)
{
if (connectingTypes.inputs.TryGetValue("Target", out Type targetType))
{
Type targetType2 = targetType.EnumerateInterfacesRecursively().FirstOrDefault(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IValue<>));
if (targetType2 != null)
return typeof(GetValue<>).MakeGenericType(targetType2.GetGenericArguments()[0]);
}
return null;
}
}
}
1 change: 1 addition & 0 deletions NEOSPlus/NEOSPlus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<NeosPath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/NeosVR/')">$(HOME)/.steam/steam/steamapps/common/NeosVR/</NeosPath>
<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('E:\SteamLibrary/steamapps/common/NeosVR/')">E:\SteamLibrary/steamapps/common/NeosVR/</NeosPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CopyToPlugin|AnyCPU'">
Expand Down

0 comments on commit a638256

Please sign in to comment.