This commit is contained in:
kk8bit
2025-03-04 18:11:13 +08:00
parent 462c1cfa76
commit ce0fdc97a6
2 changed files with 26 additions and 29 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "kaytool"
description ="KayTool nodes is designed to enhance the efficiency of building ComfyUI workflows. It includes a variety of practical nodes: support for efficient models like BiRefNet and RemBG for background removal and mask post-processing, wireless data transfer (Set & Get ), AI translation (Tencent and Baidu), dynamic mathematical operations, image processing (size extraction, color adjustment, background removal, mask blurring and expansion), flexible text handling, precision sliders, advanced image saving with metadata support, and more."
version = "0.21.7"
version = "0.21.10"
license = {file = "LICENSE"}
dependencies = ["rembg"]
+25 -28
View File
@@ -46,7 +46,7 @@ app.registerExtension({
(s) => {
node.validateName(node.graph);
if (this.widgets[0].value !== '') {
this.title = "🛜Set_" + this.widgets[0].value;
this.title = "𝙆 🛜Out_" + this.widgets[0].value;
}
this.update();
this.properties.previousName = this.widgets[0].value;
@@ -55,22 +55,17 @@ app.registerExtension({
);
this.addInput("*", "*");
this.addOutput("*", '*');
this.onConnectionsChange = function (slotType, slot, isChangeConnect, link_info) {
if (slotType === 1 && !isChangeConnect) { // Disconnect
if (slotType === 1 && !isChangeConnect) {
if (this.inputs[slot].name === '') {
this.inputs[slot].type = '*';
this.inputs[slot].name = '*';
this.title = "🛜Set";
this.title = "𝙆 🛜Out";
this.widgets[0].value = '';
}
}
if (slotType === 2 && !isChangeConnect) {
this.outputs[slot].type = '*';
this.outputs[slot].name = '*';
}
if (link_info && node.graph && slotType === 1 && isChangeConnect) { // Connect
if (link_info && node.graph && slotType === 1 && isChangeConnect) {
const fromNode = node.graph._nodes.find((n) => n.id === link_info.origin_id);
if (fromNode && fromNode.outputs && fromNode.outputs[link_info.origin_slot]) {
const type = fromNode.outputs[link_info.origin_slot].type;
@@ -80,16 +75,6 @@ app.registerExtension({
showAlert("Node input undefined.");
}
}
if (link_info && node.graph && slotType === 2 && isChangeConnect) {
const fromNode = node.graph._nodes.find((n) => n.id === link_info.origin_id);
if (fromNode && fromNode.inputs && fromNode.inputs[link_info.origin_slot]) {
const type = fromNode.inputs[link_info.origin_slot].type;
this.outputs[0].type = type;
this.outputs[0].name = type;
} else {
showAlert("Node output undefined.");
}
}
this.update();
};
@@ -109,7 +94,7 @@ app.registerExtension({
tries++;
}
this.widgets[0].value = widgetValue;
this.title = "🛜Set_" + widgetValue;
this.title = "𝙆 🛜Out_" + widgetValue;
this.update();
}
};
@@ -155,8 +140,20 @@ app.registerExtension({
getExtraMenuOptions(_, options) {
const getters = this.findGetters(this.graph);
if (getters.length) {
let gettersSubmenu = getters.map(getter => ({
if (getters.length === 1) {
options.unshift({
content: "Go to 🛜 In",
callback: () => {
const getter = getters[0];
this.canvas.centerOnNode(getter);
this.canvas.selectNode(getter, false);
this.canvas.setDirty(true, true);
},
});
} else if (getters.length > 1) {
let inNodesSubmenu = getters.map(getter => ({
content: `${getter.title} id: ${getter.id}`,
callback: () => {
this.canvas.centerOnNode(getter);
@@ -165,16 +162,16 @@ app.registerExtension({
},
}));
options.unshift({
content: "Getters",
content: "🛜 In Nodes",
has_submenu: true,
submenu: { title: "GetNodes", options: gettersSubmenu }
submenu: { title: "🛜 In Nodes", options: inNodesSubmenu }
});
}
}
}
LiteGraph.registerNodeType("KaySetNode", Object.assign(KaySetNode, {
title: "🛜Set"
title: "𝙆 🛜Out"
}));
KaySetNode.category = "KayTool";
@@ -222,7 +219,7 @@ app.registerExtension({
if (setter) {
const linkType = setter.inputs[0].type;
this.setType(linkType);
this.title = "🛜Get_" + setter.widgets[0].value;
this.title = "𝙆 🛜In_" + setter.widgets[0].value;
} else {
this.setType('*');
}
@@ -280,14 +277,14 @@ app.registerExtension({
getExtraMenuOptions(_, options) {
options.unshift({
content: "Go to setter",
content: "Go to 🛜 Out",
callback: () => this.goToSetter(),
});
}
}
LiteGraph.registerNodeType("KayGetNode", Object.assign(KayGetNode, {
title: "🛜Get"
title: "𝙆 🛜In"
}));
KayGetNode.category = "KayTool";
},