mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-16 00:12:33 +08:00
fix applying primitive
This commit is contained in:
parent
249fc9255b
commit
83e0314b25
@ -747,4 +747,38 @@ describe("group node", () => {
|
|||||||
expect(widget).toBeTruthy();
|
expect(widget).toBeTruthy();
|
||||||
expect(widget.widget.type).toBe("button");
|
expect(widget.widget.type).toBe("button");
|
||||||
});
|
});
|
||||||
|
test.only("internal primitive populates widgets for all linked inputs", async () => {
|
||||||
|
const { ez, graph, app } = await start();
|
||||||
|
const img = ez.LoadImage();
|
||||||
|
const scale1 = ez.ImageScale(img.outputs[0]);
|
||||||
|
const scale2 = ez.ImageScale(img.outputs[0]);
|
||||||
|
ez.PreviewImage(scale1.outputs[0]);
|
||||||
|
ez.PreviewImage(scale2.outputs[0]);
|
||||||
|
|
||||||
|
scale1.widgets.width.convertToInput();
|
||||||
|
scale2.widgets.height.convertToInput();
|
||||||
|
|
||||||
|
const primitive = ez.PrimitiveNode();
|
||||||
|
primitive.outputs[0].connectTo(scale1.inputs.width);
|
||||||
|
primitive.outputs[0].connectTo(scale2.inputs.height);
|
||||||
|
|
||||||
|
const group = await convertToGroup(app, graph, "test", [img, primitive, scale1, scale2]);
|
||||||
|
group.widgets.value.value = 100;
|
||||||
|
expect((await graph.toPrompt()).output).toEqual({
|
||||||
|
1: {
|
||||||
|
inputs: { image: img.widgets.image.value },
|
||||||
|
class_type: "LoadImage",
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
inputs: { upscale_method: "nearest-exact", width: 100, height: 512, crop: "disabled", image: ["1", 0] },
|
||||||
|
class_type: "ImageScale",
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
inputs: { upscale_method: "nearest-exact", width: 512, height: 100, crop: "disabled", image: ["1", 0] },
|
||||||
|
class_type: "ImageScale",
|
||||||
|
},
|
||||||
|
4: { inputs: { images: ["2", 0] }, class_type: "PreviewImage" },
|
||||||
|
5: { inputs: { images: ["3", 0] }, class_type: "PreviewImage" },
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -295,7 +295,6 @@ export class GroupNodeConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle reroute nodes
|
|
||||||
console.warn("Skipping virtual node " + node.type + " when building group node " + this.name);
|
console.warn("Skipping virtual node " + node.type + " when building group node " + this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +342,6 @@ export class GroupNodeConfig {
|
|||||||
// We need to store this in the correct position so link ids line up
|
// We need to store this in the correct position so link ids line up
|
||||||
converted.set(convertedIndex, inputName);
|
converted.set(convertedIndex, inputName);
|
||||||
widgetMap[inputName] = null;
|
widgetMap[inputName] = null;
|
||||||
this.newToOldWidgetMap[inputName] = { node, inputName };
|
|
||||||
} else {
|
} else {
|
||||||
// Normal widget
|
// Normal widget
|
||||||
const { name, config } = this.getInputConfig(node, inputName, seenInputs, inputs[inputName]);
|
const { name, config } = this.getInputConfig(node, inputName, seenInputs, inputs[inputName]);
|
||||||
@ -369,7 +367,7 @@ export class GroupNodeConfig {
|
|||||||
const primitiveConfig = primitiveDef.input.required.value;
|
const primitiveConfig = primitiveDef.input.required.value;
|
||||||
const output = { widget: primitiveConfig };
|
const output = { widget: primitiveConfig };
|
||||||
const config = mergeIfValid(output, targetWidget, false, null, primitiveConfig);
|
const config = mergeIfValid(output, targetWidget, false, null, primitiveConfig);
|
||||||
primitiveConfig[1] = config?.customConfig ?? inputs[inputName][1] ?? {};
|
primitiveConfig[1] = config?.customConfig ?? inputs[inputName][1] ? { ...inputs[inputName][1] } : {};
|
||||||
|
|
||||||
let name = this.oldToNewWidgetMap[sourceNodeId]["value"];
|
let name = this.oldToNewWidgetMap[sourceNodeId]["value"];
|
||||||
name = name.substr(0, name.length - 6);
|
name = name.substr(0, name.length - 6);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user