mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 22:07:20 +08:00
hotfix other widget type + remove 'control_after_generate' from convetible widget
This commit is contained in:
parent
aede0b91e0
commit
f22dac25ef
2
nodes.py
2
nodes.py
@ -1335,7 +1335,7 @@ class KSampler:
|
||||
{"model": ("MODEL", { "label": "model" }),
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "label": "seed"}),
|
||||
"steps": ("INT", {"default": 20, "min": 1, "max": 10000, "label": "steps"}),
|
||||
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01, "label": "steps"}),
|
||||
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01, "label": "cfg"}),
|
||||
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, { "label": "sampler name" } ),
|
||||
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, { "label": "scheduler" } ),
|
||||
"positive": ("CONDITIONING", { "label": "positive" }),
|
||||
|
||||
@ -4,6 +4,7 @@ import { applyTextReplacements } from "../../scripts/utils.js";
|
||||
|
||||
const CONVERTED_TYPE = "converted-widget";
|
||||
const VALID_TYPES = ["STRING", "combo", "number", "BOOLEAN"];
|
||||
const UNVALID_NAMES = ["control_after_generate"];
|
||||
const CONFIG = Symbol();
|
||||
const GET_CONFIG = Symbol();
|
||||
const TARGET = Symbol(); // Used for reroutes to specify the real target widget
|
||||
@ -18,7 +19,7 @@ function getConfig(widgetName) {
|
||||
}
|
||||
|
||||
function isConvertableWidget(widget, config) {
|
||||
return (VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])) && !widget.options?.forceInput;
|
||||
return (VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])) && !UNVALID_NAMES.includes(widget.name) && !widget.options?.forceInput;
|
||||
}
|
||||
|
||||
function hideWidget(node, widget, suffix = "") {
|
||||
|
||||
@ -3379,7 +3379,7 @@
|
||||
* @param {Object} extra_info this can be used to have special properties of an output (label, special color, position, etc)
|
||||
*/
|
||||
LGraphNode.prototype.addOutput = function(name, type, extra_info) {
|
||||
var output = { name: name, label: extra_info.label, type: type, links: null };
|
||||
var output = { name: name, label: extra_info?.label || name, type: type, links: null };
|
||||
if (extra_info) {
|
||||
for (var i in extra_info) {
|
||||
output[i] = extra_info[i];
|
||||
|
||||
@ -310,6 +310,8 @@ export const ComfyWidgets = {
|
||||
let disable_rounding = app.ui.settings.getSettingValue("Comfy.DisableFloatRounding")
|
||||
if (precision == 0) precision = undefined;
|
||||
const { val, config } = getNumberDefaults(inputData, 0.5, precision, !disable_rounding);
|
||||
const inputLabel = inputData[1]?.label || inputName;
|
||||
Object.assign(config, { label: inputLabel });
|
||||
return { widget: node.addWidget(widgetType, inputName, val,
|
||||
function (v) {
|
||||
if (config.round) {
|
||||
@ -335,6 +337,8 @@ export const ComfyWidgets = {
|
||||
if (inputData[1].label_off)
|
||||
options["off"] = inputData[1].label_off;
|
||||
}
|
||||
const inputLabel = inputData[1]?.label || inputName;
|
||||
Object.assign(options, { label: inputLabel });
|
||||
return {
|
||||
widget: node.addWidget(
|
||||
"toggle",
|
||||
@ -348,13 +352,14 @@ export const ComfyWidgets = {
|
||||
STRING(node, inputName, inputData, app) {
|
||||
const defaultVal = inputData[1].default || "";
|
||||
const multiline = !!inputData[1].multiline;
|
||||
inputData[1].placeholder = inputData[1]?.placeholder || inputData[1]?.label || inputName;
|
||||
const inputLabel = inputData[1]?.label || inputName;
|
||||
inputData[1].placeholder = inputData[1]?.placeholder || inputLabel;
|
||||
|
||||
let res;
|
||||
if (multiline) {
|
||||
res = addMultilineWidget(node, inputName, { defaultVal, ...inputData[1] }, app);
|
||||
} else {
|
||||
res = { widget: node.addWidget("text", inputName, defaultVal, () => {}, {}) };
|
||||
res = { widget: node.addWidget("text", inputName, defaultVal, () => {}, { label: inputLabel }) };
|
||||
}
|
||||
|
||||
if(inputData[1].dynamicPrompts != undefined)
|
||||
@ -369,6 +374,7 @@ export const ComfyWidgets = {
|
||||
defaultValue = inputData[1].default;
|
||||
}
|
||||
const inputLabel = inputData[1]?.label || inputName
|
||||
inputData[1].label = inputLabel;
|
||||
const res = { widget: node.addWidget("combo", inputName, defaultValue, () => {}, { values: type, label: inputLabel }) };
|
||||
if (inputData[1]?.control_after_generate) {
|
||||
res.widget.linkedWidgets = addValueControlWidgets(node, res.widget, undefined, undefined, inputData);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user