Skip to content

Commit

Permalink
Merge pull request #46 from Nytra/main
Browse files Browse the repository at this point in the history
Add generic types attribute to binding generator, mark enums as data model types, mark external data model types in AssemblyInfo, fix some ValueInputs
  • Loading branch information
Xlinka authored Jul 14, 2024
2 parents 800ed69 + ecb543a commit 4013b39
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ProjectObsidian.SourceGenerators/BindingGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public string Result
namespace {BindingPrefix}{_currentNameSpace};
{_genericTypesAttribute}
[Category(new string[] {{""ProtoFlux/Runtimes/Execution/Nodes/{_category}""}})]
public partial class {_fullName} : global::FrooxEngine.ProtoFlux.Runtimes.Execution.{_baseType} {_constraints}
{{
Expand Down Expand Up @@ -186,6 +187,7 @@ public override N Instantiate<N>()
private string _debug = "";
private bool _isValidGenericTypeMethod;
private string _constraints = "";
private string _genericTypesAttribute;

private bool TypedFieldDetection(string type, string name, string targetTypeName, string declarationFormat, OrderedCount counter)
{
Expand Down Expand Up @@ -309,6 +311,8 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)
var find = node.AttributeLists.SelectMany(i => i.Attributes)
.FirstOrDefault(i => i.Name.ToString() == "NodeCategory");

_genericTypesAttribute = node.AttributeLists.FirstOrDefault(attrList => attrList.Attributes.Any(attr => attr.Name.ToString() == "GenericTypes"))?.ToString();

if (find?.ArgumentList is null)
{
base.VisitClassDeclaration(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Obsidian;

[DataModelType]
public enum ArithmeticMode
{
Addition,
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProjectObsidian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AssemblyName>Project-Obsidian</AssemblyName>
<TargetFramework>net48</TargetFramework>
<LangVersion>11</LangVersion>
<Copyright>Copyright © 2023</Copyright>
<Copyright>Copyright © 2024</Copyright>
<Product>Project-Obsidian</Product>
</PropertyGroup>
<PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions ProjectObsidian/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

using System;
using System.ComponentModel;
using System.Net;
using System.Reflection;

using Elements.Core;
using Newtonsoft.Json.Linq;

[assembly: System.Reflection.AssemblyCompanyAttribute("Project-Obsidian")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
Expand All @@ -27,3 +29,9 @@

//Mark as DataModelAssembly for the Plugin loading system to load this assembly
[assembly: DataModelAssembly(DataModelAssemblyType.Core)]

[assembly: ExternalDataModelType(typeof(Valve.VR.Imu_OffScaleFlags))]
[assembly: ExternalDataModelType(typeof(HttpStatusCode))]
//[assembly: ExternalDataModelType(typeof(JObject))]
//[assembly: ExternalDataModelType(typeof(JToken))]
//[assembly: ExternalDataModelType(typeof(JArray))]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class JsonInsertObjectToArrayNode<T> : ObjectFunctionNode<FrooxEngineCont
{
public readonly ObjectInput<JsonArray> Array;
public readonly ObjectInput<T> Object;
public readonly ObjectInput<int> Index;
public readonly ValueInput<int> Index;
public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T));
protected override JsonArray Compute(FrooxEngineContext context)
{
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
public class JsonRemoveFromArrayNode : ObjectFunctionNode<FrooxEngineContext, JsonArray>
{
public readonly ObjectInput<JsonArray> Array;
public readonly ObjectInput<int> Index;
public readonly ValueInput<int> Index;


protected override JsonArray Compute(FrooxEngineContext context)
Expand Down
1 change: 1 addition & 0 deletions ProjectObsidian/ProtoFlux/Strings/HMAC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[DataModelType]
public enum HashFunction
{
MD5,
Expand Down

0 comments on commit 4013b39

Please sign in to comment.