diff --git a/ProjectObsidian.SourceGenerators/BindingGenerator.cs b/ProjectObsidian.SourceGenerators/BindingGenerator.cs index be79f15..fe1b860 100644 --- a/ProjectObsidian.SourceGenerators/BindingGenerator.cs +++ b/ProjectObsidian.SourceGenerators/BindingGenerator.cs @@ -21,7 +21,6 @@ public void Initialize(GeneratorInitializationContext context) public void Execute(GeneratorExecutionContext context) { - var index = 0; foreach (var tree in context.Compilation.SyntaxTrees) { var result = new StringBuilder(); @@ -33,153 +32,107 @@ public void Execute(GeneratorExecutionContext context) var res = result.ToString(); if (!string.IsNullOrWhiteSpace(res)) - { context.AddSource($"{walker.BaseName}Bindings.g.cs", result.ToString()); - index++; - } } } } 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 = { "VoidNode", "ObjectFunctionNode", "ValueFunctionNode" }; + 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 string ObjectInputDeclaration => _objectInputs.Aggregate("", - (current, pair) => - current + $" new public readonly SyncRef> {pair.Key};\n"); - - private string ObjectOutputDeclaration => _objectOutputs.Aggregate("", - (current, pair) => - current + $" new public readonly NodeObjectOutput<{pair.Value}> {pair.Key};\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 string ValueInputDeclaration => _valueInputs.Aggregate("", - (current, pair) => - current + $" new public readonly SyncRef> {pair.Key};\n"); + 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 string ValueOutputDeclaration => _valueOutputs.Aggregate("", - (current, pair) => - current + $" new public readonly NodeValueOutput<{pair.Value}> {pair.Key};\n"); - - private string ImpulseDeclaration => _impulseOrder.Aggregate("", - (current, name) => - current + $" new public readonly SyncRef {name};\n"); - - private string InputCountOverride => _inputOrder.Count == 0 - ? "" - : $" public override int NodeInputCount => base.NodeInputCount + {_inputOrder.Count};"; + private IEnumerable _counts => new[] + { _inputCount, _outputCount, _impulseCount, _operationCount, + _inputListCount, _outputListCount, _impulseListCount, _operationListCount }; - private string OutputCountOverride => _outputOrder.Count == 0 - ? "" - : $" public override int NodeOutputCount => base.NodeOutputCount + {_outputOrder.Count};"; - - private string ImpulseCountOverride => _impulseOrder.Count == 0 - ? "" - : $" public override int NodeImpulseCount => base.NodeImpulseCount + {_impulseOrder.Count};"; - - private string GetInputInternalOverride - { - get - { - if (_inputOrder.Count == 0) return ""; - var str = $$""" - - protected override ISyncRef GetInputInternal(ref int index) - { - var inputInternal = base.GetInputInternal(ref index); - if (inputInternal != null) return inputInternal; - switch (index) - { - - """; - for (var index = 0; index < _inputOrder.Count; index++) - { - var order = _inputOrder[index]; - str += $" case {index}:\n return this.{order};\n"; - } - str += $$""" - - default: - index -= {{_inputOrder.Count}}; - return null; - } - } - """; - return str; - } - } + private string CountOverride => string.Concat(_counts.Select(i => i.CountOverride)); + private string GetOverride => string.Concat(_counts.Select(i => i.GetOverride)); - private string GetImpulseInternalOverride - { - get - { - if (_impulseOrder.Count == 0) return ""; - var str = $$""" - - protected override ISyncRef GetImpulseInternal(ref int index) - { - var impulseInternal = base.GetImpulseInternal(ref index); - if (impulseInternal != null) return impulseInternal; - switch (index) - { - - """; - for (var index = 0; index < _impulseOrder.Count; index++) - { - var order = _impulseOrder[index]; - str += $" case {index}:\n return this.{order};\n"; - } - str += $$""" - - default: - index -= {{_impulseOrder.Count}}; - return null; - } - } - """; - return str; - } - } - private string GetOutputInternalOverride - { - get - { - if (_outputOrder.Count == 0) return ""; - var str = $$""" - - protected override INodeOutput GetOutputInternal(ref int index) - { - var outputInternal = base.GetOutputInternal(ref index); - if (outputInternal != null) return outputInternal; - switch (index) - { - - """; - for (var index = 0; index < _outputOrder.Count; index++) - { - var order = _outputOrder[index]; - str += $" case {index}:\n return this.{order};\n"; - } - str += $$""" - - default: - index -= {{_outputOrder.Count}}; - return null; - } - } - """; - return str; - } - } + private List _declarations = []; + private string Declarations => string.Concat(_declarations); public string Result { @@ -196,29 +149,22 @@ namespace {BindingPrefix}{_currentNameSpace}; [Category(new string[] {{""ProtoFlux/Runtimes/Execution/Nodes/{_category}""}})] public partial class {_fullName} : {_baseType} {{ -{ObjectInputDeclaration} -{ObjectOutputDeclaration} -{ValueInputDeclaration} -{ValueOutputDeclaration} -{ImpulseDeclaration} - public override System.Type NodeType => typeof ({_currentNameSpace}.{_fullName}); - public {_currentNameSpace}.{_fullName} TypedNodeInstance {{ get; private set; }} +{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; -{InputCountOverride} -{OutputCountOverride} -{ImpulseCountOverride} +{CountOverride} public override N Instantiate() {{ if (this.TypedNodeInstance != null) throw new System.InvalidOperationException(""Node has already been instantiated""); - var localVar = new {_currentNameSpace}.{_fullName}(); + var localVar = new global::{_currentNameSpace}.{_fullName}(); this.TypedNodeInstance = localVar; return localVar as N; }} - protected override void AssociateInstanceInternal(INode node) => this.TypedNodeInstance = node is {_currentNameSpace}.{_fullName} localVar ? localVar : throw new System.ArgumentException(""Node instance is not of type "" + typeof ({_currentNameSpace}.{_fullName})?.ToString()); -{GetInputInternalOverride} -{GetOutputInternalOverride} -{GetImpulseInternalOverride} + 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; } @@ -228,56 +174,67 @@ public override N Instantiate() 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 readonly Dictionary _objectInputs = new(); - private readonly Dictionary _valueInputs = new(); - - private readonly Dictionary _objectArguments = new(); - private readonly Dictionary _valueArguments = new(); - - private readonly Dictionary _objectOutputs = new(); - private readonly Dictionary _valueOutputs = new(); - - private readonly List _inputOrder = new(); - private readonly List _outputOrder = new(); - - private readonly List _impulseOrder = new(); - + 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(); - if (type.Contains("ObjectInput<")) - { - _objectInputs.Add(name, type.TrimEnds("ObjectInput<".Length, 1)); - _inputOrder.Add(name); - } - if (type.Contains("ObjectOutput<")) - { - _objectOutputs.Add(name, type.TrimEnds("ObjectOutput<".Length, 1)); - _outputOrder.Add(name); - } - if (type.Contains("ValueInput<")) - { - _valueInputs.Add(name, type.TrimEnds("ValueInput<".Length, 1)); - _inputOrder.Add(name); - } - if (type.Contains("ValueOutput<")) - { - _valueOutputs.Add(name, type.TrimEnds("ValueOutput<".Length, 1)); - _outputOrder.Add(name); - } - - if (type.EndsWith("Continuation")) - { - _impulseOrder.Add(name); - } + //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); } @@ -311,11 +268,13 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node) if (node.TypeParameterList is not null) { - fullName += "<"; - fullName = node.TypeParameterList.Parameters.Aggregate(fullName, + _additionalName += "<"; + _additionalName = node.TypeParameterList.Parameters.Aggregate(_additionalName, (current, p) => current + $"{p.Identifier.Text},"); - fullName = fullName.Substring(0, fullName.Length - 1); //remove last , - fullName += ">"; + _additionalName = _additionalName.Substring(0, _additionalName.Length - 1); //remove last , + _additionalName += ">"; + + fullName += _additionalName; } BaseName = baseName; @@ -335,14 +294,21 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node) var find = node.AttributeLists.SelectMany(i => i.Attributes) .FirstOrDefault(i => i.Name.ToString() == "NodeCategory"); - if (find is null || find.ArgumentList is null) + 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"); + - _category = find.ArgumentList.Arguments.First().ToString(); - _category = _category.Substring(1, _category.Length - 2); + if (findName?.ArgumentList != null) + _nodeNameOverride = + $" public override string NodeName => {findName.ArgumentList.Arguments.First().ToString()};"; foreach (var u in _usingDeclarations) { diff --git a/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs b/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs index 53d624c..868b8df 100644 --- a/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs +++ b/ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs @@ -11,7 +11,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input; -[NodeCategory("Devices")] +[NodeCategory("Obsidian/Devices")] public class ViveTrackerBattery : VoidNode { public ObjectArgument User; diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs index 8843b1f..37c5037 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArray.cs @@ -4,6 +4,7 @@ using ProtoFlux.Runtimes.Execution; using FrooxEngine; using Elements.Core; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { @@ -11,11 +12,11 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.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/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs index 5a5a8ee..3517dd2 100644 --- a/ProjectObsidian/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("Obsidian/Json")] - public class JsonCountArrayChildrenNode : ValueFunctionNode + 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/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs index 7011d53..a4086da 100644 --- a/ProjectObsidian/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("Obsidian/Json")] - public class JsonCountObjectChildrenNode : ValueFunctionNode + 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 index 0744d19..fc712e5 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs @@ -1,30 +1,31 @@ -using Newtonsoft.Json.Linq; +using FrooxEngine.ProtoFlux; +using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeCategory("Obsidian/Json")] - public class JsonEmptyObjectNode : ObjectFunctionNode + public class JsonEmptyObjectNode : ObjectFunctionNode { - protected override JObject Compute(ExecutionContext context) + protected override JObject Compute(FrooxEngineContext context) { return new JObject(); } } [NodeCategory("Obsidian/Json")] - public class JsonEmptyArrayNode : ObjectFunctionNode + public class JsonEmptyArrayNode : ObjectFunctionNode { - protected override JArray Compute(ExecutionContext context) + protected override JArray Compute(FrooxEngineContext context) { return new JArray(); } } [NodeCategory("Obsidian/Json")] - public class JsonNullValueNode : ObjectFunctionNode + public class JsonNullValueNode : ObjectFunctionNode { - protected override JToken Compute(ExecutionContext context) + protected override JToken Compute(FrooxEngineContext context) { return JValue.CreateNull(); } diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs index bab1afe..2524b5a 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromArrayNode.cs @@ -4,6 +4,7 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { @@ -11,13 +12,13 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.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/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs index 7f18dd1..64f8da4 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetFromObject.cs @@ -4,6 +4,7 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { @@ -11,12 +12,12 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.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/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs index 3e1c315..044c924 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs @@ -4,6 +4,7 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { @@ -11,13 +12,13 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.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/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs index 0cd6694..7d18d4d 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArray.cs @@ -1,4 +1,5 @@ using System; +using FrooxEngine.ProtoFlux; using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -6,11 +7,11 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeCategory("Obsidian/Json")] - public class JsonParseStringArrayNode : ObjectFunctionNode + 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/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs index d841b4c..1624cd1 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringNode.cs @@ -1,4 +1,5 @@ using System; +using FrooxEngine.ProtoFlux; using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -6,12 +7,12 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeCategory("Obsidian/Json")] - public class JsonParseStringNode : ObjectFunctionNode + 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/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs index d71289c..b5e491d 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObject.cs @@ -4,6 +4,7 @@ using ProtoFlux.Runtimes.Execution; using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { @@ -11,11 +12,11 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.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/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs index 87526f6..25ea200 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs @@ -1,4 +1,5 @@ using System; +using FrooxEngine.ProtoFlux; using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -6,13 +7,13 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeCategory("Obsidian/Json")] - public class JsonRemoveFromArrayNode : ObjectFunctionNode + 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/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs index 0272e80..7fa503b 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs @@ -1,4 +1,5 @@ using System; +using FrooxEngine.ProtoFlux; using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -6,13 +7,13 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { [NodeCategory("Obsidian/Json")] - public class JsonRemoveFromObjectNode : ObjectFunctionNode + 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 index 6fdcf62..6d2ddd5 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs @@ -1,5 +1,6 @@ using System; using FrooxEngine; +using FrooxEngine.ProtoFlux; using Newtonsoft.Json.Linq; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; @@ -8,11 +9,11 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(JToken), typeof(JObject), typeof(JArray))] -public class JsonToStringNode : ObjectFunctionNode where T : JToken +public class JsonToStringNode : ObjectFunctionNode { public readonly ObjectInput Input; - protected override string Compute(ExecutionContext context) + protected override string Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); return input?.ToString(); diff --git a/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs index 073de3f..1bcb2c6 100644 --- a/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs +++ b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonDouble.cs @@ -1,12 +1,15 @@ using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -[NodeCategory("LogiX/NeosPlus/Math/Constants")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants; + +[NodeCategory("Obsidian/Math/Constants")] [NodeName("Epsilon Double")] -public class EpsilonDouble : ValueFunctionNode +public class EpsilonDouble : ValueFunctionNode { - protected override double Compute(ExecutionContext context) + 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 index 9524bc8..2626b29 100644 --- a/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs +++ b/ProjectObsidian/ProtoFlux/Math/Constants/EpsilonFloat.cs @@ -1,12 +1,15 @@ using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -[NodeCategory("Protoflux/Obsidian/Math/Constants")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Constants; + +[NodeCategory("Obsidian/Math/Constants")] [NodeName("Epsilon Float")] -public class EpsilonFloat : ValueFunctionNode +public class EpsilonFloat : ValueFunctionNode { - protected override float Compute(ExecutionContext context) + protected override float Compute(FrooxEngineContext context) { return MathX.FLOAT_EPSILON; } diff --git a/ProjectObsidian/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/CentripetalForceCalculationNode.cs index ca10a98..4bb176f 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/DragCalculationNode.cs index 79b9616..33c326e 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Math/Physics/KinecticFrictionNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/KinecticFrictionNode.cs index 091a480..15b67db 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Math/Physics/RefractCalculationNode.cs b/ProjectObsidian/ProtoFlux/Math/Physics/RefractCalculationNode.cs index d317375..bd0b67b 100644 --- a/ProjectObsidian/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 index ce512b9..5ce02eb 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs @@ -1,20 +1,23 @@ using System; using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [ContinuouslyChanging] -public class RandomBool2 : ObjectFunctionNode +public class RandomBool2 : ObjectFunctionNode { public ValueInput Chance; - protected override bool2 Compute(ExecutionContext context) + protected override bool2 Compute(FrooxEngineContext context) { - float2 chance = Chance.Evaluate(context); - bool2 result = new bool2( + var chance = Chance.Evaluate(context); + var result = new bool2( RandomX.Chance(chance.x), RandomX.Chance(chance.y) ); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs index f9ec0a5..8e12411 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool3.cs @@ -3,15 +3,18 @@ using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; using FrooxEngine; +using FrooxEngine.ProtoFlux; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Bool3")] [ContinuouslyChanging] -public class RandomBool3 : ValueFunctionNode +public class RandomBool3 : ValueFunctionNode { public ValueInput Chance; - protected override bool3 Compute(ExecutionContext context) + 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)); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs index 0926934..da9c8f0 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool4.cs @@ -3,15 +3,18 @@ using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; using FrooxEngine; +using FrooxEngine.ProtoFlux; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Bool4")] [ContinuouslyChanging] -public class RandomBool4 : ValueFunctionNode +public class RandomBool4 : ValueFunctionNode { public ValueInput Chance; - protected override bool4 Compute(ExecutionContext context) + protected override bool4 Compute(FrooxEngineContext context) { var chance = Chance.Evaluate(context); return new bool4( diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs index e6bd71c..c64b917 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs @@ -1,18 +1,21 @@ using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Character")] [ContinuouslyChanging] -public class RandomCharacter : ValueFunctionNode +public class RandomCharacter : ValueFunctionNode { public ValueInput Start; public ValueInput End; public ObjectInput String; - protected override char Compute(ExecutionContext context) + protected override char Compute(FrooxEngineContext context) { var str = String.Evaluate(context); var start = MathX.Clamp(Start.Evaluate(context), 0, str.Length); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs index b5f498f..da0c26e 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomDouble.cs @@ -1,17 +1,20 @@ using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Double")] [ContinuouslyChanging] -public class RandomDouble : ValueFunctionNode +public class RandomDouble : ValueFunctionNode { public ValueInput Min; public ValueInput Max; - protected override double Compute(ExecutionContext context) + protected override double Compute(FrooxEngineContext context) { var min = Min.Evaluate(context); var max = Max.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs index 27ebf79..a774882 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomEulerAngles.cs @@ -1,13 +1,16 @@ using Elements.Core; using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Euler Angles")] [ContinuouslyChanging] -public class RandomEulerAngles : ValueFunctionNode +public class RandomEulerAngles : ValueFunctionNode { public ValueInput minPitch; public ValueInput maxPitch; @@ -16,7 +19,7 @@ public class RandomEulerAngles : ValueFunctionNode public ValueInput minRoll; public ValueInput maxRoll; - protected override float3 Compute(ExecutionContext context) + 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)); diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs index dbd9a77..40f500b 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomInt2.cs @@ -1,15 +1,18 @@ using Elements.Core; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -[NodeCategory("ProtoFlux/Obsidian/Math/Random")] +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; + +[NodeCategory("Obsidian/Math/Random")] [NodeName("Random Int2")] -public class RandomInt2 : ValueFunctionNode +public class RandomInt2 : ValueFunctionNode { public ValueInput Min; public ValueInput Max; - protected override int2 Compute(ExecutionContext context) + protected override int2 Compute(FrooxEngineContext context) { int2 min = Min.Evaluate(context,int2.Zero); int2 max = Max.Evaluate(context,int2.One); diff --git a/ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs b/ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs index 5a5834a..b6181f0 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs b/ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs index 7a410d5..f27806f 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs b/ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs index e22153f..37350ec 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs index 488b454..cf147ef 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs index 1ce2c72..48de7be 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs index 7f715db..cbe50aa 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs b/ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs index e28332e..bf5065e 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/HMAC.cs b/ProjectObsidian/ProtoFlux/Strings/HMAC.cs index edf0633..b758901 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs index b9c5a38..edcee5c 100644 --- a/ProjectObsidian/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/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs b/ProjectObsidian/ProtoFlux/Strings/HammingDistanceNonNullableNode.cs index c06702b..e0dd806 100644 --- a/ProjectObsidian/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/IsUserInNoclipNode.cs b/ProjectObsidian/ProtoFlux/Users/IsUserInNoclipNode.cs index 99e4879..9529250 100644 --- a/ProjectObsidian/ProtoFlux/Users/IsUserInNoclipNode.cs +++ b/ProjectObsidian/ProtoFlux/Users/IsUserInNoclipNode.cs @@ -1,29 +1,22 @@ using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Locomotion { [ContinuouslyChanging] - [NodeCategory("ProtoFlux/Obsidian/Locomotion")] - public class IsUserInNoClipNode : ValueFunctionNode + [NodeCategory("Obsidian/Locomotion")] + public class IsUserInNoClipNode : ValueFunctionNode { public readonly ObjectInput User; - protected override bool Compute(ExecutionContext context) + protected override bool Compute(FrooxEngineContext context) { - User user = User.Evaluate(context); - if (user == null) - { - return false; - } - - LocomotionController locomotionController = user.Root?.GetRegisteredComponent(); - if (locomotionController == null) - { - return false; - } + 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 index 9fc5ef2..0b4862b 100644 --- a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs +++ b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs @@ -1,19 +1,20 @@ using FrooxEngine; +using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Locomotion { [ContinuouslyChanging] - [NodeCategory("ProtoFlux/Obsidian/Locomotion")] - public class IsUserInSeatedModeNode : ValueFunctionNode + [NodeCategory("Obsidian/Locomotion")] + public class IsUserInSeatedModeNode : ValueFunctionNode { public readonly ObjectInput User; - protected override bool Compute(ExecutionContext context) + protected override bool Compute(FrooxEngineContext context) { - User user = User.Evaluate(context); - return user == null ? false : user.InputInterface.SeatedMode; + var user = User.Evaluate(context); + return user != null && user.InputInterface.SeatedMode; } } } \ No newline at end of file