mirror of
https://github.com/SamueleLorefice/ComfySharp
synced 2026-01-15 03:35:48 +00:00
added collection of widget options during the node DB generation
This commit is contained in:
@@ -29,6 +29,7 @@ public class NodeDBGenerator {
|
|||||||
private int typeFields;
|
private int typeFields;
|
||||||
private int enumFields;
|
private int enumFields;
|
||||||
private int stringListFields;
|
private int stringListFields;
|
||||||
|
private List<string> widgetEntries = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CodeGeneration
|
#region CodeGeneration
|
||||||
@@ -133,6 +134,10 @@ public class NodeDBGenerator {
|
|||||||
Logger.Info($"Total amount of enums detected\\iterated:\t\t {knownEnums.Count}\t\\{enumFields}");
|
Logger.Info($"Total amount of enums detected\\iterated:\t\t {knownEnums.Count}\t\\{enumFields}");
|
||||||
Logger.Info($"Total amount of stringLists detected\\iterated:\t {knownStringLists.Count}\t\\{knownStringLists.Count}");
|
Logger.Info($"Total amount of stringLists detected\\iterated:\t {knownStringLists.Count}\t\\{knownStringLists.Count}");
|
||||||
|
|
||||||
|
string widgets = "";
|
||||||
|
foreach (var entry in widgetEntries) widgets += $"\t{entry}";
|
||||||
|
Logger.Info($"Possible Widget Properties: {widgets}");
|
||||||
|
|
||||||
Logger.Info("NodeDB Scan phase 2: generating types");
|
Logger.Info("NodeDB Scan phase 2: generating types");
|
||||||
timer.Restart();
|
timer.Restart();
|
||||||
Logger.Info("Enum Generation starting...");
|
Logger.Info("Enum Generation starting...");
|
||||||
@@ -154,8 +159,6 @@ public class NodeDBGenerator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void GenerateEnum(string name, List<string> enumValues, CodeNamespace ns) {
|
private void GenerateEnum(string name, List<string> enumValues, CodeNamespace ns) {
|
||||||
string path = Path.Combine(Environment.CurrentDirectory, settings.CodeOutputFolderName, $"{name}.cs");
|
string path = Path.Combine(Environment.CurrentDirectory, settings.CodeOutputFolderName, $"{name}.cs");
|
||||||
Logger.Debug($"Generating enum {name} w\\ {enumValues.Count} values.\n" +
|
Logger.Debug($"Generating enum {name} w\\ {enumValues.Count} values.\n" +
|
||||||
@@ -229,6 +232,10 @@ public class NodeDBGenerator {
|
|||||||
// if element 0 is a string, this is a type
|
// if element 0 is a string, this is a type
|
||||||
if (inputProperty.Value[0].ValueKind == JsonValueKind.String) {
|
if (inputProperty.Value[0].ValueKind == JsonValueKind.String) {
|
||||||
AddKnownType(inputProperty.Value[0].ToString());
|
AddKnownType(inputProperty.Value[0].ToString());
|
||||||
|
if (inputProperty.Value.GetArrayLength() > 1 && inputProperty.Value[1].EnumerateObject().Count() > 1)
|
||||||
|
foreach (var widgetEntry in inputProperty.Value[1].EnumerateObject())
|
||||||
|
if(!widgetEntries.Contains(widgetEntry.Name))
|
||||||
|
widgetEntries.Add(widgetEntry.Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace ComfySharp.Types;
|
namespace ComfySharp.Types;
|
||||||
|
|
||||||
public class HistoryEntry {
|
public class HistoryEntry {
|
||||||
|
//TODO: this is just a stub, fill it in
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user