mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-31 08:40:19 +08:00
back to normal
This commit is contained in:
parent
d3a375c8fb
commit
a295d740d6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
.vs/ComfyUI/FileContentIndex/read.lock
Normal file
0
.vs/ComfyUI/FileContentIndex/read.lock
Normal file
BIN
.vs/ComfyUI/v17/.suo
Normal file
BIN
.vs/ComfyUI/v17/.suo
Normal file
Binary file not shown.
3
.vs/ProjectSettings.json
Normal file
3
.vs/ProjectSettings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"CurrentProjectSetting": null
|
||||||
|
}
|
||||||
3
.vs/PythonSettings.json
Normal file
3
.vs/PythonSettings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"SuppressEnvironmentCreationPrompt": true
|
||||||
|
}
|
||||||
12
.vs/VSWorkspaceState.json
Normal file
12
.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
"",
|
||||||
|
"\\web",
|
||||||
|
"\\web\\extensions",
|
||||||
|
"\\web\\extensions\\core",
|
||||||
|
"\\web\\lib",
|
||||||
|
"\\web\\scripts"
|
||||||
|
],
|
||||||
|
"SelectedNode": "\\web\\scripts\\ui.js",
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
||||||
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
import { ComfyWidgets, addRandomizeWidget } from "/scripts/widgets.js";
|
import { ComfyWidgets, addSeedControlWidget } from "/scripts/widgets.js";
|
||||||
import { app } from "/scripts/app.js";
|
import { app } from "/scripts/app.js";
|
||||||
|
|
||||||
const CONVERTED_TYPE = "converted-widget";
|
const CONVERTED_TYPE = "converted-widget";
|
||||||
@ -284,10 +284,10 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.type === "number") {
|
if (widget.type === "combo") {
|
||||||
addRandomizeWidget(this, widget, "Random after every gen");
|
addSeedControlWidget(this, widget, "randomize");
|
||||||
}
|
}
|
||||||
|
|
||||||
// When our value changes, update other widgets to reflect our changes
|
// When our value changes, update other widgets to reflect our changes
|
||||||
// e.g. so LoadImage shows correct image
|
// e.g. so LoadImage shows correct image
|
||||||
const callback = widget.callback;
|
const callback = widget.callback;
|
||||||
|
|||||||
@ -772,6 +772,12 @@ class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (widget.name == "seed control after generating") {
|
||||||
|
if (widget.value == true) {
|
||||||
|
widget.value = "randomize";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,37 +10,55 @@ function getNumberDefaults(inputData, defaultStep) {
|
|||||||
return { val: defaultVal, config: { min, max, step: 10.0 * step } };
|
return { val: defaultVal, config: { min, max, step: 10.0 * step } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addRandomizeWidget(node, targetWidget, name, defaultValue = false) {
|
export function addSeedControlWidget(node, targetWidget, defaultValue = "randomize", values) {
|
||||||
const randomize = node.addWidget("toggle", name, defaultValue, function (v) {}, {
|
const seedControl = node.addWidget("combo", "seed control after generating", "randomize", function (v) { }, {
|
||||||
on: "enabled",
|
values: ["fixed seed", "increment", "decrement", "randomize"]
|
||||||
off: "disabled",
|
})
|
||||||
serialize: false, // Don't include this in prompt.
|
seedControl.afterQueued = () => {
|
||||||
});
|
|
||||||
|
|
||||||
randomize.afterQueued = () => {
|
var v = seedControl.value;
|
||||||
if (randomize.value) {
|
|
||||||
const min = targetWidget.options?.min;
|
switch (v) {
|
||||||
let max = targetWidget.options?.max;
|
case ("fixed seed"):
|
||||||
if (min != null || max != null) {
|
console.log("Fixed Seed");
|
||||||
if (max) {
|
break;
|
||||||
// limit max to something that javascript can handle
|
case ("increment"):
|
||||||
max = Math.min(1125899906842624, max);
|
targetWidget.value += 1;
|
||||||
|
console.log("increment");
|
||||||
|
break;
|
||||||
|
case ("decrement"):
|
||||||
|
targetWidget.value -= 1;
|
||||||
|
console.log("decrement");
|
||||||
|
break;
|
||||||
|
case ("randomize"):
|
||||||
|
const min = targetWidget.options?.min;
|
||||||
|
let max = targetWidget.options?.max;
|
||||||
|
if (min != null || max != null) {
|
||||||
|
if (max) {
|
||||||
|
// limit max to something that javascript can handle
|
||||||
|
max = Math.min(1125899906842624, max);
|
||||||
|
console.log("Random");
|
||||||
|
}
|
||||||
|
targetWidget.value = Math.floor(Math.random() * ((max ?? 9999999999) - (min ?? 0) + 1) + (min ?? 0));
|
||||||
|
console.log("Random");
|
||||||
|
} else {
|
||||||
|
targetWidget.value = Math.floor(Math.random() * 1125899906842624);
|
||||||
|
console.log("Random");
|
||||||
}
|
}
|
||||||
targetWidget.value = Math.floor(Math.random() * ((max ?? 9999999999) - (min ?? 0) + 1) + (min ?? 0));
|
break;
|
||||||
} else {
|
default:
|
||||||
targetWidget.value = Math.floor(Math.random() * 1125899906842624);
|
console.log("default (fail)");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return randomize;
|
return seedControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
function seedWidget(node, inputName, inputData) {
|
function seedWidget(node, inputName, inputData) {
|
||||||
const seed = ComfyWidgets.INT(node, inputName, inputData);
|
const seed = ComfyWidgets.COMBO(node, inputName, inputData);
|
||||||
const randomize = addRandomizeWidget(node, seed.widget, "Random seed after every gen", true);
|
const seedControl = addSeedControlWidget(node, seed.widget, "randomize");
|
||||||
|
|
||||||
seed.widget.linkedWidgets = [randomize];
|
seed.widget.linkedWidgets = [seedControl];
|
||||||
return { widget: seed, randomize };
|
return { widget: seed, seedControl };
|
||||||
}
|
}
|
||||||
|
|
||||||
const MultilineSymbol = Symbol();
|
const MultilineSymbol = Symbol();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user