5 Commits
Author SHA1 Message Date
pixelass 9d6f688c53 docs: update readme 2023-08-01 17:56:55 +02:00
pixelass d47d1a122e docs: changelog 2023-08-01 17:55:04 +02:00
pixelass f27d1f140e feat: allow Reroute as dot 2023-08-01 17:55:04 +02:00
pixelass 8eba0f010d docs: changelog 2023-08-01 17:55:04 +02:00
pixelass f161d6e563 feat(reroutes): al;low showing title on reroute 2023-08-01 17:55:04 +02:00
3 changed files with 152 additions and 2 deletions
+19
View File
@@ -1,3 +1,22 @@
# [](https://github.com/failfa-st/failfast-comfyui-extensions/compare/v1.0.0...v) (2023-08-01)
### Features
* allow Reroute as dot ([9cf412f](https://github.com/failfa-st/failfast-comfyui-extensions/commit/9cf412f4d7c05eaf4f958b8e0752cb75d764425a))
* **reroutes:** allow showing title on reroute ([27e49f8](https://github.com/failfa-st/failfast-comfyui-extensions/commit/27e49f83d5c37a529638862132a40cd837a41127))
# [](https://github.com/failfa-st/failfast-comfyui-extensions/compare/v1.0.0...v) (2023-08-01)
### Features
* **reroutes:** al;low showing title on reroute ([27e49f8](https://github.com/failfa-st/failfast-comfyui-extensions/commit/27e49f83d5c37a529638862132a40cd837a41127))
# (2023-08-01)
+19 -2
View File
@@ -136,12 +136,29 @@ The context menu offers additional options for nodes, groups, colors, and the ca
**Nodes**
- Custom color option (only available in "default" Color Mode).
- Show title on Reroute node
- Render Reroute as dot
![Screenshot 2023-08-01 164137](
<div align="center">
<img src="https://github.com/failfa-st/failfast-comfyui-extensions/assets/1148334/f0c4dc53-0e40-480d-a3f9-09b50a3ab56d" alt="Node options" height="300px">
<p>Node Options</p>
<img src="https://github.com/failfa-st/failfast-comfyui-extensions/assets/1148334/f0c4dc53-0e40-480d-a3f9-09b50a3ab56d" alt="Node color options" height="300px">
<p>Node Color Options</p>
</div>
<div align="center">
<img src="https://github.com/failfa-st/failfast-comfyui-extensions/assets/1148334/e40ea33d-5a44-4859-b050-ed7a13057536" alt="reroute Node options" width="400px">
<p>Reroute show/hide Title</p>
</div>
<div align="center">
<img src="https://github.com/failfa-st/failfast-comfyui-extensions/assets/1148334/c02818a1-3c87-4d15-8e91-2328b08d46f3" alt="reroute Node as dot" height="300px">
<p>Reroute as dot</p>
</div>
**Groups**
- Custom color option.
+114
View File
@@ -0,0 +1,114 @@
/**
* Coded with love by Failfa.st
* LICENSE: AGPL 3.0
* https://github.com/failfa-st/failfast-comfyui-extensions/blob/main/LICENSE
*
* Visit https://github.com/failfa-st/failfast-comfyui-extensions for more info
*
* Homepage: https://failfa.st
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "/scripts/app.js";
const reroutesName = "Failfast.reroutes";
const mini =[34,26]
function miniReroute(node) {
if (node.type !== "Reroute") {
return;
}
node._size = node.size;
node._title = node.title;
Object.defineProperty(node, "title", {
get() {
return this._title;
},
set(value) {
this._title = value;
if (node.properties.showTitle) {
node.outputs[0].label = value;
}
},
});
if (node.properties.dot) {
Object.defineProperty(node, "size", {
get() {
return this._size;
},
set() {
console.log("prevented");
},
});
node._size[0] = mini[0];
node._size[1] = mini[1];
}
}
app.registerExtension({
name: reroutesName,
async setup(app) {
const onNodeAdded = app.graph.onNodeAdded;
app.graph.onNodeAdded = function (node) {
if (node.type !== "Reroute") {
return onNodeAdded?.apply(this, arguments);
}
miniReroute(node);
return onNodeAdded?.apply(this, arguments);
};
app.graph._nodes.forEach((node) => {
if (node.type === "Reroute") {
miniReroute(node);
}
});
const getNodeMenuOptions = LGraphCanvas.prototype.getNodeMenuOptions;
LGraphCanvas.prototype.getNodeMenuOptions = function (node) {
const options = getNodeMenuOptions.apply(this, arguments);
if (node.type !== "Reroute") {
return options;
}
options.unshift({
content: node.properties.showTitle ? "Hide Title" : "Show Title",
callback() {
node.outputs[0].label = node.properties.showTitle
? undefined
: node.title;
node.properties.showTitle = !node.properties.showTitle;
},
});
options.push({
content: "Render as dot",
callback() {
console.log(node);
if (node.properties.dot) {
Object.defineProperty(node, "size", {
get() {
return this._size;
},
set(value) {
this._size = value;
},
});
} else {
Object.defineProperty(node, "size", {
get() {
return this._size;
},
set() {
console.log("prevented");
},
});
}
node._size[0] = node.properties.dot ? 75 : mini[0];
node._size[1] = node.properties.dot ? 26 : mini[1];
node.properties.dot = !node.properties.dot;
node.setDirtyCanvas(true, true);
},
});
return options;
};
},
});