mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 14:27:01 +08:00
Make input/widget conversion sub-menus optional
This commit is contained in:
parent
d64e217427
commit
01103ab1f5
@ -256,8 +256,18 @@ export function mergeIfValid(output, config2, forceUpdate, recreateWidget, confi
|
|||||||
return { customConfig };
|
return { customConfig };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let useConversionSubmenusSetting;
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "Comfy.WidgetInputs",
|
name: "Comfy.WidgetInputs",
|
||||||
|
init() {
|
||||||
|
useConversionSubmenusSetting = app.ui.settings.addSetting({
|
||||||
|
id: "Comfy.NodeInputConversionSubmenus",
|
||||||
|
name: "Node widget/input conversion sub-menus",
|
||||||
|
tooltip: "In the node context menu, place the entries that convert between input/widget in sub-menus.",
|
||||||
|
type: "boolean",
|
||||||
|
defaultValue: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||||
// Add menu options to conver to/from widgets
|
// Add menu options to conver to/from widgets
|
||||||
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
|
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
|
||||||
@ -295,20 +305,28 @@ app.registerExtension({
|
|||||||
|
|
||||||
//Convert.. main menu
|
//Convert.. main menu
|
||||||
if (toInput.length) {
|
if (toInput.length) {
|
||||||
options.push({
|
if (useConversionSubmenusSetting.value) {
|
||||||
content: `Convert input to 🔘..`,
|
options.push({
|
||||||
submenu: {
|
content: `Convert input to 🔘..`,
|
||||||
options: toInput,
|
submenu: {
|
||||||
},
|
options: toInput,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
options.push(...toInput, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (toWidget.length) {
|
if (toWidget.length) {
|
||||||
options.push({
|
if (useConversionSubmenusSetting.value) {
|
||||||
content: `Convert 🔘 to widget..`,
|
options.push({
|
||||||
submenu: {
|
content: `Convert 🔘 to widget..`,
|
||||||
options: toWidget,
|
submenu: {
|
||||||
},
|
options: toWidget,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
options.push(...toWidget, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user