mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 21:04:41 +08:00
Make set/get node automatic coloring optional
This commit is contained in:
parent
2665f00db9
commit
f6354e7850
@ -1,7 +1,7 @@
|
||||
import { app } from "../../../scripts/app.js";
|
||||
|
||||
|
||||
|
||||
var nodeAutoColor = true
|
||||
// Adds context menu entries, code partly from pyssssscustom-scripts
|
||||
|
||||
function addMenuHandler(nodeType, cb) {
|
||||
@ -114,5 +114,17 @@ app.registerExtension({
|
||||
LiteGraph.middle_click_slot_add_default_node = value;
|
||||
},
|
||||
});
|
||||
app.ui.settings.addSetting({
|
||||
id: "KJNodes.nodeAutoColor",
|
||||
name: "Automatically set node colors",
|
||||
defaultValue: false,
|
||||
type: "boolean",
|
||||
options: (value) => [
|
||||
{ value: true, text: "On", selected: value === true },
|
||||
{ value: false, text: "Off", selected: value === false },
|
||||
],
|
||||
// onChange: (value) => {
|
||||
// },
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -25,6 +25,7 @@ function setColorAndBgColor(type) {
|
||||
// Handle the default case if needed
|
||||
}
|
||||
}
|
||||
|
||||
app.registerExtension({
|
||||
name: "SetNode",
|
||||
registerCustomNodes() {
|
||||
@ -97,7 +98,9 @@ app.registerExtension({
|
||||
this.inputs[0].type = type;
|
||||
this.inputs[0].name = type;
|
||||
|
||||
setColorAndBgColor.call(this, type);
|
||||
if (app.ui.settings.getSettingValue("KJNodes.nodeAutoColor")){
|
||||
setColorAndBgColor.call(this, type);
|
||||
}
|
||||
} else {
|
||||
alert("Error: Set node input undefined. Most likely you're missing custom nodes");
|
||||
}
|
||||
@ -269,7 +272,9 @@ app.registerExtension({
|
||||
this.setType(linkType);
|
||||
this.title = "Get_" + setter.widgets[0].value;
|
||||
|
||||
setColorAndBgColor.call(this, linkType);
|
||||
if (app.ui.settings.getSettingValue("KJNodes.nodeAutoColor")){
|
||||
setColorAndBgColor.call(this, type);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.setType('*');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user