Skip to content

Commit

Permalink
Finish automatic binding generation using source generator
Browse files Browse the repository at this point in the history
Finish automatic binding generation using source generator
  • Loading branch information
Xlinka authored Apr 19, 2024
2 parents bdebf02 + b3b636b commit b7c76c7
Show file tree
Hide file tree
Showing 40 changed files with 321 additions and 307 deletions.
342 changes: 154 additions & 188 deletions ProjectObsidian.SourceGenerators/BindingGenerator.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input;

[NodeCategory("Devices")]
[NodeCategory("Obsidian/Devices")]
public class ViveTrackerBattery : VoidNode<FrooxEngineContext>
{
public ObjectArgument<User> User;
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
using ProtoFlux.Runtimes.Execution;
using FrooxEngine;
using Elements.Core;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JToken), typeof(JObject),
typeof(JArray))]
public class JsonAppendToArrayNode<T> : ObjectFunctionNode<ExecutionContext, JArray>
public class JsonAppendToArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, JArray>
{
public readonly ObjectInput<JArray> Array;
public readonly ObjectInput<T> Object;
protected override JArray Compute(ExecutionContext context)
protected override JArray Compute(FrooxEngineContext context)
{
var array = Array.Evaluate(context);
var obj = Object.Evaluate(context);
Expand Down
7 changes: 4 additions & 3 deletions ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using Newtonsoft.Json.Linq;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonCountArrayChildrenNode : ValueFunctionNode<ExecutionContext, int>
public class JsonCountArrayChildrenNode : ValueFunctionNode<FrooxEngineContext, int>
{
public readonly ObjectInput<JArray> Input;

protected override int Compute(ExecutionContext context)
protected override int Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
return input?.Count ?? -1;
Expand Down
7 changes: 4 additions & 3 deletions ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using Newtonsoft.Json.Linq;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonCountObjectChildrenNode : ValueFunctionNode<ExecutionContext, int>
public class JsonCountObjectChildrenNode : ValueFunctionNode<FrooxEngineContext, int>
{
public readonly ObjectInput<JObject> Input;

protected override int Compute(ExecutionContext context)
protected override int Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
return input?.Count ?? -1;
Expand Down
15 changes: 8 additions & 7 deletions ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
using Newtonsoft.Json.Linq;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonEmptyObjectNode : ObjectFunctionNode<ExecutionContext, JObject>
public class JsonEmptyObjectNode : ObjectFunctionNode<FrooxEngineContext, JObject>
{
protected override JObject Compute(ExecutionContext context)
protected override JObject Compute(FrooxEngineContext context)
{
return new JObject();
}
}

[NodeCategory("Obsidian/Json")]
public class JsonEmptyArrayNode : ObjectFunctionNode<ExecutionContext, JArray>
public class JsonEmptyArrayNode : ObjectFunctionNode<FrooxEngineContext, JArray>
{
protected override JArray Compute(ExecutionContext context)
protected override JArray Compute(FrooxEngineContext context)
{
return new JArray();
}
}
[NodeCategory("Obsidian/Json")]
public class JsonNullValueNode : ObjectFunctionNode<ExecutionContext, JToken>
public class JsonNullValueNode : ObjectFunctionNode<FrooxEngineContext, JToken>
{
protected override JToken Compute(ExecutionContext context)
protected override JToken Compute(FrooxEngineContext context)
{
return JValue.CreateNull();
}
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
using ProtoFlux.Runtimes.Execution;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JToken), typeof(JObject),
typeof(JArray))]
public class JsonGetFromArrayNode<T> : ObjectFunctionNode<ExecutionContext, T>
public class JsonGetFromArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, T>
{
public readonly ObjectInput<JArray> Input;
public readonly ObjectInput<int> Index;


protected override T Compute(ExecutionContext context)
protected override T Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
var index = Index.Evaluate(context);
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
using ProtoFlux.Runtimes.Execution;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JToken), typeof(JObject),
typeof(JArray))]
public class JsonGetFromObjectNode<T> : ObjectFunctionNode<ExecutionContext, T>
public class JsonGetFromObjectNode<T> : ObjectFunctionNode<FrooxEngineContext, T>
{
public readonly ObjectInput<JObject> Input;
public readonly ObjectInput<string> Tag;

protected override T Compute(ExecutionContext context)
protected override T Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
var tag = Tag.Evaluate(context);
Expand Down
7 changes: 4 additions & 3 deletions ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
using ProtoFlux.Runtimes.Execution;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JToken), typeof(JObject),
typeof(JArray))]
public class JsonInsertToArrayNode<T> : ObjectFunctionNode<ExecutionContext, JArray>
public class JsonInsertToArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, JArray>
{
public readonly ObjectInput<JArray> Array;
public readonly ObjectInput<T> Object;
public readonly ObjectInput<int> Index;

protected override JArray Compute(ExecutionContext context)
protected override JArray Compute(FrooxEngineContext context)
{
var array = Array.Evaluate(context);
var obj = Object.Evaluate(context);
Expand All @@ -28,7 +29,7 @@ protected override JArray Compute(ExecutionContext context)
try
{
var output = (JArray)array.DeepClone();
JToken token = obj is JToken jToken ? jToken : new JValue(obj);
var token = obj is JToken jToken ? jToken : new JValue(obj);
output.Insert(index, token);
return output;
}
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonParseStringArrayNode : ObjectFunctionNode<ExecutionContext, JArray>
public class JsonParseStringArrayNode : ObjectFunctionNode<FrooxEngineContext, JArray>
{
public readonly ObjectInput<string> Input;

protected override JArray Compute(ExecutionContext context)
protected override JArray Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
if (string.IsNullOrEmpty(input))
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using System;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonParseStringNode : ObjectFunctionNode<ExecutionContext, JObject>
public class JsonParseStringNode : ObjectFunctionNode<FrooxEngineContext, JObject>
{
public readonly ObjectInput<string> Input;


protected override JObject Compute(ExecutionContext context)
protected override JObject Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
if (string.IsNullOrEmpty(input))
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
using ProtoFlux.Runtimes.Execution;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JToken), typeof(JObject),
typeof(JArray))]
public class JsonQuickGetFromObjectNode<T> : ObjectFunctionNode<ExecutionContext, T>
public class JsonQuickGetFromObjectNode<T> : ObjectFunctionNode<FrooxEngineContext, T>
{
public readonly ObjectInput<string> Input;
public readonly ObjectInput<string> Tag;
protected override T Compute(ExecutionContext context)
protected override T Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
var tag = Tag.Evaluate(context);
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using System;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonRemoveFromArrayNode : ObjectFunctionNode<ExecutionContext, JArray>
public class JsonRemoveFromArrayNode : ObjectFunctionNode<FrooxEngineContext, JArray>
{
public readonly ObjectInput<JArray> Array;
public readonly ObjectInput<int> Index;


protected override JArray Compute(ExecutionContext context)
protected override JArray Compute(FrooxEngineContext context)
{
var array = Array.Evaluate(context);
var index = Index.Evaluate(context);
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using System;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json
{
[NodeCategory("Obsidian/Json")]
public class JsonRemoveFromObjectNode : ObjectFunctionNode<ExecutionContext, JObject>
public class JsonRemoveFromObjectNode : ObjectFunctionNode<FrooxEngineContext, JObject>
{
public readonly ObjectInput<JObject> Input;
public readonly ObjectInput<string> Tag;


protected override JObject Compute(ExecutionContext context)
protected override JObject Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
if (input == null) return null;
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using FrooxEngine;
using FrooxEngine.ProtoFlux;
using Newtonsoft.Json.Linq;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
Expand All @@ -8,11 +9,11 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;

[NodeCategory("Obsidian/Json")]
[GenericTypes(typeof(JToken), typeof(JObject), typeof(JArray))]
public class JsonToStringNode<T> : ObjectFunctionNode<ExecutionContext, string> where T : JToken
public class JsonToStringNode<T> : ObjectFunctionNode<FrooxEngineContext, string>
{
public readonly ObjectInput<T> Input;

protected override string Compute(ExecutionContext context)
protected override string Compute(FrooxEngineContext context)
{
var input = Input.Evaluate(context);
return input?.ToString();
Expand Down
9 changes: 6 additions & 3 deletions ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Elements.Core;
using FrooxEngine.ProtoFlux;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

[NodeCategory("LogiX/NeosPlus/Math/Constants")]
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants;

[NodeCategory("Obsidian/Math/Constants")]
[NodeName("Epsilon Double")]
public class EpsilonDouble : ValueFunctionNode<ExecutionContext, double>
public class EpsilonDouble : ValueFunctionNode<FrooxEngineContext, double>
{
protected override double Compute(ExecutionContext context)
protected override double Compute(FrooxEngineContext context)
{
return MathX.DOUBLE_EPSILON;
}
Expand Down
9 changes: 6 additions & 3 deletions ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Elements.Core;
using FrooxEngine.ProtoFlux;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

[NodeCategory("Protoflux/Obsidian/Math/Constants")]
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants;

[NodeCategory("Obsidian/Math/Constants")]
[NodeName("Epsilon Float")]
public class EpsilonFloat : ValueFunctionNode<ExecutionContext, float>
public class EpsilonFloat : ValueFunctionNode<FrooxEngineContext, float>
{
protected override float Compute(ExecutionContext context)
protected override float Compute(FrooxEngineContext context)
{
return MathX.FLOAT_EPSILON;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics;
using System;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
{
public class CentripetalForceCalculationNode : ValueFunctionNode<ExecutionContext, float>
[NodeCategory("Obsidian/Math/Physics")]
public class CentripetalForceCalculationNode : ValueFunctionNode<FrooxEngineContext, float>
{
public ValueInput<float> Mass;
public ValueInput<float> Velocity;
public ValueInput<float> Radius;

protected override float Compute(ExecutionContext context)
protected override float Compute(FrooxEngineContext context)
{
try
{
Expand Down
5 changes: 3 additions & 2 deletions ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using System;
using FrooxEngine.ProtoFlux;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
{
[NodeCategory("Obsidian/Math/Physics")]
public class DragCalculationNode : ValueFunctionNode<ExecutionContext, float3>
public class DragCalculationNode : ValueFunctionNode<FrooxEngineContext, float3>
{
public ValueInput<float> FluidDensity; // rho
public ValueInput<float3> ObjectVelocity; // v
public ValueInput<float> DragCoefficient; // Cd
public ValueInput<float> CrossSectionalArea; // A

protected override float3 Compute(ExecutionContext context)
protected override float3 Compute(FrooxEngineContext context)
{
float rho = FluidDensity.Evaluate(context);
float3 v = ObjectVelocity.Evaluate(context);
Expand Down
Loading

0 comments on commit b7c76c7

Please sign in to comment.