Move linkRenderMode extension to core (#1359)

This commit is contained in:
Chenlei Hu
2024-10-29 11:00:10 -04:00
committed by GitHub
parent 10f43be911
commit 1f91a88d7b
6 changed files with 25 additions and 30 deletions

View File

@@ -105,6 +105,14 @@ watchEffect(() => {
})
})
watchEffect(() => {
const linkRenderMode = settingStore.get('Comfy.LinkRenderMode')
if (canvasStore.canvas) {
canvasStore.canvas.links_render_mode = linkRenderMode
canvasStore.canvas.setDirty(/* fg */ false, /* bg */ true)
}
})
watchEffect(() => {
if (!canvasStore.canvas) return

View File

@@ -8,7 +8,6 @@ import './groupNodeManage'
import './groupOptions'
import './invertMenuScrolling'
import './keybinds'
import './linkRenderMode'
import './maskeditor'
import './nodeTemplates'
import './noteNode'

View File

@@ -1,27 +0,0 @@
import { app, ComfyApp } from '../../scripts/app'
import { LiteGraph } from '@comfyorg/litegraph'
const id = 'Comfy.LinkRenderMode'
const ext = {
name: id,
async setup(app: ComfyApp) {
app.ui.settings.addSetting({
id,
category: ['Comfy', 'Graph', 'LinkRenderMode'],
name: 'Link Render Mode',
defaultValue: 2,
type: 'combo',
options: [
{ value: LiteGraph.STRAIGHT_LINK.toString(), text: 'Straight' },
{ value: LiteGraph.LINEAR_LINK.toString(), text: 'Linear' },
{ value: LiteGraph.SPLINE_LINK.toString(), text: 'Spline' },
{ value: LiteGraph.HIDDEN_LINK.toString(), text: 'Hidden' }
],
onChange(value: number) {
app.canvas.links_render_mode = +value
app.canvas.setDirty(/* fg */ false, /* bg */ true)
}
})
}
}
app.registerExtension(ext)

View File

@@ -5,6 +5,7 @@ import {
LinkReleaseTriggerMode
} from '@/types/searchBoxTypes'
import type { SettingParams } from '@/types/settingTypes'
import { LiteGraph } from '@comfyorg/litegraph'
export const CORE_SETTINGS: SettingParams[] = [
{
@@ -444,5 +445,18 @@ export const CORE_SETTINGS: SettingParams[] = [
'Recommended for node developers. This will validate all node definitions on startup.',
defaultValue: false,
versionAdded: '1.3.14'
},
{
id: 'Comfy.LinkRenderMode',
category: ['Comfy', 'Graph', 'LinkRenderMode'],
name: 'Link Render Mode',
defaultValue: 2,
type: 'combo',
options: [
{ value: LiteGraph.STRAIGHT_LINK, text: 'Straight' },
{ value: LiteGraph.LINEAR_LINK, text: 'Linear' },
{ value: LiteGraph.SPLINE_LINK, text: 'Spline' },
{ value: LiteGraph.HIDDEN_LINK, text: 'Hidden' }
]
}
]

View File

@@ -511,7 +511,8 @@ const zSettings = z.record(z.any()).and(
'Comfy.Keybinding.UnsetBindings': z.array(zKeybinding),
'Comfy.Keybinding.NewBindings': z.array(zKeybinding),
'Comfy.Extension.Disabled': z.array(z.string()),
'Comfy.Settings.ExtensionPanel': z.boolean()
'Comfy.Settings.ExtensionPanel': z.boolean(),
'Comfy.LinkRenderMode': z.number()
})
.optional()
)

View File

@@ -19,7 +19,7 @@ export type SettingCustomRenderer = (
export interface SettingOption {
text: string
value?: string
value?: any
}
export interface Setting {