Skip to content

Commit

Permalink
meta custom properties
Browse files Browse the repository at this point in the history
  • Loading branch information
emperorofmars committed Dec 10, 2024
1 parent d5ffe7a commit 5a790b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion NNA/Runtime/NNAContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public NNAMeta GetMeta() {
return ImportState.Meta;
}
public string GetMetaCustomValue(string Key) {
return ImportState.Meta.AdditionalProperties.FirstOrDefault(e => e.Key == Key)?.Value;
return ImportState.Meta.CustomProperties.FirstOrDefault(e => e.Key == Key)?.Value;
}

public void AddTask(Task Task) { ImportState.Tasks.Add(Task); }
Expand Down
2 changes: 1 addition & 1 deletion NNA/Runtime/NNAMeta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public class Entry { public string Key; public string Value; }
public string Documentation;
public string DocumentationLink;

public List<Entry> AdditionalProperties = new();
public List<Entry> CustomProperties = new();
}
}
11 changes: 8 additions & 3 deletions NNA/Runtime/Util/ParseUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ public static NNAMeta ParseMetaNode(Transform Node, List<Transform> Trash)
case "license_url": metaNNA.LicenseLink = (string)metaJson["license_url"]; break;
case "documentation": metaNNA.Documentation = (string)metaJson["documentation"]; break;
case "documentation_url": metaNNA.DocumentationLink = (string)metaJson["documentation_url"]; break;
default: metaNNA.AdditionalProperties.Add(new NNAMeta.Entry{Key=key, Value=(string)value}); break;
case "custom_properties":
foreach(var customProperty in value)
{
metaNNA.CustomProperties.Add(new NNAMeta.Entry{Key=(string)customProperty["key"], Value=(string)customProperty["value"]});
}
break;
}
}
return metaNNA;
Expand Down Expand Up @@ -103,7 +108,7 @@ public static string ParseNodeRaw(Transform Node, List<Transform> Trash)
public static string GetNameComponentId(string NodeName, int DefinitionStartIndex)
{
if(DefinitionStartIndex <= 0) return null;

var match = Regex.Match(NodeName, MatchSideSignifier);
var sideSignifier = match.Groups["side"].Success ? match.Groups["side"].Value : "";

Expand Down Expand Up @@ -216,7 +221,7 @@ public static JToken GetMulkikeyOrDefault(JObject Json, JToken DefaultValue, par
return DefaultValue;
}


public const string MatchLeft = @"(?i)(([._\-|:]l)|[._\-|:\s]?left)$";
public const string MatchRight = @"(?i)(([._\-|:]r)|[._\-|:\s]?right)$";

Expand Down

0 comments on commit 5a790b4

Please sign in to comment.