seed controls now appear in new seed nodes

This commit is contained in:
FizzleDorf 2023-03-31 03:51:52 -04:00
parent 505821d982
commit 03502bc9ad
10 changed files with 16 additions and 26 deletions

Binary file not shown.

View File

@ -1,3 +0,0 @@
{
"CurrentProjectSetting": null
}

View File

@ -1,3 +0,0 @@
{
"SuppressEnvironmentCreationPrompt": true
}

View File

@ -1,12 +0,0 @@
{
"ExpandedNodes": [
"",
"\\web",
"\\web\\extensions",
"\\web\\extensions\\core",
"\\web\\lib",
"\\web\\scripts"
],
"SelectedNode": "\\web\\scripts\\widgets.js",
"PreviewInSolutionExplorer": false
}

Binary file not shown.

View File

@ -263,8 +263,21 @@ app.registerExtension({
this.outputs[0].type = linkType;
this.outputs[0].name = type;
this.outputs[0].widget = widget;
/*
if (widget.name == "seed") {
widget = seedWidget(node, inputName, inputData);
} else {
}
*/
this.#createWidget(widget.config, theirNode, widget.name);
if (widget.name === "seed") {
addSeedControlWidget(this, this.widget, "randomize");
}
}
#createWidget(inputData, node, widgetName) {
@ -278,19 +291,14 @@ app.registerExtension({
if (type in ComfyWidgets) {
widget = (ComfyWidgets[type](this, widgetName/*"value*"*/, inputData, app) || {}).widget;
if (widgetName == "seed") {
addSeedControlWidget(node, node.widgets[0],"randomize");
}
} else {
widget = this.addWidget(type, widgetName /*"value"*/, null, () => { }, {});
if (widgetName == "seed") {
addSeedControlWidget(node, node.widgets[0], "randomize");
}
widget = this.addWidget(type, widgetName /*"value"*/, null, () => { }, {});
}
if (node?.widgets && widget) {
const theirWidget = node.widgets.find((w) => w.name === widgetName);
const theirWidget = node.widgets.find((w) => w.name === widgetName);
if (theirWidget) {
widget.value = theirWidget.value;
}