Group comfy core settings (#508)

* Add category overwrite

* Group settings
This commit is contained in:
Chenlei Hu
2024-08-18 12:49:23 -04:00
committed by GitHub
parent ec5f1152da
commit add2f9baa0
12 changed files with 47 additions and 10 deletions

View File

@@ -714,6 +714,7 @@ app.registerExtension({
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id, id,
category: ['Comfy', 'ColorPalette'],
name: 'Color Palette', name: 'Color Palette',
type: (name, setter, value) => { type: (name, setter, value) => {
const options = [ const options = [

View File

@@ -23,7 +23,8 @@ app.registerExtension({
} }
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id, id,
name: 'Invert Menu Scrolling', category: ['Comfy', 'Graph', 'InvertMenuScrolling'],
name: 'Invert Context Menu Scrolling',
type: 'boolean', type: 'boolean',
defaultValue: false, defaultValue: false,
onChange(value) { onChange(value) {

View File

@@ -6,6 +6,7 @@ const ext = {
async setup(app) { async setup(app) {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id, id,
category: ['Comfy', 'Graph', 'LinkRenderMode'],
name: 'Link Render Mode', name: 'Link Render Mode',
defaultValue: 2, defaultValue: 2,
type: 'combo', type: 'combo',

View File

@@ -11,7 +11,9 @@ app.registerExtension({
LiteGraph.middle_click_slot_add_default_node = true LiteGraph.middle_click_slot_add_default_node = true
this.suggestionsNumber = app.ui.settings.addSetting({ this.suggestionsNumber = app.ui.settings.addSetting({
id: 'Comfy.NodeSuggestions.number', id: 'Comfy.NodeSuggestions.number',
category: ['Comfy', 'Node Search Box', 'NodeSuggestions'],
name: 'Number of nodes suggestions', name: 'Number of nodes suggestions',
tooltip: 'Only for litegraph searchbox/context menu',
type: 'slider', type: 'slider',
attrs: { attrs: {
min: 1, min: 1,

View File

@@ -23,7 +23,8 @@ app.registerExtension({
// Add setting to control grid size // Add setting to control grid size
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.SnapToGrid.GridSize', id: 'Comfy.SnapToGrid.GridSize',
name: 'Grid Size', category: ['Comfy', 'Graph', 'GridSize'],
name: 'Snap to gird size',
type: 'slider', type: 'slider',
attrs: { attrs: {
min: 1, min: 1,

View File

@@ -418,6 +418,7 @@ export class ComfyApp {
} }
this.enableWorkflowViewRestore = this.ui.settings.addSetting({ this.enableWorkflowViewRestore = this.ui.settings.addSetting({
id: 'Comfy.EnableWorkflowViewRestore', id: 'Comfy.EnableWorkflowViewRestore',
category: ['Comfy', 'Workflow', 'EnableWorkflowViewRestore'],
name: 'Save and restore canvas position and zoom level in workflows', name: 'Save and restore canvas position and zoom level in workflows',
type: 'boolean', type: 'boolean',
defaultValue: true defaultValue: true

View File

@@ -245,6 +245,7 @@ let enableDomClipping = true
export function addDomClippingSetting(): void { export function addDomClippingSetting(): void {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.DOMClippingEnabled', id: 'Comfy.DOMClippingEnabled',
category: ['Comfy', 'Node', 'DOMClippingEnabled'],
name: 'Enable DOM element clipping (enabling may reduce performance)', name: 'Enable DOM element clipping (enabling may reduce performance)',
type: 'boolean', type: 'boolean',
defaultValue: enableDomClipping, defaultValue: enableDomClipping,

View File

@@ -167,7 +167,8 @@ function dragElement(dragEl, settings): () => void {
let savePos = undefined let savePos = undefined
settings.addSetting({ settings.addSetting({
id: 'Comfy.MenuPosition', id: 'Comfy.MenuPosition',
name: 'Save menu position', category: ['Comfy', 'Menu', 'MenuPosition'],
name: "Save legacy menu's position",
type: 'boolean', type: 'boolean',
defaultValue: savePos, defaultValue: savePos,
onChange(value) { onChange(value) {
@@ -369,6 +370,7 @@ export class ComfyUI {
const confirmClear = this.settings.addSetting({ const confirmClear = this.settings.addSetting({
id: 'Comfy.ConfirmClear', id: 'Comfy.ConfirmClear',
category: ['Comfy', 'Workflow', 'ConfirmClear'],
name: 'Require confirmation when clearing workflow', name: 'Require confirmation when clearing workflow',
type: 'boolean', type: 'boolean',
defaultValue: true defaultValue: true
@@ -376,6 +378,7 @@ export class ComfyUI {
const promptFilename = this.settings.addSetting({ const promptFilename = this.settings.addSetting({
id: 'Comfy.PromptFilename', id: 'Comfy.PromptFilename',
category: ['Comfy', 'Workflow', 'PromptFilename'],
name: 'Prompt for filename when saving workflow', name: 'Prompt for filename when saving workflow',
type: 'boolean', type: 'boolean',
defaultValue: true defaultValue: true
@@ -394,13 +397,17 @@ export class ComfyUI {
*/ */
const previewImage = this.settings.addSetting({ const previewImage = this.settings.addSetting({
id: 'Comfy.PreviewFormat', id: 'Comfy.PreviewFormat',
name: 'When displaying a preview in the image widget, convert it to a lightweight image, e.g. webp, jpeg, webp;50, etc.', category: ['Comfy', 'Node Widget', 'PreviewFormat'],
name: 'Preview image format',
tooltip:
'When displaying a preview in the image widget, convert it to a lightweight image, e.g. webp, jpeg, webp;50, etc.',
type: 'text', type: 'text',
defaultValue: '' defaultValue: ''
}) })
this.settings.addSetting({ this.settings.addSetting({
id: 'Comfy.DisableSliders', id: 'Comfy.DisableSliders',
category: ['Comfy', 'Node Widget', 'DisableSliders'],
name: 'Disable node widget sliders', name: 'Disable node widget sliders',
type: 'boolean', type: 'boolean',
defaultValue: false defaultValue: false
@@ -408,14 +415,19 @@ export class ComfyUI {
this.settings.addSetting({ this.settings.addSetting({
id: 'Comfy.DisableFloatRounding', id: 'Comfy.DisableFloatRounding',
name: 'Disable rounding floats (requires page reload).', category: ['Comfy', 'Node Widget', 'DisableFloatRounding'],
name: 'Disable default float widget rounding.',
tooltip:
'(requires page reload) Cannot disable round when round is set by the node in the backend.',
type: 'boolean', type: 'boolean',
defaultValue: false defaultValue: false
}) })
this.settings.addSetting({ this.settings.addSetting({
id: 'Comfy.FloatRoundingPrecision', id: 'Comfy.FloatRoundingPrecision',
name: 'Decimal places [0 = auto] (requires page reload).', category: ['Comfy', 'Node Widget', 'FloatRoundingPrecision'],
name: 'Float widget rounding decimal places [0 = auto].',
tooltip: '(requires page reload)',
type: 'slider', type: 'slider',
attrs: { attrs: {
min: 0, min: 0,
@@ -427,6 +439,7 @@ export class ComfyUI {
this.settings.addSetting({ this.settings.addSetting({
id: 'Comfy.EnableTooltips', id: 'Comfy.EnableTooltips',
category: ['Comfy', 'Node', 'EnableTooltips'],
name: 'Enable Tooltips', name: 'Enable Tooltips',
type: 'boolean', type: 'boolean',
defaultValue: true defaultValue: true

View File

@@ -158,8 +158,10 @@ export class ComfyAppMenu {
let resizeHandler: () => void let resizeHandler: () => void
this.menuPositionSetting = app.ui.settings.addSetting({ this.menuPositionSetting = app.ui.settings.addSetting({
id: 'Comfy.UseNewMenu', id: 'Comfy.UseNewMenu',
category: ['Comfy', 'Menu', 'UseNewMenu'],
defaultValue: 'Disabled', defaultValue: 'Disabled',
name: '[Beta] Use new menu and workflow management. Note: On small screens the menu will always be at the top.', name: '[Beta] Use new menu and workflow management.',
tooltip: 'On small screens the menu will always be at the top.',
type: 'combo', type: 'combo',
options: ['Disabled', 'Top', 'Bottom'], options: ['Disabled', 'Top', 'Bottom'],
onChange: async (v: MenuPosition) => { onChange: async (v: MenuPosition) => {

View File

@@ -347,7 +347,10 @@ function isSlider(display, app) {
export function initWidgets(app) { export function initWidgets(app) {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.WidgetControlMode', id: 'Comfy.WidgetControlMode',
name: 'Controls when widget values are updated (randomize/increment/decrement), either before the prompt is queued or after.', category: ['Comfy', 'Node Widget', 'WidgetControlMode'],
name: 'Widget control mode',
tooltip:
'Controls when widget values are updated (randomize/increment/decrement), either before the prompt is queued or after.',
type: 'combo', type: 'combo',
defaultValue: 'after', defaultValue: 'after',
options: ['before', 'after'], options: ['before', 'after'],

View File

@@ -34,7 +34,7 @@ export const useSettingStore = defineStore('setting', {
settingTree(): SettingTreeNode { settingTree(): SettingTreeNode {
const root = buildTree( const root = buildTree(
Object.values(this.settings), Object.values(this.settings),
(setting: SettingParams) => setting.id.split('.') (setting: SettingParams) => setting.category || setting.id.split('.')
) )
const floatingSettings = root.children.filter((node) => node.leaf) const floatingSettings = root.children.filter((node) => node.leaf)
@@ -68,6 +68,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.NodeSearchBoxImpl', id: 'Comfy.NodeSearchBoxImpl',
category: ['Comfy', 'Node Search Box', 'Implementation'],
name: 'Node Search box implementation', name: 'Node Search box implementation',
type: 'combo', type: 'combo',
options: ['default', 'litegraph (legacy)'], options: ['default', 'litegraph (legacy)'],
@@ -76,6 +77,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.NodeSearchBoxImpl.LinkReleaseTrigger', id: 'Comfy.NodeSearchBoxImpl.LinkReleaseTrigger',
category: ['Comfy', 'Node Search Box', 'LinkReleaseTrigger'],
name: 'Trigger on link release', name: 'Trigger on link release',
tooltip: 'Only applies to the default implementation', tooltip: 'Only applies to the default implementation',
type: 'combo', type: 'combo',
@@ -85,6 +87,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.NodeSearchBoxImpl.NodePreview', id: 'Comfy.NodeSearchBoxImpl.NodePreview',
category: ['Comfy', 'Node Search Box', 'NodePreview'],
name: 'Node Preview', name: 'Node Preview',
tooltip: 'Only applies to the default implementation', tooltip: 'Only applies to the default implementation',
type: 'boolean', type: 'boolean',
@@ -93,6 +96,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.Sidebar.Location', id: 'Comfy.Sidebar.Location',
category: ['Comfy', 'Sidebar', 'Location'],
name: 'Sidebar location', name: 'Sidebar location',
type: 'combo', type: 'combo',
options: ['left', 'right'], options: ['left', 'right'],
@@ -101,6 +105,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.Sidebar.Size', id: 'Comfy.Sidebar.Size',
category: ['Comfy', 'Sidebar', 'Size'],
name: 'Sidebar size', name: 'Sidebar size',
type: 'combo', type: 'combo',
options: ['normal', 'small'], options: ['normal', 'small'],
@@ -109,6 +114,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.TextareaWidget.FontSize', id: 'Comfy.TextareaWidget.FontSize',
category: ['Comfy', 'Node Widget', 'TextareaWidget', 'FontSize'],
name: 'Textarea widget font size', name: 'Textarea widget font size',
type: 'slider', type: 'slider',
defaultValue: 10, defaultValue: 10,
@@ -120,7 +126,7 @@ export const useSettingStore = defineStore('setting', {
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: 'Comfy.Workflow.SortNodeIdOnSave', id: 'Comfy.Workflow.SortNodeIdOnSave',
name: 'Sort node IDs on save', name: 'Sort node IDs when saving workflow',
type: 'boolean', type: 'boolean',
defaultValue: false defaultValue: false
}) })

View File

@@ -38,4 +38,9 @@ export interface SettingParams {
attrs?: any attrs?: any
tooltip?: string tooltip?: string
options?: Array<string | SettingOption> | ((value: any) => SettingOption[]) options?: Array<string | SettingOption> | ((value: any) => SettingOption[])
// By default category is id.split('.'). However, changing id to assign
// new category has poor backward compatibility. Use this field to overwrite
// default category from id.
// Note: Like id, category value need to be unique.
category?: string[]
} }