1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-04 07:52:46 +08:00

Adding built in extensions + example

This commit is contained in:
pythongosssss
2023-03-03 18:28:34 +00:00
parent 2e52d01cdc
commit 4ef4cf913f
8 changed files with 243 additions and 57 deletions

View File

@@ -27,7 +27,7 @@ function seedWidget(node, inputName, inputData) {
return { widget: seed, randomize };
}
function addMultilineWidget(node, name, defaultVal, dynamicPrompt, app) {
function addMultilineWidget(node, name, defaultVal, app) {
const widget = {
type: "customtext",
name,
@@ -37,9 +37,6 @@ function addMultilineWidget(node, name, defaultVal, dynamicPrompt, app) {
set value(x) {
this.inputEl.value = x;
},
options: {
dynamicPrompt,
},
draw: function (ctx, _, widgetWidth, y, widgetHeight) {
const visible = app.canvas.ds.scale > 0.5;
const t = ctx.getTransform();
@@ -106,12 +103,11 @@ export const ComfyWidgets = {
STRING(node, inputName, inputData, app) {
const defaultVal = inputData[1].default || "";
const multiline = !!inputData[1].multiline;
const dynamicPrompt = !!inputData[1].dynamic_prompt;
if (multiline) {
return addMultilineWidget(node, inputName, defaultVal, dynamicPrompt, app);
return addMultilineWidget(node, inputName, defaultVal, app);
} else {
return { widget: node.addWidget("text", inputName, defaultVal, () => {}, { dynamicPrompt }) };
return { widget: node.addWidget("text", inputName, defaultVal, () => {}, {}) };
}
},
};