Start seed node as -1 when newly created.
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
import type { ComfyApp, ComfyObjectInfo, ComfyWidget, ComfyGraphNode } from "./typings/comfy.js";
|
||||
import { RgthreeBaseNode } from "./base_node.js";
|
||||
import { rgthree } from "./rgthree.js";
|
||||
import { addConnectionLayoutSupport } from "./utils.js";
|
||||
|
||||
declare const LiteGraph: typeof TLiteGraph;
|
||||
declare const LGraphNode: typeof TLGraphNode;
|
||||
@@ -57,12 +58,15 @@ class SeedControl {
|
||||
}
|
||||
};
|
||||
|
||||
// (this.node as any).widgets_values = (this.node as any).widgets_values || [];
|
||||
|
||||
this.node.properties = this.node.properties || {};
|
||||
|
||||
// Grab the already available widgets, and remove the built-in control_after_generate
|
||||
for (const [i, w] of this.node.widgets.entries()) {
|
||||
if (w.name === "seed") {
|
||||
this.seedWidget = w as ComfyWidget;
|
||||
this.seedWidget.value = SPECIAL_SEED_RANDOM;
|
||||
} else if (w.name === "control_after_generate") {
|
||||
this.node.widgets.splice(i, 1);
|
||||
}
|
||||
@@ -256,6 +260,7 @@ app.registerExtension({
|
||||
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
|
||||
(this as any).seedControl = new SeedControl(this as ComfyGraphNode);
|
||||
};
|
||||
addConnectionLayoutSupport(nodeType, app, [["Left", "Right"], ["Right", "Left"]]);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { ComfyWidgets } from "../../scripts/widgets.js";
|
||||
import { rgthree } from "./rgthree.js";
|
||||
import { addConnectionLayoutSupport } from "./utils.js";
|
||||
const LAST_SEED_BUTTON_LABEL = "♻️ (Use Last Queued Seed)";
|
||||
const SPECIAL_SEED_RANDOM = -1;
|
||||
const SPECIAL_SEED_INCREMENT = -2;
|
||||
@@ -29,6 +30,7 @@ class SeedControl {
|
||||
for (const [i, w] of this.node.widgets.entries()) {
|
||||
if (w.name === "seed") {
|
||||
this.seedWidget = w;
|
||||
this.seedWidget.value = SPECIAL_SEED_RANDOM;
|
||||
}
|
||||
else if (w.name === "control_after_generate") {
|
||||
this.node.widgets.splice(i, 1);
|
||||
@@ -162,6 +164,7 @@ app.registerExtension({
|
||||
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
|
||||
this.seedControl = new SeedControl(this);
|
||||
};
|
||||
addConnectionLayoutSupport(nodeType, app, [["Left", "Right"], ["Right", "Left"]]);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user