|
|
|
@ -20,9 +20,7 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
int? batchIndex = null |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
var emptyLatent = builder |
|
|
|
|
.Nodes |
|
|
|
|
.AddTypedNode( |
|
|
|
|
var emptyLatent = builder.Nodes.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.EmptyLatentImage |
|
|
|
|
{ |
|
|
|
|
Name = "EmptyLatentImage", |
|
|
|
@ -39,15 +37,15 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
if (batchIndex is not null) |
|
|
|
|
{ |
|
|
|
|
builder.Connections.Primary = builder |
|
|
|
|
.Nodes |
|
|
|
|
.AddNamedNode( |
|
|
|
|
ComfyNodeBuilder.LatentFromBatch( |
|
|
|
|
"LatentFromBatch", |
|
|
|
|
builder.GetPrimaryAsLatent(), |
|
|
|
|
.Nodes.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.LatentFromBatch |
|
|
|
|
{ |
|
|
|
|
Name = "LatentFromBatch", |
|
|
|
|
Samples = builder.GetPrimaryAsLatent(), |
|
|
|
|
// remote expects a 0-based index, vm is 1-based |
|
|
|
|
batchIndex.Value - 1, |
|
|
|
|
1 |
|
|
|
|
) |
|
|
|
|
BatchIndex = batchIndex.Value - 1, |
|
|
|
|
Length = 1 |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
.Output; |
|
|
|
|
} |
|
|
|
@ -67,9 +65,9 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
var sourceImageRelativePath = Path.Combine("Inference", image.GetHashGuidFileNameCached()); |
|
|
|
|
|
|
|
|
|
// Load source |
|
|
|
|
var loadImage = builder |
|
|
|
|
.Nodes |
|
|
|
|
.AddTypedNode(new ComfyNodeBuilder.LoadImage { Name = "LoadImage", Image = sourceImageRelativePath }); |
|
|
|
|
var loadImage = builder.Nodes.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.LoadImage { Name = "LoadImage", Image = sourceImageRelativePath } |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
builder.Connections.Primary = loadImage.Output1; |
|
|
|
|
builder.Connections.PrimarySize = imageSize; |
|
|
|
@ -78,15 +76,15 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
if (batchIndex is not null) |
|
|
|
|
{ |
|
|
|
|
builder.Connections.Primary = builder |
|
|
|
|
.Nodes |
|
|
|
|
.AddNamedNode( |
|
|
|
|
ComfyNodeBuilder.LatentFromBatch( |
|
|
|
|
"LatentFromBatch", |
|
|
|
|
builder.GetPrimaryAsLatent(), |
|
|
|
|
.Nodes.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.LatentFromBatch |
|
|
|
|
{ |
|
|
|
|
Name = "LatentFromBatch", |
|
|
|
|
Samples = builder.GetPrimaryAsLatent(), |
|
|
|
|
// remote expects a 0-based index, vm is 1-based |
|
|
|
|
batchIndex.Value - 1, |
|
|
|
|
1 |
|
|
|
|
) |
|
|
|
|
BatchIndex = batchIndex.Value - 1, |
|
|
|
|
Length = 1 |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
.Output; |
|
|
|
|
} |
|
|
|
@ -97,10 +95,7 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
if (builder.Connections.Primary is null) |
|
|
|
|
throw new ArgumentException("No Primary"); |
|
|
|
|
|
|
|
|
|
var image = builder |
|
|
|
|
.Connections |
|
|
|
|
.Primary |
|
|
|
|
.Match( |
|
|
|
|
var image = builder.Connections.Primary.Match( |
|
|
|
|
_ => |
|
|
|
|
builder.GetPrimaryAsImage( |
|
|
|
|
builder.Connections.PrimaryVAE |
|
|
|
@ -111,10 +106,12 @@ public static class ComfyNodeBuilderExtensions
|
|
|
|
|
image => image |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
var previewImage = builder |
|
|
|
|
.Nodes |
|
|
|
|
.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.PreviewImage { Name = builder.Nodes.GetUniqueName("SaveImage"), Images = image } |
|
|
|
|
var previewImage = builder.Nodes.AddTypedNode( |
|
|
|
|
new ComfyNodeBuilder.PreviewImage |
|
|
|
|
{ |
|
|
|
|
Name = builder.Nodes.GetUniqueName("SaveImage"), |
|
|
|
|
Images = image |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
builder.Connections.OutputNodes.Add(previewImage); |
|
|
|
|