Skip to content

Commit ba4e4ed

Browse files
authored
Deprecate widgetType:widgetName key in widgets map (#2879)
1 parent 35e6cab commit ba4e4ed

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

src/composables/widgets/useIntWidget.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ export const useIntWidget = () => {
7171
}
7272
)
7373

74-
if (inputSpec.control_after_generate) {
74+
const controlAfterGenerate =
75+
inputSpec.control_after_generate ??
76+
/**
77+
* Compatibility with legacy node convention. Int input with name
78+
* 'seed' or 'noise_seed' get automatically added a control widget.
79+
*/
80+
['seed', 'noise_seed'].includes(inputSpec.name)
81+
82+
if (controlAfterGenerate) {
7583
const seedControl = addValueControlWidget(
7684
node,
7785
widget,

src/scripts/app.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,6 @@ export class ComfyApp {
934934

935935
if (Array.isArray(type)) {
936936
return 'COMBO'
937-
} else if (`${type}:${inputName}` in this.widgets) {
938-
return `${type}:${inputName}`
939937
} else if (type in this.widgets) {
940938
return type
941939
} else {

src/scripts/widgets.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,7 @@ export function addValueControlWidgets(
278278
return widgets
279279
}
280280

281-
const seedWidget = transformWidgetConstructorV2ToV1((node, inputSpec) => {
282-
return useIntWidget()(node, {
283-
...inputSpec,
284-
control_after_generate: true
285-
})
286-
})
287-
288281
export const ComfyWidgets: Record<string, ComfyWidgetConstructor> = {
289-
'INT:seed': seedWidget,
290-
'INT:noise_seed': seedWidget,
291282
INT: transformWidgetConstructorV2ToV1(useIntWidget()),
292283
FLOAT: transformWidgetConstructorV2ToV1(useFloatWidget()),
293284
BOOLEAN: transformWidgetConstructorV2ToV1(useBooleanWidget()),

src/stores/widgetStore.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,8 @@ export const useWidgetStore = defineStore('widget', () => {
1212
...coreWidgets
1313
}))
1414

15-
function getWidgetType(type: string, inputName: string) {
16-
if (type === 'COMBO') {
17-
return 'COMBO'
18-
/**
19-
* @deprecated Group node logic. Remove once group node feature is removed.
20-
*/
21-
} else if (`${type}:${inputName}` in widgets.value) {
22-
return `${type}:${inputName}`
23-
} else if (type in widgets.value) {
24-
return type
25-
} else {
26-
return null
27-
}
28-
}
29-
3015
function inputIsWidget(spec: InputSpecV2) {
31-
return getWidgetType(spec.type, spec.name) !== null
16+
return spec.type in widgets.value
3217
}
3318

3419
function registerCustomWidgets(
@@ -42,7 +27,6 @@ export const useWidgetStore = defineStore('widget', () => {
4227

4328
return {
4429
widgets,
45-
getWidgetType,
4630
inputIsWidget,
4731
registerCustomWidgets
4832
}

0 commit comments

Comments
 (0)