mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-14 23:34:35 +08:00
Update setgetnodes.js
This commit is contained in:
parent
76d32c9822
commit
0e27281ac5
@ -26,6 +26,7 @@ app.registerExtension({
|
|||||||
'',
|
'',
|
||||||
(s, t, u, v, x) => {
|
(s, t, u, v, x) => {
|
||||||
node.validateName(node.graph);
|
node.validateName(node.graph);
|
||||||
|
this.title = "Set_" + this.widgets[0].value;
|
||||||
this.update();
|
this.update();
|
||||||
this.properties.previousName = this.widgets[0].value;
|
this.properties.previousName = this.widgets[0].value;
|
||||||
},
|
},
|
||||||
@ -36,6 +37,7 @@ app.registerExtension({
|
|||||||
this.addOutput("*", '*');
|
this.addOutput("*", '*');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.onConnectionsChange = function(
|
this.onConnectionsChange = function(
|
||||||
slotType, //1 = input, 2 = output
|
slotType, //1 = input, 2 = output
|
||||||
slot,
|
slot,
|
||||||
@ -58,7 +60,10 @@ app.registerExtension({
|
|||||||
|
|
||||||
const fromNode = node.graph._nodes.find((otherNode) => otherNode.id == link_info.origin_id);
|
const fromNode = node.graph._nodes.find((otherNode) => otherNode.id == link_info.origin_id);
|
||||||
const type = fromNode.outputs[link_info.origin_slot].type;
|
const type = fromNode.outputs[link_info.origin_slot].type;
|
||||||
|
|
||||||
|
if (this.title == "Set"){
|
||||||
this.title = "Set_" + type;
|
this.title = "Set_" + type;
|
||||||
|
}
|
||||||
if (this.widgets[0].value == ''){
|
if (this.widgets[0].value == ''){
|
||||||
this.widgets[0].value = type
|
this.widgets[0].value = type
|
||||||
}
|
}
|
||||||
@ -262,25 +267,19 @@ app.registerExtension({
|
|||||||
|
|
||||||
|
|
||||||
this.setName = function(name) {
|
this.setName = function(name) {
|
||||||
console.log("renaming getter: ");
|
|
||||||
console.log(node.widgets[0].value + " -> " + name);
|
|
||||||
node.widgets[0].value = name;
|
node.widgets[0].value = name;
|
||||||
node.onRename();
|
node.onRename();
|
||||||
node.serialize();
|
node.serialize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.onRename = function() {
|
this.onRename = function() {
|
||||||
console.log("onRename");
|
|
||||||
|
|
||||||
const setter = this.findSetter(node.graph);
|
const setter = this.findSetter(node.graph);
|
||||||
if (setter) {
|
if (setter) {
|
||||||
let linkType = (setter.inputs[0].type);
|
let linkType = (setter.inputs[0].type);
|
||||||
|
|
||||||
this.setType(linkType);
|
this.setType(linkType);
|
||||||
this.title = "Get_" + setter.inputs[0].type;
|
this.title = "Get_" + setter.widgets[0].value;
|
||||||
|
|
||||||
switch (linkType) {
|
switch (linkType) {
|
||||||
case "MODEL":
|
case "MODEL":
|
||||||
this.color = LGraphCanvas.node_colors.blue.color;
|
this.color = LGraphCanvas.node_colors.blue.color;
|
||||||
@ -373,7 +372,9 @@ app.registerExtension({
|
|||||||
} else {
|
} else {
|
||||||
console.log(this.widgets[0]);
|
console.log(this.widgets[0]);
|
||||||
console.log(this.widgets[0].value);
|
console.log(this.widgets[0].value);
|
||||||
|
alert("No SetNode found for " + this.widgets[0].value + "(" + this.type + ")");
|
||||||
throw new Error("No SetNode found for " + this.widgets[0].value + "(" + this.type + ")");
|
throw new Error("No SetNode found for " + this.widgets[0].value + "(" + this.type + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user