diff --git a/Bindings/Devices/ViveTrackerBattery.cs b/Bindings/Devices/ViveTrackerBattery.cs deleted file mode 100644 index 1341291..0000000 --- a/Bindings/Devices/ViveTrackerBattery.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using FrooxEngine.ProtoFlux.Runtimes.Execution; -using ProtoFlux.Core; - - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Devices" })] -public class ViveTrackerBattery : VoidNode -{ - public readonly SyncRef> User; - - public readonly SyncRef> BodyNode; - - public readonly NodeValueOutput IsActive; - - public readonly NodeValueOutput BatteryLevel; - - public readonly NodeValueOutput IsBatteryCharging; - - public override Type NodeType => typeof(ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery); - - public ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override int NodeOutputCount => base.NodeOutputCount + 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery viveTrackerBattery = (TypedNodeInstance = new ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery()); - return viveTrackerBattery as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input.ViveTrackerBattery)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return User; - case 1: - return BodyNode; - default: - index -= 2; - return null; - } - } - - protected override INodeOutput GetOutputInternal(ref int index) - { - INodeOutput outputInternal = base.GetOutputInternal(ref index); - if (outputInternal != null) - { - return outputInternal; - } - switch (index) - { - case 0: - return IsActive; - case 1: - return BatteryLevel; - case 2: - return IsBatteryCharging; - default: - index -= 3; - return null; - } - } -} \ No newline at end of file diff --git a/Bindings/JSON/JsonAddToObject.cs b/Bindings/JSON/JsonAddToObject.cs deleted file mode 100644 index e2265bb..0000000 --- a/Bindings/JSON/JsonAddToObject.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonAddToObject : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Input; - public readonly SyncRef> Tag; - public readonly SyncRef> Object; - - public override Type NodeType => typeof(JsonAddToObjectNode); - - public JsonAddToObjectNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonAddToObjectNode jsonAddToObjectInstance = (TypedNodeInstance = new JsonAddToObjectNode()); - return jsonAddToObjectInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonAddToObjectNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonAddToObjectNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Input; - case 1: - return Tag; - case 2: - return Object; - default: - index -= 3; - return null; - } - } - } diff --git a/Bindings/JSON/JsonAppendToArrayBinding.cs b/Bindings/JSON/JsonAppendToArrayBinding.cs deleted file mode 100644 index 1cbfeac..0000000 --- a/Bindings/JSON/JsonAppendToArrayBinding.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonAppendToArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Array; - public readonly SyncRef> Object; - - public override Type NodeType => typeof(JsonAppendToArrayNode); - - public JsonAppendToArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonAppendToArrayNode jsonAppendToArrayInstance = (TypedNodeInstance = new JsonAppendToArrayNode()); - return jsonAppendToArrayInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonAppendToArrayNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonAppendToArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Array; - case 1: - return Object; - default: - index -= 2; - return null; - } - } - } - diff --git a/Bindings/JSON/JsonCountArrayChildrenBinding.cs b/Bindings/JSON/JsonCountArrayChildrenBinding.cs deleted file mode 100644 index 9ca7a75..0000000 --- a/Bindings/JSON/JsonCountArrayChildrenBinding.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonCountArrayChildren : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode - { - public readonly SyncRef> Input; - - public override Type NodeType => typeof(JsonCountArrayChildrenNode); - - public JsonCountArrayChildrenNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonCountArrayChildrenNode jsonCountArrayChildrenInstance = (TypedNodeInstance = new JsonCountArrayChildrenNode()); - return jsonCountArrayChildrenInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonCountArrayChildrenNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonCountArrayChildrenNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } - } diff --git a/Bindings/JSON/JsonCountObjectChildrenBinding.cs b/Bindings/JSON/JsonCountObjectChildrenBinding.cs deleted file mode 100644 index d51f428..0000000 --- a/Bindings/JSON/JsonCountObjectChildrenBinding.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonCountObjectChildren : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode - { - public readonly SyncRef> Input; - - public override Type NodeType => typeof(JsonCountObjectChildrenNode); - - public JsonCountObjectChildrenNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonCountObjectChildrenNode jsonCountObjectChildrenInstance = (TypedNodeInstance = new JsonCountObjectChildrenNode()); - return jsonCountObjectChildrenInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonCountObjectChildrenNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonCountObjectChildrenNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } - } diff --git a/Bindings/JSON/JsonEmptyArrayBinding.cs b/Bindings/JSON/JsonEmptyArrayBinding.cs deleted file mode 100644 index 4e26034..0000000 --- a/Bindings/JSON/JsonEmptyArrayBinding.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using Newtonsoft.Json.Linq; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonEmptyArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public override Type NodeType => typeof(JsonEmptyArrayNode); - - public JsonEmptyArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 0; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - throw new InvalidOperationException("Node has already been instantiated"); - - TypedNodeInstance = new JsonEmptyArrayNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonEmptyArrayNode typedNodeInstance) - TypedNodeInstance = typedNodeInstance; - else - throw new ArgumentException("Node instance is not of type " + typeof(JsonEmptyArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - } - diff --git a/Bindings/JSON/JsonEmptyObjectBinding.cs b/Bindings/JSON/JsonEmptyObjectBinding.cs deleted file mode 100644 index 2851624..0000000 --- a/Bindings/JSON/JsonEmptyObjectBinding.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using Newtonsoft.Json.Linq; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonEmptyObject : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public override Type NodeType => typeof(JsonEmptyObjectNode); - - public JsonEmptyObjectNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 0; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - throw new InvalidOperationException("Node has already been instantiated"); - - TypedNodeInstance = new JsonEmptyObjectNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonEmptyObjectNode typedNodeInstance) - TypedNodeInstance = typedNodeInstance; - else - throw new ArgumentException("Node instance is not of type " + typeof(JsonEmptyObjectNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - } - diff --git a/Bindings/JSON/JsonGetFromArrayBinding.cs b/Bindings/JSON/JsonGetFromArrayBinding.cs deleted file mode 100644 index 1c24a57..0000000 --- a/Bindings/JSON/JsonGetFromArrayBinding.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonGetFromArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Input; - public readonly SyncRef> Index; - - public override Type NodeType => typeof(JsonGetFromArrayNode); - - public JsonGetFromArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonGetFromArrayNode jsonGetFromArrayInstance = (TypedNodeInstance = new JsonGetFromArrayNode()); - return jsonGetFromArrayInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonGetFromArrayNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonGetFromArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Input; - case 1: - return Index; - default: - index -= 2; - return null; - } - } - } - diff --git a/Bindings/JSON/JsonGetFromObjectBinding.cs b/Bindings/JSON/JsonGetFromObjectBinding.cs deleted file mode 100644 index a5c51e6..0000000 --- a/Bindings/JSON/JsonGetFromObjectBinding.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonGetFromObject : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Input; - public readonly SyncRef> Tag; - - public override Type NodeType => typeof(JsonGetFromObjectNode); - - public JsonGetFromObjectNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonGetFromObjectNode jsonGetFromObjectInstance = (TypedNodeInstance = new JsonGetFromObjectNode()); - return jsonGetFromObjectInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonGetFromObjectNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonGetFromObjectNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Input; - case 1: - return Tag; - default: - index -= 2; - return null; - } - } - } diff --git a/Bindings/JSON/JsonInsertToArrayBinding.cs b/Bindings/JSON/JsonInsertToArrayBinding.cs deleted file mode 100644 index 85b5999..0000000 --- a/Bindings/JSON/JsonInsertToArrayBinding.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonInsertToArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Array; - public readonly SyncRef> Object; - public readonly SyncRef> Index; - - public override Type NodeType => typeof(JsonInsertToArrayNode); - - public JsonInsertToArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonInsertToArrayNode jsonInsertToArrayInstance = (TypedNodeInstance = new JsonInsertToArrayNode()); - return jsonInsertToArrayInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonInsertToArrayNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonInsertToArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Array; - case 1: - return Object; - case 2: - return Index; - default: - index -= 3; - return null; - } - } - } diff --git a/Bindings/JSON/JsonNullValueBinding.cs b/Bindings/JSON/JsonNullValueBinding.cs deleted file mode 100644 index 5e04255..0000000 --- a/Bindings/JSON/JsonNullValueBinding.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using Newtonsoft.Json.Linq; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonNullValue : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public override Type NodeType => typeof(JsonNullValueNode); - - public JsonNullValueNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 0; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - throw new InvalidOperationException("Node has already been instantiated"); - - TypedNodeInstance = new JsonNullValueNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonNullValueNode typedNodeInstance) - TypedNodeInstance = typedNodeInstance; - else - throw new ArgumentException("Node instance is not of type " + typeof(JsonNullValueNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - } - diff --git a/Bindings/JSON/JsonParseStringArrayBinding.cs b/Bindings/JSON/JsonParseStringArrayBinding.cs deleted file mode 100644 index 3382a19..0000000 --- a/Bindings/JSON/JsonParseStringArrayBinding.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonParseStringArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Input; - - public override Type NodeType => typeof(JsonParseStringArrayNode); - - public JsonParseStringArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonParseStringArrayNode jsonParseStringArrayInstance = (TypedNodeInstance = new JsonParseStringArrayNode()); - return jsonParseStringArrayInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonParseStringArrayNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonParseStringArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } - } diff --git a/Bindings/JSON/JsonParseStringBinding.cs b/Bindings/JSON/JsonParseStringBinding.cs deleted file mode 100644 index 69e9578..0000000 --- a/Bindings/JSON/JsonParseStringBinding.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] -public class JsonParseString : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(JsonParseStringNode); - - public JsonParseStringNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonParseStringNode jsonParseStringArrayInstance = (TypedNodeInstance = new JsonParseStringNode()); - return jsonParseStringArrayInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonParseStringNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonParseStringNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/JSON/JsonQuickGetFromObjectBinding.cs b/Bindings/JSON/JsonQuickGetFromObjectBinding.cs deleted file mode 100644 index 2a3257e..0000000 --- a/Bindings/JSON/JsonQuickGetFromObjectBinding.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonQuickGetFromObject : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode - { - public readonly SyncRef> Input; - public readonly SyncRef> Tag; - - public override Type NodeType => typeof(JsonQuickGetFromObjectNode); - - public JsonQuickGetFromObjectNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonQuickGetFromObjectNode jsonQuickGetFromObjectInstance = (TypedNodeInstance = new JsonQuickGetFromObjectNode()); - return jsonQuickGetFromObjectInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonQuickGetFromObjectNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonQuickGetFromObjectNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Input; - case 1: - return Tag; - default: - index -= 2; - return null; - } - } - } diff --git a/Bindings/JSON/JsonRemoveFromArrayBinding.cs b/Bindings/JSON/JsonRemoveFromArrayBinding.cs deleted file mode 100644 index 02147dc..0000000 --- a/Bindings/JSON/JsonRemoveFromArrayBinding.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; - - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] -public class JsonRemoveFromArray : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Array; - public readonly SyncRef> Index; - - public override Type NodeType => typeof(JsonRemoveFromArrayNode); - - public JsonRemoveFromArrayNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonRemoveFromArrayNode jsonAddToObjectInstance = (TypedNodeInstance = new JsonRemoveFromArrayNode()); - return jsonAddToObjectInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonRemoveFromArrayNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonRemoveFromArrayNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Array; - case 1: - return Index; - default: - index -= 2; - return null; - } - } -} diff --git a/Bindings/JSON/JsonRemoveFromObjectBinding.cs b/Bindings/JSON/JsonRemoveFromObjectBinding.cs deleted file mode 100644 index bf5cdcc..0000000 --- a/Bindings/JSON/JsonRemoveFromObjectBinding.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; - - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] -public class JsonRemoveFromObject : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - public readonly SyncRef> Tag; - - public override Type NodeType => typeof(JsonRemoveFromObjectNode); - - public JsonRemoveFromObjectNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonRemoveFromObjectNode jsonAddToObjectInstance = (TypedNodeInstance = new JsonRemoveFromObjectNode()); - return jsonAddToObjectInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonRemoveFromObjectNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonRemoveFromObjectNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Input; - case 1: - return Tag; - default: - index -= 2; - return null; - } - } -} diff --git a/Bindings/JSON/JsonToStringBinding.cs b/Bindings/JSON/JsonToStringBinding.cs deleted file mode 100644 index 4299455..0000000 --- a/Bindings/JSON/JsonToStringBinding.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; -using Newtonsoft.Json.Linq; -using FrooxEngine.ProtoFlux; - - - [Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] - public class JsonToString : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode where T : JToken - { - public readonly SyncRef> Input; - - public override Type NodeType => typeof(JsonToStringNode); - - public JsonToStringNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - JsonToStringNode jsonToStringInstance = (TypedNodeInstance = new JsonToStringNode()); - return jsonToStringInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is JsonToStringNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(JsonToStringNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } - } diff --git a/Bindings/Math/Physics/CentipetalForceBinding.cs b/Bindings/Math/Physics/CentipetalForceBinding.cs deleted file mode 100644 index 909be9e..0000000 --- a/Bindings/Math/Physics/CentipetalForceBinding.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })] -public class CentripetalForceCalculation : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> Mass; - public readonly SyncRef> Velocity; - public readonly SyncRef> Radius; - - public override Type NodeType => typeof(ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode); - - public ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode centripetalForceCalculationNode2 = (TypedNodeInstance = new ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode()); - return centripetalForceCalculationNode2 as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics.CentripetalForceCalculationNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Mass; - case 1: - return Velocity; - case 2: - return Radius; - default: - index -= 3; - return null; - } - } -} diff --git a/Bindings/Math/Physics/DragCalculationBinding.cs b/Bindings/Math/Physics/DragCalculationBinding.cs deleted file mode 100644 index 2587be9..0000000 --- a/Bindings/Math/Physics/DragCalculationBinding.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })] -public class DragCalculation : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> FluidDensity; - public readonly SyncRef> ObjectVelocity; - public readonly SyncRef> DragCoefficient; - public readonly SyncRef> CrossSectionalArea; - - public override Type NodeType => typeof(DragCalculationNode); - - public DragCalculationNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 4; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - TypedNodeInstance = new DragCalculationNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - TypedNodeInstance = node as DragCalculationNode ?? throw new ArgumentException("Node instance is not of type DragCalculationNode"); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - switch (index) - { - case 0: return FluidDensity; - case 1: return ObjectVelocity; - case 2: return DragCoefficient; - case 3: return CrossSectionalArea; - default: index -= 4; return null; - } - } -} diff --git a/Bindings/Math/Physics/KineticFrictionBinding.cs b/Bindings/Math/Physics/KineticFrictionBinding.cs deleted file mode 100644 index c17666c..0000000 --- a/Bindings/Math/Physics/KineticFrictionBinding.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })] -public class KineticFriction : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> NormalForce; - public readonly SyncRef> KineticFrictionCoefficient; - - public override Type NodeType => typeof(KineticFrictionNode); - - public KineticFrictionNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - TypedNodeInstance = new KineticFrictionNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - TypedNodeInstance = node as KineticFrictionNode ?? throw new ArgumentException("Node instance is not of type KineticFrictionNode"); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - switch (index) - { - case 0: return NormalForce; - case 1: return KineticFrictionCoefficient; - default: index -= 2; return null; - } - } -} diff --git a/Bindings/Math/Physics/RefractNodeBinding.cs b/Bindings/Math/Physics/RefractNodeBinding.cs deleted file mode 100644 index bb20a43..0000000 --- a/Bindings/Math/Physics/RefractNodeBinding.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })] -public class Refraction : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> RefractiveIndex1; - public readonly SyncRef> RefractiveIndex2; - public readonly SyncRef> AngleOfIncidence; - - public override Type NodeType => typeof(RefractionNode); - - public RefractionNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - TypedNodeInstance = new RefractionNode(); - return TypedNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - TypedNodeInstance = node as RefractionNode ?? throw new ArgumentException("Node instance is not of type RefractionNode"); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - switch (index) - { - case 0: return RefractiveIndex1; - case 1: return RefractiveIndex2; - case 2: return AngleOfIncidence; - default: index -= 3; return null; - } - } -} diff --git a/Bindings/Strings/CountSubstringBinding.cs b/Bindings/Strings/CountSubstringBinding.cs deleted file mode 100644 index f831371..0000000 --- a/Bindings/Strings/CountSubstringBinding.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class CountSubstring : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> String; - public readonly SyncRef> Pattern; - - public override Type NodeType => typeof(CountSubstringNode); - - public CountSubstringNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - CountSubstringNode countSubstringNodeInstance = (TypedNodeInstance = new CountSubstringNode()); - return countSubstringNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is CountSubstringNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(CountSubstringNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return String; - case 1: - return Pattern; - default: - index -= 2; - return null; - } - } -} diff --git a/Bindings/Strings/DecodeBase64.cs b/Bindings/Strings/DecodeBase64.cs deleted file mode 100644 index 0ca8124..0000000 --- a/Bindings/Strings/DecodeBase64.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class DecodeBase64 : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(DecodeBase64Node); - - public DecodeBase64Node TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - DecodeBase64Node decodeBase64NodeInstance = (TypedNodeInstance = new DecodeBase64Node()); - return decodeBase64NodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is DecodeBase64Node typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(DecodeBase64Node)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/DecodeMorse.cs b/Bindings/Strings/DecodeMorse.cs deleted file mode 100644 index 8c8cfdb..0000000 --- a/Bindings/Strings/DecodeMorse.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class DecodeMorse : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(DecodeMorseNode); - - public DecodeMorseNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - DecodeMorseNode decodeMorseNodeInstance = (TypedNodeInstance = new DecodeMorseNode()); - return decodeMorseNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is DecodeMorseNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(DecodeMorseNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/EncodeBase64.cs b/Bindings/Strings/EncodeBase64.cs deleted file mode 100644 index 5574ad8..0000000 --- a/Bindings/Strings/EncodeBase64.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class EncodeBase64 : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(EncodeBase64Node); - - public EncodeBase64Node TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - EncodeBase64Node encodeBase64NodeInstance = (TypedNodeInstance = new EncodeBase64Node()); - return encodeBase64NodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is EncodeBase64Node typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(EncodeBase64Node)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/EncodeMD5.cs b/Bindings/Strings/EncodeMD5.cs deleted file mode 100644 index 6f1a169..0000000 --- a/Bindings/Strings/EncodeMD5.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class EncodeMD5 : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(EncodeMD5Node); - - public EncodeMD5Node TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - EncodeMD5Node encodeMD5NodeInstance = (TypedNodeInstance = new EncodeMD5Node()); - return encodeMD5NodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is EncodeMD5Node typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(EncodeMD5Node)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/EncodeMorse.cs b/Bindings/Strings/EncodeMorse.cs deleted file mode 100644 index 7fdd1df..0000000 --- a/Bindings/Strings/EncodeMorse.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class EncodeMorse : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(EncodeMorseNode); - - public EncodeMorseNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - EncodeMorseNode encodeMorseNodeInstance = (TypedNodeInstance = new EncodeMorseNode()); - return encodeMorseNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is EncodeMorseNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(EncodeMorseNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/EncodeSHA256.cs b/Bindings/Strings/EncodeSHA256.cs deleted file mode 100644 index cbdaeea..0000000 --- a/Bindings/Strings/EncodeSHA256.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class EncodeSha256 : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Input; - - public override Type NodeType => typeof(EncodeSha256Node); - - public EncodeSha256Node TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - EncodeSha256Node encodeSha256NodeInstance = (TypedNodeInstance = new EncodeSha256Node()); - return encodeSha256NodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is EncodeSha256Node typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(EncodeSha256Node)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return Input; - } - index -= 1; - return null; - } -} diff --git a/Bindings/Strings/HMAC.cs b/Bindings/Strings/HMAC.cs deleted file mode 100644 index e0f69fe..0000000 --- a/Bindings/Strings/HMAC.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class EncodeHMAC : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> Message; - public readonly SyncRef> Key; - public readonly SyncRef> HashAlgorithm; - - public override Type NodeType => typeof(HMACNode); - - public HMACNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 3; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - HMACNode hmacNodeInstance = (TypedNodeInstance = new HMACNode()); - return hmacNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is HMACNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(HMACNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Message; - case 1: - return Key; - case 2: - return HashAlgorithm; - default: - index -= 3; - return null; - } - } -} diff --git a/Bindings/Strings/HammingDistance.cs b/Bindings/Strings/HammingDistance.cs deleted file mode 100644 index 22576c9..0000000 --- a/Bindings/Strings/HammingDistance.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class HammingDistance : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode -{ - public readonly SyncRef> String1; - public readonly SyncRef> String2; - - public override Type NodeType => typeof(HammingDistanceNode); - - public HammingDistanceNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - HammingDistanceNode hammingDistanceNodeInstance = (TypedNodeInstance = new HammingDistanceNode()); - return hammingDistanceNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is HammingDistanceNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(HammingDistanceNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return String1; - case 1: - return String2; - default: - index -= 2; - return null; - } - } -} diff --git a/Bindings/Strings/HammingDistanceNonNullable.cs b/Bindings/Strings/HammingDistanceNonNullable.cs deleted file mode 100644 index 5da47f1..0000000 --- a/Bindings/Strings/HammingDistanceNonNullable.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using ProtoFlux.Runtimes.Execution.Nodes.Strings; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/String" })] -public class HammingDistanceNonNullable : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> String1; - public readonly SyncRef> String2; - - public override Type NodeType => typeof(HammingDistanceNonNullableNode); - - public HammingDistanceNonNullableNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - HammingDistanceNonNullableNode hammingDistanceNonNullableNodeInstance = (TypedNodeInstance = new HammingDistanceNonNullableNode()); - return hammingDistanceNonNullableNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is HammingDistanceNonNullableNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(HammingDistanceNonNullableNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return String1; - case 1: - return String2; - default: - index -= 2; - return null; - } - } -} diff --git a/Bindings/User/IsUserInNoclipBinding.cs b/Bindings/User/IsUserInNoclipBinding.cs deleted file mode 100644 index 11e9d00..0000000 --- a/Bindings/User/IsUserInNoclipBinding.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using FrooxEngine.ProtoFlux.Locomotion; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Locomotion" })] -public class IsUserInNoClip : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> User; - - public override Type NodeType => typeof(IsUserInNoClipNode); - - public IsUserInNoClipNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - IsUserInNoClipNode isUserInNoClipNodeInstance = (TypedNodeInstance = new IsUserInNoClipNode()); - return isUserInNoClipNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is IsUserInNoClipNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(IsUserInNoClipNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return User; - } - index -= 1; - return null; - } -} diff --git a/Bindings/User/IsUserInSeatedModeBinding.cs b/Bindings/User/IsUserInSeatedModeBinding.cs deleted file mode 100644 index 17c8441..0000000 --- a/Bindings/User/IsUserInSeatedModeBinding.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using FrooxEngine.ProtoFlux.Status; - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Locomotion" })] -public class IsUserInSeatedModeBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode -{ - public readonly SyncRef> User; - - public override Type NodeType => typeof(IsUserInSeatedModeNode); - - public IsUserInSeatedModeNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 1; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - IsUserInSeatedModeNode isUserInSeatedModeNodeInstance = (TypedNodeInstance = new IsUserInSeatedModeNode()); - return isUserInSeatedModeNodeInstance as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is IsUserInSeatedModeNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(IsUserInSeatedModeNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - if (index == 0) - { - return User; - } - index -= 1; - return null; - } -} \ No newline at end of file diff --git a/Bindings/Utility/writetolog.cs b/Bindings/Utility/writetolog.cs deleted file mode 100644 index 1608e88..0000000 --- a/Bindings/Utility/writetolog.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using FrooxEngine.ProtoFlux.Runtimes.Execution; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Utility; - - -[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Utility" })] -public class WriteToLog : AsyncActionNode -{ - public readonly SyncRef> Value; - public readonly SyncRef> Severity; - public readonly SyncRef> Tag; - public readonly SyncRef> HandlingUser; - - public readonly SyncRef OnWriteStart; - public readonly SyncRef OnWriteComplete; - - public override Type NodeType => typeof(WriteToLogNode); - - public WriteToLogNode TypedNodeInstance { get; private set; } - - public override INode NodeInstance => TypedNodeInstance; - - public override int NodeInputCount => base.NodeInputCount + 4; - - public override int NodeImpulseCount => base.NodeImpulseCount + 2; - - public override N Instantiate() - { - if (TypedNodeInstance != null) - { - throw new InvalidOperationException("Node has already been instantiated"); - } - WriteToLogNode writeToLogNode = (TypedNodeInstance = new WriteToLogNode()); - return writeToLogNode as N; - } - - protected override void AssociateInstanceInternal(INode node) - { - if (node is WriteToLogNode typedNodeInstance) - { - TypedNodeInstance = typedNodeInstance; - return; - } - throw new ArgumentException("Node instance is not of type " + typeof(WriteToLogNode)); - } - - public override void ClearInstance() - { - TypedNodeInstance = null; - } - - protected override ISyncRef GetInputInternal(ref int index) - { - ISyncRef inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) - { - return inputInternal; - } - switch (index) - { - case 0: - return Value; - case 1: - return Severity; - case 2: - return Tag; - case 3: - return HandlingUser; - default: - index -= 4; - return null; - } - } - - protected override ISyncRef GetImpulseInternal(ref int index) - { - ISyncRef impulseInternal = base.GetImpulseInternal(ref index); - if (impulseInternal != null) - { - return impulseInternal; - } - switch (index) - { - case 0: - return OnWriteStart; - case 1: - return OnWriteComplete; - default: - index -= 2; - return null; - } - } -} diff --git a/ProjectObsidian.SourceGenerators/BindingGenerator.cs b/ProjectObsidian.SourceGenerators/BindingGenerator.cs new file mode 100644 index 0000000..fe1b860 --- /dev/null +++ b/ProjectObsidian.SourceGenerators/BindingGenerator.cs @@ -0,0 +1,334 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SourceGenerators +{ + public static class StringHelpers + { + public static string TrimEnds(this string str, int fromStart, int fromEnd) => + str.Substring(fromStart, str.Length - fromEnd - fromStart); + } + [Generator] + public class BindingGenerator : ISourceGenerator + { + public void Initialize(GeneratorInitializationContext context) + { + } + + public void Execute(GeneratorExecutionContext context) + { + foreach (var tree in context.Compilation.SyntaxTrees) + { + var result = new StringBuilder(); + var root = tree.GetCompilationUnitRoot(); + var walker = new BindingGeneratorSyntaxWalker(); + walker.Visit(root); + result.Append(walker.Result); + + var res = result.ToString(); + + if (!string.IsNullOrWhiteSpace(res)) + context.AddSource($"{walker.BaseName}Bindings.g.cs", result.ToString()); + } + } + } + + public class BindingGeneratorSyntaxWalker : CSharpSyntaxWalker + { + private class OrderedCount + { + private readonly string CountVariableName; + private readonly string MethodName; + private readonly string MethodReturnType; + public string CountOverride => VariableNames.Count == 0 + ? "" + : $" public override int {CountVariableName} => base.{CountVariableName} + {VariableNames.Count};"; + + public void Add(string value) => VariableNames.Add(value); + + public string GetOverride + { + get + { + if (VariableNames.Count == 0) return ""; + var str = $@" + protected override {MethodReturnType} {MethodName}(ref int index) + {{ + var item = base.{MethodName}(ref index); + if (item != null) return item; + switch (index) + {{ +"; + for (var index = 0; index < VariableNames.Count; index++) + { + var order = VariableNames[index]; + str += $" case {index}:\n return this.{order};\n"; + } + str += $@" + default: + index -= {VariableNames.Count}; + return null; + }} + }}"; + return str; + } + } + + public readonly List VariableNames = new(); + + public OrderedCount(string countVariableName, string methodName, string methodReturnType) + { + CountVariableName = countVariableName; + MethodName = methodName; + MethodReturnType = methodReturnType; + } + } + + public const string BindingPrefix = "FrooxEngine."; + public const string FluxPrefix = "ProtoFlux.Runtimes.Execution."; + + //TODO: add more, this is not all of the valid node types + public static readonly string[] ValidNodeTypes = + { + "NestedNode", + "VoidNode", + + "ObjectFunctionNode", + "ValueFunctionNode", + + "ActionNode", + "ActionFlowNode", + "ActionBreakableFlowNode", + + "AsyncActionNode", + "AsyncActionFlowNode", + "AsyncActionBreakableFlowNode", + }; + + private string UsingEnumerate => + _usingDeclarations + .Where(u => !string.IsNullOrWhiteSpace(u)) + .Aggregate("", (current, u) => current + $"using {u};\n"); + + private readonly OrderedCount _inputCount = new("NodeInputCount", "GetInputInternal", "ISyncRef"); + private readonly OrderedCount _outputCount = new("NodeOutputCount", "GetOutputInternal", "INodeOutput"); + private readonly OrderedCount _impulseCount = new("NodeImpulseCount", "GetImpulseInternal", "ISyncRef"); + private readonly OrderedCount _operationCount = new("NodeImpulseCount", "GetImpulseInternal", "INodeOperation"); + + private readonly OrderedCount _inputListCount = new("NodeInputListCount", "GetInputListInternal", "ISyncList"); + private readonly OrderedCount _outputListCount = new("NodeOutputListCount", "GetOutputListInternal", "ISyncList"); + private readonly OrderedCount _impulseListCount = new("NodeImpulseListCount", "GetImpulseListInternal", "ISyncList"); + private readonly OrderedCount _operationListCount = new("NodeOperationListCount", "GetOperationListInternal", "ISyncList"); + + private IEnumerable _counts => new[] + { _inputCount, _outputCount, _impulseCount, _operationCount, + _inputListCount, _outputListCount, _impulseListCount, _operationListCount }; + + private string CountOverride => string.Concat(_counts.Select(i => i.CountOverride)); + private string GetOverride => string.Concat(_counts.Select(i => i.GetOverride)); + + private List _declarations = []; + private string Declarations => string.Concat(_declarations); + + public string Result + { + get + { + if (!_valid) return ""; + + var str = @$"//generated +{UsingEnumerate} +using {_currentNameSpace}; + +namespace {BindingPrefix}{_currentNameSpace}; + +[Category(new string[] {{""ProtoFlux/Runtimes/Execution/Nodes/{_category}""}})] +public partial class {_fullName} : {_baseType} +{{ +{Declarations} +{_nodeNameOverride} + public override System.Type NodeType => typeof (global::{_currentNameSpace}.{_fullName}); + public global::{_currentNameSpace}.{_fullName} TypedNodeInstance {{ get; private set; }} + public override INode NodeInstance => (INode)this.TypedNodeInstance; + public override void ClearInstance() => this.TypedNodeInstance = null; +{CountOverride} + public override N Instantiate() + {{ + if (this.TypedNodeInstance != null) throw new System.InvalidOperationException(""Node has already been instantiated""); + var localVar = new global::{_currentNameSpace}.{_fullName}(); + this.TypedNodeInstance = localVar; + return localVar as N; + }} + protected override void AssociateInstanceInternal(INode node) => this.TypedNodeInstance = node is global::{_currentNameSpace}.{_fullName} localVar ? localVar : throw new System.ArgumentException(""Node instance is not of type "" + typeof (global::{_currentNameSpace}.{_fullName})?.ToString()); +{GetOverride} +}}"; + return str; + } + } + + private readonly List _usingDeclarations = [""]; + private bool _valid; + private string _currentNameSpace; + private string _fullName; + private string _additionalName = ""; + public string BaseName; + private string _baseType; + private string _fullBaseType; + private string _match; + private string _category; + private string _nodeNameOverride = ""; + + private bool TypedFieldDetection(string type, string name, string targetTypeName, string declarationFormat, OrderedCount counter) + { + if (!type.Contains(targetTypeName)) return false; + var t = type.TrimEnds((targetTypeName + "<").Length, 1); + counter.Add(name); + _declarations.Add(string.Format(" new public readonly " + declarationFormat + " {0};\n", name, t)); + return true; + } + private bool UntypedFieldDetection(string type, string name, string targetTypeName, string declarationFormat, OrderedCount counter) + { + if (!type.Contains(targetTypeName)) return false; + counter.Add(name); + _declarations.Add(string.Format(" new public readonly " + declarationFormat + " {0};\n", name)); + return true; + } + public override void VisitFieldDeclaration(FieldDeclarationSyntax node) + { + var type = node.Declaration.Type.ToString(); + var name = node.Declaration.Variables.First().ToString(); + + //inputs + TypedFieldDetection(type, name, "ObjectInput", "SyncRef>", _inputCount); + TypedFieldDetection(type, name, "ObjectArgument", "SyncRef>", _inputCount); + TypedFieldDetection(type, name, "ValueInput", "SyncRef>", _inputCount); + TypedFieldDetection(type, name, "ValueArgument", "SyncRef>", _inputCount); + + //outputs + TypedFieldDetection(type, name, "ObjectOutput", "NodeObjectOutput<{1}>", _outputCount); + TypedFieldDetection(type, name, "ValueOutput", "NodeValueOutput<{1}>", _outputCount); + + //impulses + if (!UntypedFieldDetection(type, name, "AsyncCall", "SyncRef", _impulseCount)) + UntypedFieldDetection(type, name, "Call", "SyncRef", _impulseCount); + UntypedFieldDetection(type, name, "Continuation", "SyncRef", _impulseCount); + UntypedFieldDetection(type, name, "AsyncResumption", "SyncRef", _impulseCount); + + //operations + UntypedFieldDetection(type, name, "Operation", "SyncNodeOperation", _operationCount); + + //lists + + //input lists + TypedFieldDetection(type, name, "ValueInputList", "SyncRefList>", _inputListCount); + + //output lists + TypedFieldDetection(type, name, "ObjectInputList", "SyncRefList>", _outputListCount); + + //impulse lists + UntypedFieldDetection(type, name, "ContinuationList", "SyncRefList", _impulseListCount); + + //operation lists + UntypedFieldDetection(type, name, "SyncOperationList", "SyncList", _operationListCount); + + base.VisitFieldDeclaration(node); + } + + public override void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) + { + _currentNameSpace = node.Name.ToString(); + base.VisitNamespaceDeclaration(node); + } + + public override void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) + { + _currentNameSpace = node.Name.ToString(); + base.VisitFileScopedNamespaceDeclaration(node); + } + + public override void VisitUsingDirective(UsingDirectiveSyntax node) + { + if (node.Name is not null) _usingDeclarations.Add(node.Name.ToString()); + base.VisitUsingDirective(node); + } + public override void VisitClassDeclaration(ClassDeclarationSyntax node) + { + if (node.BaseList is null) + { + base.VisitClassDeclaration(node); + return; + } + + var baseName = node.Identifier.Text; + var fullName = baseName; + + if (node.TypeParameterList is not null) + { + _additionalName += "<"; + _additionalName = node.TypeParameterList.Parameters.Aggregate(_additionalName, + (current, p) => current + $"{p.Identifier.Text},"); + _additionalName = _additionalName.Substring(0, _additionalName.Length - 1); //remove last , + _additionalName += ">"; + + fullName += _additionalName; + } + + BaseName = baseName; + _fullName = fullName; + + var firstBaseType = node.BaseList.Types.First(); + var baseTypeName = firstBaseType.Type.ToString(); + + _baseType = baseTypeName; + + if (!node.AttributeLists.Any()) + { + base.VisitClassDeclaration(node); + return; + } + + var find = node.AttributeLists.SelectMany(i => i.Attributes) + .FirstOrDefault(i => i.Name.ToString() == "NodeCategory"); + + if (find?.ArgumentList is null) + { + base.VisitClassDeclaration(node); + return; + } + + _category = find.ArgumentList.Arguments.First().ToString().TrimEnds(1,1); + + var findName = node.AttributeLists.SelectMany(i => i.Attributes) + .FirstOrDefault(i => i.Name.ToString() == "NodeName"); + + + if (findName?.ArgumentList != null) + _nodeNameOverride = + $" public override string NodeName => {findName.ArgumentList.Arguments.First().ToString()};"; + + foreach (var u in _usingDeclarations) + { + var fullNameSpace = ""; + if (string.IsNullOrEmpty(u)) + fullNameSpace = baseTypeName; + else + fullNameSpace = u + "." + baseTypeName; + + var match = ValidNodeTypes.FirstOrDefault(i => fullNameSpace.StartsWith(FluxPrefix + i)); + + if (match is null) continue; + + _match = match; + _fullBaseType = fullNameSpace; + _valid = true; + base.VisitClassDeclaration(node); + return; + } + base.VisitClassDeclaration(node); + } + } +} \ No newline at end of file diff --git a/ProjectObsidian.SourceGenerators/SourceGenerators.csproj b/ProjectObsidian.SourceGenerators/SourceGenerators.csproj new file mode 100644 index 0000000..b8f50eb --- /dev/null +++ b/ProjectObsidian.SourceGenerators/SourceGenerators.csproj @@ -0,0 +1,9 @@ + + + netstandard2.0 + latest + + + + + \ No newline at end of file diff --git a/ProjectObsidian.sln b/ProjectObsidian.sln index cef78e9..e81cd1c 100644 --- a/ProjectObsidian.sln +++ b/ProjectObsidian.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33516.290 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectObsidian", "ProjectObsidian.csproj", "{C91F0581-2EDF-47EF-9E89-47F4A26639E7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectObsidian", "ProjectObsidian/ProjectObsidian.csproj", "{C91F0581-2EDF-47EF-9E89-47F4A26639E7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGenerators", "ProjectObsidian.SourceGenerators\SourceGenerators.csproj", "{D98EE77D-62E7-4C0F-9E35-F180637F24F1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {C91F0581-2EDF-47EF-9E89-47F4A26639E7}.Debug|Any CPU.Build.0 = Debug|Any CPU {C91F0581-2EDF-47EF-9E89-47F4A26639E7}.Release|Any CPU.ActiveCfg = Release|Any CPU {C91F0581-2EDF-47EF-9E89-47F4A26639E7}.Release|Any CPU.Build.0 = Release|Any CPU + {D98EE77D-62E7-4C0F-9E35-F180637F24F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D98EE77D-62E7-4C0F-9E35-F180637F24F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D98EE77D-62E7-4C0F-9E35-F180637F24F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D98EE77D-62E7-4C0F-9E35-F180637F24F1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Components/Mesh/MengerSponge.cs b/ProjectObsidian/Components/Mesh/MengerSponge.cs similarity index 100% rename from Components/Mesh/MengerSponge.cs rename to ProjectObsidian/Components/Mesh/MengerSponge.cs diff --git a/Components/Mesh/MengerSpongeMesh.cs b/ProjectObsidian/Components/Mesh/MengerSpongeMesh.cs similarity index 100% rename from Components/Mesh/MengerSpongeMesh.cs rename to ProjectObsidian/Components/Mesh/MengerSpongeMesh.cs diff --git a/Components/Mesh/SierpinskiPyramid.cs b/ProjectObsidian/Components/Mesh/SierpinskiPyramid.cs similarity index 100% rename from Components/Mesh/SierpinskiPyramid.cs rename to ProjectObsidian/Components/Mesh/SierpinskiPyramid.cs diff --git a/Components/Mesh/SierpinskiPyramidMesh.cs b/ProjectObsidian/Components/Mesh/SierpinskiPyramidMesh.cs similarity index 100% rename from Components/Mesh/SierpinskiPyramidMesh.cs rename to ProjectObsidian/Components/Mesh/SierpinskiPyramidMesh.cs diff --git a/Components/Transform/Drivers/MultiValueArithmeticDriver.cs b/ProjectObsidian/Components/Transform/Drivers/MultiValueArithmeticDriver.cs similarity index 100% rename from Components/Transform/Drivers/MultiValueArithmeticDriver.cs rename to ProjectObsidian/Components/Transform/Drivers/MultiValueArithmeticDriver.cs diff --git a/Components/Users/BoundingBoxUserTracker.cs b/ProjectObsidian/Components/Users/BoundingBoxUserTracker.cs similarity index 100% rename from Components/Users/BoundingBoxUserTracker.cs rename to ProjectObsidian/Components/Users/BoundingBoxUserTracker.cs diff --git a/ProjectObsidian.csproj b/ProjectObsidian/ProjectObsidian.csproj similarity index 90% rename from ProjectObsidian.csproj rename to ProjectObsidian/ProjectObsidian.csproj index 5617696..e397d44 100644 --- a/ProjectObsidian.csproj +++ b/ProjectObsidian/ProjectObsidian.csproj @@ -49,4 +49,8 @@ + + + + diff --git a/ProtoFlux/Devices/ViveTrackerBattery.cs b/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs similarity index 98% rename from ProtoFlux/Devices/ViveTrackerBattery.cs rename to ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs index 2fedb3a..868b8df 100644 --- a/ProtoFlux/Devices/ViveTrackerBattery.cs +++ b/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs @@ -9,9 +9,9 @@ using ProtoFlux.Runtimes.Execution; using Obsidian; - namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input; -[NodeCategory("Devices")] + +[NodeCategory("Obsidian/Devices")] public class ViveTrackerBattery : VoidNode { public ObjectArgument User; diff --git a/ProtoFlux/JSON/JsonAddToObject.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddToObject.cs similarity index 97% rename from ProtoFlux/JSON/JsonAddToObject.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonAddToObject.cs index 96f8ac4..1088fd6 100644 --- a/ProtoFlux/JSON/JsonAddToObject.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddToObject.cs @@ -9,7 +9,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeName("Add To Object")] - [Category("Protoflux/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))] diff --git a/ProtoFlux/JSON/JsonAppendToArray.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs similarity index 83% rename from ProtoFlux/JSON/JsonAppendToArray.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs index 2e221b2..37c5037 100644 --- a/ProtoFlux/JSON/JsonAppendToArray.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs @@ -4,18 +4,19 @@ using ProtoFlux.Runtimes.Execution; using FrooxEngine; using Elements.Core; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { - [NodeCategory("ProtoFlux/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 : ObjectFunctionNode + public class JsonAppendToArrayNode : ObjectFunctionNode { public readonly ObjectInput Array; public readonly ObjectInput Object; - protected override JArray Compute(ExecutionContext context) + protected override JArray Compute(FrooxEngineContext context) { var array = Array.Evaluate(context); var obj = Object.Evaluate(context); diff --git a/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs similarity index 65% rename from ProtoFlux/JSON/JsonCountArrayChildrenNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs index f364316..3517dd2 100644 --- a/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonCountArrayChildrenNode : ValueFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonCountArrayChildrenNode : ValueFunctionNode { public readonly ObjectInput Input; - protected override int Compute(ExecutionContext context) + protected override int Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); return input?.Count ?? -1; diff --git a/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs similarity index 65% rename from ProtoFlux/JSON/JsonCountObjectChildrenNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs index d03f660..a4086da 100644 --- a/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonCountObjectChildrenNode : ValueFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonCountObjectChildrenNode : ValueFunctionNode { public readonly ObjectInput Input; - protected override int Compute(ExecutionContext context) + protected override int Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); return input?.Count ?? -1; diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs b/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs new file mode 100644 index 0000000..fc712e5 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs @@ -0,0 +1,33 @@ +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 + { + protected override JObject Compute(FrooxEngineContext context) + { + return new JObject(); + } + } + + [NodeCategory("Obsidian/Json")] + public class JsonEmptyArrayNode : ObjectFunctionNode + { + protected override JArray Compute(FrooxEngineContext context) + { + return new JArray(); + } + } + [NodeCategory("Obsidian/Json")] + public class JsonNullValueNode : ObjectFunctionNode + { + protected override JToken Compute(FrooxEngineContext context) + { + return JValue.CreateNull(); + } + } +} \ No newline at end of file diff --git a/ProtoFlux/JSON/JsonGetFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs similarity index 82% rename from ProtoFlux/JSON/JsonGetFromArrayNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs index 77f752c..2524b5a 100644 --- a/ProtoFlux/JSON/JsonGetFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs @@ -4,20 +4,21 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { - [NodeCategory("ProtoFlux/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 : ObjectFunctionNode + public class JsonGetFromArrayNode : ObjectFunctionNode { public readonly ObjectInput Input; public readonly ObjectInput Index; - protected override T Compute(ExecutionContext context) + protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); var index = Index.Evaluate(context); diff --git a/ProtoFlux/JSON/JsonGetFromObject.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs similarity index 81% rename from ProtoFlux/JSON/JsonGetFromObject.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs index 5e5ac32..64f8da4 100644 --- a/ProtoFlux/JSON/JsonGetFromObject.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs @@ -4,19 +4,20 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { - [NodeCategory("ProtoFlux/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 : ObjectFunctionNode + public class JsonGetFromObjectNode : ObjectFunctionNode { public readonly ObjectInput Input; public readonly ObjectInput Tag; - protected override T Compute(ExecutionContext context) + protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); var tag = Tag.Evaluate(context); diff --git a/ProtoFlux/JSON/JsonInfo.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInfo.cs similarity index 100% rename from ProtoFlux/JSON/JsonInfo.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonInfo.cs diff --git a/ProtoFlux/JSON/JsonInsertToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs similarity index 79% rename from ProtoFlux/JSON/JsonInsertToArrayNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs index ff391b6..044c924 100644 --- a/ProtoFlux/JSON/JsonInsertToArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs @@ -4,20 +4,21 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { - [NodeCategory("ProtoFlux/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 : ObjectFunctionNode + public class JsonInsertToArrayNode : ObjectFunctionNode { public readonly ObjectInput Array; public readonly ObjectInput Object; public readonly ObjectInput Index; - protected override JArray Compute(ExecutionContext context) + protected override JArray Compute(FrooxEngineContext context) { var array = Array.Evaluate(context); var obj = Object.Evaluate(context); @@ -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; } diff --git a/ProtoFlux/JSON/JsonParseStringArray.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs similarity index 73% rename from ProtoFlux/JSON/JsonParseStringArray.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs index 0897898..7d18d4d 100644 --- a/ProtoFlux/JSON/JsonParseStringArray.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonParseStringArrayNode : ObjectFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonParseStringArrayNode : ObjectFunctionNode { public readonly ObjectInput Input; - protected override JArray Compute(ExecutionContext context) + protected override JArray Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrEmpty(input)) diff --git a/ProtoFlux/JSON/JsonParseStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs similarity index 74% rename from ProtoFlux/JSON/JsonParseStringNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs index 8715ce7..1624cd1 100644 --- a/ProtoFlux/JSON/JsonParseStringNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonParseStringNode : ObjectFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonParseStringNode : ObjectFunctionNode { public readonly ObjectInput Input; - protected override JObject Compute(ExecutionContext context) + protected override JObject Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrEmpty(input)) diff --git a/ProtoFlux/JSON/JsonQuickGetObject.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs similarity index 88% rename from ProtoFlux/JSON/JsonQuickGetObject.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs index aeaa2bd..b5e491d 100644 --- a/ProtoFlux/JSON/JsonQuickGetObject.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs @@ -4,18 +4,19 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { - [NodeCategory("ProtoFlux/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 : ObjectFunctionNode + public class JsonQuickGetFromObjectNode : ObjectFunctionNode { public readonly ObjectInput Input; public readonly ObjectInput Tag; - protected override T Compute(ExecutionContext context) + protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); var tag = Tag.Evaluate(context); diff --git a/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs similarity index 77% rename from ProtoFlux/JSON/JsonRemoveFromArrayNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs index 5694273..25ea200 100644 --- a/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonRemoveFromArrayNode : ObjectFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonRemoveFromArrayNode : ObjectFunctionNode { public readonly ObjectInput Array; public readonly ObjectInput Index; - protected override JArray Compute(ExecutionContext context) + protected override JArray Compute(FrooxEngineContext context) { var array = Array.Evaluate(context); var index = Index.Evaluate(context); diff --git a/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs similarity index 72% rename from ProtoFlux/JSON/JsonRemoveFromObjectNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs index 7ae2dd8..7fa503b 100644 --- a/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs @@ -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("ProtoFlux/Obsidian/Json")] - public class JsonRemoveFromObjectNode : ObjectFunctionNode + [NodeCategory("Obsidian/Json")] + public class JsonRemoveFromObjectNode : ObjectFunctionNode { public readonly ObjectInput Input; public readonly ObjectInput Tag; - protected override JObject Compute(ExecutionContext context) + protected override JObject Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (input == null) return null; diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs new file mode 100644 index 0000000..6d2ddd5 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs @@ -0,0 +1,21 @@ +using System; +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using Newtonsoft.Json.Linq; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeCategory("Obsidian/Json")] +[GenericTypes(typeof(JToken), typeof(JObject), typeof(JArray))] +public class JsonToStringNode : ObjectFunctionNode +{ + public readonly ObjectInput Input; + + protected override string Compute(FrooxEngineContext context) + { + var input = Input.Evaluate(context); + return input?.ToString(); + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs new file mode 100644 index 0000000..1bcb2c6 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs @@ -0,0 +1,16 @@ +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants; + +[NodeCategory("Obsidian/Math/Constants")] +[NodeName("Epsilon Double")] +public class EpsilonDouble : ValueFunctionNode +{ + protected override double Compute(FrooxEngineContext context) + { + return MathX.DOUBLE_EPSILON; + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs new file mode 100644 index 0000000..2626b29 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs @@ -0,0 +1,16 @@ +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants; + +[NodeCategory("Obsidian/Math/Constants")] +[NodeName("Epsilon Float")] +public class EpsilonFloat : ValueFunctionNode +{ + protected override float Compute(FrooxEngineContext context) + { + return MathX.FLOAT_EPSILON; + } +} diff --git a/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs similarity index 84% rename from ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs rename to ProjectObsidian/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs index ca10a98..4bb176f 100644 --- a/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs +++ b/ProjectObsidian/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs @@ -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 + [NodeCategory("Obsidian/Math/Physics")] + public class CentripetalForceCalculationNode : ValueFunctionNode { public ValueInput Mass; public ValueInput Velocity; public ValueInput Radius; - protected override float Compute(ExecutionContext context) + protected override float Compute(FrooxEngineContext context) { try { diff --git a/ProtoFlux/Math/Physics/DragCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs similarity index 86% rename from ProtoFlux/Math/Physics/DragCalculationNode.cs rename to ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs index 79b9616..33c326e 100644 --- a/ProtoFlux/Math/Physics/DragCalculationNode.cs +++ b/ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs @@ -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 + public class DragCalculationNode : ValueFunctionNode { public ValueInput FluidDensity; // rho public ValueInput ObjectVelocity; // v public ValueInput DragCoefficient; // Cd public ValueInput CrossSectionalArea; // A - protected override float3 Compute(ExecutionContext context) + protected override float3 Compute(FrooxEngineContext context) { float rho = FluidDensity.Evaluate(context); float3 v = ObjectVelocity.Evaluate(context); diff --git a/ProtoFlux/Math/Physics/KinecticFrictionNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/KinecticFrictionNode.cs similarity index 78% rename from ProtoFlux/Math/Physics/KinecticFrictionNode.cs rename to ProjectObsidian/ProtoFlux/Math/Physics/KinecticFrictionNode.cs index 091a480..15b67db 100644 --- a/ProtoFlux/Math/Physics/KinecticFrictionNode.cs +++ b/ProjectObsidian/ProtoFlux/Math/Physics/KinecticFrictionNode.cs @@ -3,16 +3,17 @@ 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 KineticFrictionNode : ValueFunctionNode + public class KineticFrictionNode : ValueFunctionNode { public ValueInput NormalForce; public ValueInput KineticFrictionCoefficient; - protected override float3 Compute(ExecutionContext context) + protected override float3 Compute(FrooxEngineContext context) { float3 normal = NormalForce.Evaluate(context); float coefficient = KineticFrictionCoefficient.Evaluate(context); diff --git a/ProtoFlux/Math/Physics/RefractCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/RefractCalculationNode.cs similarity index 85% rename from ProtoFlux/Math/Physics/RefractCalculationNode.cs rename to ProjectObsidian/ProtoFlux/Math/Physics/RefractCalculationNode.cs index d317375..bd0b67b 100644 --- a/ProtoFlux/Math/Physics/RefractCalculationNode.cs +++ b/ProjectObsidian/ProtoFlux/Math/Physics/RefractCalculationNode.cs @@ -3,17 +3,18 @@ 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 RefractionNode : ValueFunctionNode + public class RefractionNode : ValueFunctionNode { public ValueInput RefractiveIndex1; public ValueInput RefractiveIndex2; public ValueInput AngleOfIncidence; - protected override float Compute(ExecutionContext context) + protected override float Compute(FrooxEngineContext context) { float n1 = RefractiveIndex1.Evaluate(context); float n2 = RefractiveIndex2.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs new file mode 100644 index 0000000..5ce02eb --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs @@ -0,0 +1,26 @@ +using System; +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using ProtoFlux.Runtimes.Execution.Nodes.Actions; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[ContinuouslyChanging] + +public class RandomBool2 : ObjectFunctionNode +{ + public ValueInput Chance; + + protected override bool2 Compute(FrooxEngineContext context) + { + var chance = Chance.Evaluate(context); + var result = new bool2( + RandomX.Chance(chance.x), + RandomX.Chance(chance.y) + ); + return result; + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs new file mode 100644 index 0000000..8e12411 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs @@ -0,0 +1,22 @@ +using Elements.Core; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using ProtoFlux.Runtimes.Execution.Nodes.Actions; +using FrooxEngine; +using FrooxEngine.ProtoFlux; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Bool3")] +[ContinuouslyChanging] +public class RandomBool3 : ValueFunctionNode +{ + public ValueInput Chance; + + protected override bool3 Compute(FrooxEngineContext context) + { + var chance = Chance.Evaluate(context); + return new bool3(RandomX.Chance(chance.x), RandomX.Chance(chance.y), RandomX.Chance(chance.z)); + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs new file mode 100644 index 0000000..da9c8f0 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs @@ -0,0 +1,27 @@ +using Elements.Core; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using ProtoFlux.Runtimes.Execution.Nodes.Actions; +using FrooxEngine; +using FrooxEngine.ProtoFlux; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Bool4")] +[ContinuouslyChanging] +public class RandomBool4 : ValueFunctionNode +{ + public ValueInput Chance; + + protected override bool4 Compute(FrooxEngineContext context) + { + var chance = Chance.Evaluate(context); + return new bool4( + RandomX.Chance(chance.x), + RandomX.Chance(chance.y), + RandomX.Chance(chance.z), + RandomX.Chance(chance.w) + ); + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs new file mode 100644 index 0000000..c64b917 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs @@ -0,0 +1,25 @@ +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using ProtoFlux.Runtimes.Execution.Nodes.Actions; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Character")] +[ContinuouslyChanging] +public class RandomCharacter : ValueFunctionNode +{ + public ValueInput Start; + public ValueInput End; + public ObjectInput String; + + protected override char Compute(FrooxEngineContext context) + { + var str = String.Evaluate(context); + var start = MathX.Clamp(Start.Evaluate(context), 0, str.Length); + var end = MathX.Clamp(End.Evaluate(context,str.Length), start, str.Length); + return str[RandomX.Range(start, end)]; + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs new file mode 100644 index 0000000..da0c26e --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs @@ -0,0 +1,31 @@ +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using ProtoFlux.Runtimes.Execution.Nodes.Actions; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Double")] +[ContinuouslyChanging] +public class RandomDouble : ValueFunctionNode +{ + public ValueInput Min; + public ValueInput Max; + + protected override double Compute(FrooxEngineContext context) + { + var min = Min.Evaluate(context); + var max = Max.Evaluate(context); + if (min > max) + { + var num1 = max; + var num2 = min; + min = num1; + max = num2; + } + + return min + RandomX.Double * (max - min); + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs new file mode 100644 index 0000000..a774882 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs @@ -0,0 +1,30 @@ +using Elements.Core; +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Euler Angles")] +[ContinuouslyChanging] + +public class RandomEulerAngles : ValueFunctionNode +{ + public ValueInput minPitch; + public ValueInput maxPitch; + public ValueInput minYaw; + public ValueInput maxYaw; + public ValueInput minRoll; + public ValueInput maxRoll; + + protected override float3 Compute(FrooxEngineContext context) + { + float pitch = RandomX.Range(minPitch.Evaluate(context), maxPitch.Evaluate(context)); + float yaw = RandomX.Range(minYaw.Evaluate(context), maxYaw.Evaluate(context)); + float roll = RandomX.Range(minRoll.Evaluate(context), maxRoll.Evaluate(context)); + + return new float3(pitch, yaw, roll); + } +} diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs new file mode 100644 index 0000000..40f500b --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs @@ -0,0 +1,22 @@ +using Elements.Core; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] +[NodeName("Random Int2")] +public class RandomInt2 : ValueFunctionNode +{ + public ValueInput Min; + public ValueInput Max; + + protected override int2 Compute(FrooxEngineContext context) + { + int2 min = Min.Evaluate(context,int2.Zero); + int2 max = Max.Evaluate(context,int2.One); + + return new int2(RandomX.Range(min.x, max.x), RandomX.Range(min.y, max.y)); + } +} diff --git a/ProtoFlux/NodeExstensions.cs b/ProjectObsidian/ProtoFlux/NodeExstensions.cs similarity index 100% rename from ProtoFlux/NodeExstensions.cs rename to ProjectObsidian/ProtoFlux/NodeExstensions.cs diff --git a/ProtoFlux/Strings/CountSubstring.cs b/ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs similarity index 73% rename from ProtoFlux/Strings/CountSubstring.cs rename to ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs index 5a5834a..b6181f0 100644 --- a/ProtoFlux/Strings/CountSubstring.cs +++ b/ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs @@ -1,17 +1,18 @@ using System; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class CountSubstringNode : ValueFunctionNode + [NodeCategory("Obsidian/String")] + public class CountSubstringNode : ValueFunctionNode { public readonly ObjectInput String; public readonly ObjectInput Pattern; - protected override int Compute(ExecutionContext context) + protected override int Compute(FrooxEngineContext context) { var str = String.Evaluate(context); var pattern = Pattern.Evaluate(context); diff --git a/ProtoFlux/Strings/DecodeBase64Node.cs b/ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs similarity index 75% rename from ProtoFlux/Strings/DecodeBase64Node.cs rename to ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs index 7a410d5..f27806f 100644 --- a/ProtoFlux/Strings/DecodeBase64Node.cs +++ b/ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs @@ -1,17 +1,18 @@ using System; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class DecodeBase64Node : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class DecodeBase64Node : ObjectFunctionNode { public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrEmpty(input)) return null; diff --git a/ProtoFlux/Strings/DecodeMorseNode.cs b/ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs similarity index 82% rename from ProtoFlux/Strings/DecodeMorseNode.cs rename to ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs index e22153f..37350ec 100644 --- a/ProtoFlux/Strings/DecodeMorseNode.cs +++ b/ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs @@ -1,18 +1,19 @@ using System; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using Obsidian; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class DecodeMorseNode : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class DecodeMorseNode : ObjectFunctionNode { public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrWhiteSpace(input)) diff --git a/ProtoFlux/Strings/EncodeBase64Node.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs similarity index 65% rename from ProtoFlux/Strings/EncodeBase64Node.cs rename to ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs index 488b454..cf147ef 100644 --- a/ProtoFlux/Strings/EncodeBase64Node.cs +++ b/ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs @@ -1,17 +1,18 @@ using System; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class EncodeBase64Node : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class EncodeBase64Node : ObjectFunctionNode { public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); return string.IsNullOrEmpty(input) ? null : Convert.ToBase64String(Encoding.UTF8.GetBytes(input)); diff --git a/ProtoFlux/Strings/EncodeMD5.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs similarity index 76% rename from ProtoFlux/Strings/EncodeMD5.cs rename to ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs index 1ce2c72..48de7be 100644 --- a/ProtoFlux/Strings/EncodeMD5.cs +++ b/ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs @@ -2,18 +2,19 @@ using System.Security.Cryptography; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class EncodeMD5Node : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class EncodeMD5Node : ObjectFunctionNode { private static readonly MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider(); public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrEmpty(input)) diff --git a/ProtoFlux/Strings/EncodeMorse.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs similarity index 80% rename from ProtoFlux/Strings/EncodeMorse.cs rename to ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs index 7f715db..cbe50aa 100644 --- a/ProtoFlux/Strings/EncodeMorse.cs +++ b/ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs @@ -1,18 +1,19 @@ using System; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; using Obsidian; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class EncodeMorseNode : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class EncodeMorseNode : ObjectFunctionNode { public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrWhiteSpace(input)) diff --git a/ProtoFlux/Strings/EncodeSHA256.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs similarity index 75% rename from ProtoFlux/Strings/EncodeSHA256.cs rename to ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs index e28332e..bf5065e 100644 --- a/ProtoFlux/Strings/EncodeSHA256.cs +++ b/ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs @@ -2,20 +2,21 @@ using System.Security.Cryptography; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class EncodeSha256Node : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class EncodeSha256Node : ObjectFunctionNode { private static readonly SHA256 SHA = SHA256.Create(); public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); if (string.IsNullOrEmpty(input)) diff --git a/ProtoFlux/Strings/HMAC.cs b/ProjectObsidian/ProtoFlux/Strings/HMAC.cs similarity index 89% rename from ProtoFlux/Strings/HMAC.cs rename to ProjectObsidian/ProtoFlux/Strings/HMAC.cs index edf0633..b758901 100644 --- a/ProtoFlux/Strings/HMAC.cs +++ b/ProjectObsidian/ProtoFlux/Strings/HMAC.cs @@ -2,6 +2,7 @@ using System.Security.Cryptography; using System.Text; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -16,14 +17,14 @@ public enum HashFunction SHA512 } - [NodeCategory("ProtoFlux/Obsidian/String")] - public class HMACNode : ObjectFunctionNode + [NodeCategory("Obsidian/String")] + public class HMACNode : ObjectFunctionNode { public readonly ObjectInput Message; public readonly ObjectInput Key; public readonly ObjectInput HashAlgorithm; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { string message = Message.Evaluate(context); string key = Key.Evaluate(context); diff --git a/ProtoFlux/Strings/HammingDistanceNode.cs b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs similarity index 94% rename from ProtoFlux/Strings/HammingDistanceNode.cs rename to ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs index b9c5a38..edcee5c 100644 --- a/ProtoFlux/Strings/HammingDistanceNode.cs +++ b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs @@ -6,7 +6,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] + [NodeCategory("Obsidian/String")] public class HammingDistanceNode : ObjectFunctionNode { public readonly ObjectInput String1; diff --git a/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs similarity index 82% rename from ProtoFlux/Strings/HammingDistanceNonNullableNode.cs rename to ProjectObsidian/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs index c06702b..e0dd806 100644 --- a/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs +++ b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs @@ -1,19 +1,20 @@ using System; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Strings { - [NodeCategory("ProtoFlux/Obsidian/String")] - public class HammingDistanceNonNullableNode : ValueFunctionNode + [NodeCategory("Obsidian/String")] + public class HammingDistanceNonNullableNode : ValueFunctionNode { public readonly ObjectInput String1; public readonly ObjectInput String2; - protected override int Compute(ExecutionContext context) + protected override int Compute(FrooxEngineContext context) { var string1 = String1.Evaluate(context); var string2 = String2.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs new file mode 100644 index 0000000..9529250 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs @@ -0,0 +1,23 @@ +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Locomotion +{ + [ContinuouslyChanging] + [NodeCategory("Obsidian/Locomotion")] + public class IsUserInNoClipNode : ValueFunctionNode + { + public readonly ObjectInput User; + + protected override bool Compute(FrooxEngineContext context) + { + var user = User.Evaluate(context); + + var locomotionController = user?.Root?.GetRegisteredComponent(); + if (locomotionController == null) return false; + return locomotionController.ActiveModule.GetType() == typeof(NoclipLocomotion); + } + } +} diff --git a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs new file mode 100644 index 0000000..0b4862b --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs @@ -0,0 +1,20 @@ +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Locomotion +{ + [ContinuouslyChanging] + [NodeCategory("Obsidian/Locomotion")] + public class IsUserInSeatedModeNode : ValueFunctionNode + { + public readonly ObjectInput User; + + protected override bool Compute(FrooxEngineContext context) + { + var user = User.Evaluate(context); + return user != null && user.InputInterface.SeatedMode; + } + } +} \ No newline at end of file diff --git a/ProtoFlux/Utility/WriteToLogNode.cs b/ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs similarity index 100% rename from ProtoFlux/Utility/WriteToLogNode.cs rename to ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs diff --git a/UserComponents/ViveTrackerProxy.cs b/ProjectObsidian/UserComponents/ViveTrackerProxy.cs similarity index 100% rename from UserComponents/ViveTrackerProxy.cs rename to ProjectObsidian/UserComponents/ViveTrackerProxy.cs diff --git a/ProtoFlux/JSON/JsonEmpty.cs b/ProtoFlux/JSON/JsonEmpty.cs deleted file mode 100644 index fe3f9be..0000000 --- a/ProtoFlux/JSON/JsonEmpty.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Newtonsoft.Json.Linq; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; - -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json -{ - [NodeCategory("ProtoFlux/Obsidian/Json")] - public class JsonEmptyObjectNode : ObjectFunctionNode - { - protected override JObject Compute(ExecutionContext context) - { - return new JObject(); - } - } - - [NodeCategory("ProtoFlux/Obsidian/Json")] - public class JsonEmptyArrayNode : ObjectFunctionNode - { - protected override JArray Compute(ExecutionContext context) - { - return new JArray(); - } - } - [NodeCategory("ProtoFlux/Obsidian/Json")] - public class JsonNullValueNode : ObjectFunctionNode - { - protected override JToken Compute(ExecutionContext context) - { - return JValue.CreateNull(); - } - } -} \ No newline at end of file diff --git a/ProtoFlux/JSON/JsonToStringNode.cs b/ProtoFlux/JSON/JsonToStringNode.cs deleted file mode 100644 index a6728dd..0000000 --- a/ProtoFlux/JSON/JsonToStringNode.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using FrooxEngine; -using Newtonsoft.Json.Linq; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; - -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json -{ - [NodeCategory("ProtoFlux/Obsidian/Json")] - [GenericTypes(typeof(JToken), typeof(JObject), typeof(JArray))] - public class JsonToStringNode : ObjectFunctionNode where T : JToken - { - public readonly ObjectInput Input; - - protected override string Compute(ExecutionContext context) - { - var input = Input.Evaluate(context); - return input?.ToString(); - } - } -} diff --git a/ProtoFlux/Users/IsUserInNoclipNode.cs b/ProtoFlux/Users/IsUserInNoclipNode.cs deleted file mode 100644 index d80afb0..0000000 --- a/ProtoFlux/Users/IsUserInNoclipNode.cs +++ /dev/null @@ -1,30 +0,0 @@ -using FrooxEngine; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; - -namespace FrooxEngine.ProtoFlux.Locomotion -{ - [ContinuouslyChanging] - [NodeCategory("ProtoFlux/Obsidian/Locomotion")] - public class IsUserInNoClipNode : ValueFunctionNode - { - public readonly ObjectInput User; - - protected override bool Compute(ExecutionContext context) - { - User user = User.Evaluate(context); - if (user == null) - { - return false; - } - - LocomotionController locomotionController = user.Root?.GetRegisteredComponent(); - if (locomotionController == null) - { - return false; - } - - return locomotionController.ActiveModule.GetType() == typeof(NoclipLocomotion); - } - } -}