Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
3762e676
Unverified
Commit
3762e676
authored
Jan 23, 2024
by
pythongosssss
Committed by
GitHub
Jan 23, 2024
Browse files
Support refresh on group node combos (#2625)
* Support refresh on group node combos * fix check
parent
05cd0069
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
web/extensions/core/groupNode.js
web/extensions/core/groupNode.js
+28
-0
web/scripts/app.js
web/scripts/app.js
+2
-0
No files found.
web/extensions/core/groupNode.js
View file @
3762e676
...
...
@@ -966,6 +966,26 @@ export class GroupNodeHandler {
api
.
removeEventListener
(
"
executing
"
,
executing
);
api
.
removeEventListener
(
"
executed
"
,
executed
);
};
this
.
node
.
refreshComboInNode
=
(
defs
)
=>
{
// Update combo widget options
for
(
const
widgetName
in
this
.
groupData
.
newToOldWidgetMap
)
{
const
widget
=
this
.
node
.
widgets
.
find
((
w
)
=>
w
.
name
===
widgetName
);
if
(
widget
?.
type
===
"
combo
"
)
{
const
old
=
this
.
groupData
.
newToOldWidgetMap
[
widgetName
];
const
def
=
defs
[
old
.
node
.
type
];
const
input
=
def
?.
input
?.
required
?.[
old
.
inputName
]
??
def
?.
input
?.
optional
?.[
old
.
inputName
];
if
(
!
input
)
continue
;
widget
.
options
.
values
=
input
[
0
];
if
(
old
.
inputName
!==
"
image
"
&&
!
widget
.
options
.
values
.
includes
(
widget
.
value
))
{
widget
.
value
=
widget
.
options
.
values
[
0
];
widget
.
callback
(
widget
.
value
);
}
}
}
};
}
updateInnerWidgets
()
{
...
...
@@ -1245,6 +1265,14 @@ const ext = {
node
[
GROUP
]
=
new
GroupNodeHandler
(
node
);
}
},
async
refreshComboInNodes
(
defs
)
{
// Re-register group nodes so new ones are created with the correct options
Object
.
assign
(
globalDefs
,
defs
);
const
nodes
=
app
.
graph
.
extra
?.
groupNodes
;
if
(
nodes
)
{
await
GroupNodeConfig
.
registerFromWorkflow
(
nodes
,
{});
}
}
};
app
.
registerExtension
(
ext
);
web/scripts/app.js
View file @
3762e676
...
...
@@ -2212,6 +2212,8 @@ export class ComfyApp {
}
}
}
await
this
.
#
invokeExtensionsAsync
(
"
refreshComboInNodes
"
,
defs
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment