Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic types attribute to binding generator, mark enums as data model types, mark external data model types in AssemblyInfo, fix some ValueInputs #46

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops

<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