MCPcopy
hub / github.com/rgthree/rgthree-comfy

github.com/rgthree/rgthree-comfy @v.1.0.0 sqlite

repository ↗ · DeepWiki ↗ · release v.1.0.0 ↗
290 symbols 544 edges 46 files 23 documented · 8%
README

rgthree's Comfy Nodes

A collection of nodes I've created while messing around with Stable Diffusion. I made them for myself to make my workflow easier and cleaner. You're welcome to try them out, but do so at your own risk. Since I made them for myself, I didn't battle test them much outside of my specific use cases.

Context Node

Install

  1. Install ComfyUi.
  2. Clone this repo into custom_modules: cd ComfyUI/custom_nodes git clone https://github.com/rgthree/rgthree-comfy.git
  3. Start up ComfyUI.

The Nodes

Seed

An intuitive seed control node for ComfyUI that works very much like Automatic1111's seed control.

ℹ️ See More Information

  • Set the seed value to "-1" to use a random seed every time
  • Set any other number in there to use as a static/fixed seed
  • Quick actions to randomize, or (re-)use the last queued seed.
  • Images metadata will store the seed value (so dragging an image in, will have the seed field already fixed to its seed).
  • Secret Features: You can manually set the seed value to "-2" or "-3" to increment or decrement the last seed value. If there was not last seed value, it will randomly use on first.

Router Node

Reroute

Keep your workflow neat with this much improved Reroute node with, like, actual rerouting with multiple directions and sizes.

ℹ️ More Information

  • Use the right-click context menu to change the width, height and connection layout

Router Node

Context

Pass along in general flow properties, and merge in new data. Similar to some other node suites "pipes" but easier merging, is more easily interoperable with standard nodes by both combining and exploding all in a single node.

ℹ️ More Information

Context Node

Display Int

Nothing special, an 'output node' that displays an int after execution.

Lora Loader Stack

A simplified Lora Loader stack. Much like other suites, but more interoperable with standard inputs/outputs.

Power Prompt

Power up your prompt and get drop downs for adding your embeddings, loras, and even have saved prompt snippets.

ℹ️ More Information

  • At the core, you can use Power Prompt almost as a String Primitive node with additional features of dropdowns for choosing your embeddings, and even loras, with no further processing. This will output just the raw TEXT to another node for any lora processing, CLIP Encoding, etc.
  • Connect a CLIP to the input to encode the text, with both the CLIP and CONDITIONING output right from the node.
  • Connect a MODEL to the input to parse and load any <lora:...> tags in the text automatically, without needing a separate Lora Loaders

Power Prompt (Simple)

Same as Power Prompt above, but without LORA support; made for a slightly cleaner negative prompt (since negative prompts do not support loras).

Context Switch

A powerful node to branch your workflow. Works by choosing the first Context input that is not null/empty.

ℹ️ More Information

  • Pass in several context nodes and the Context Switch will automatically choose the first non-null context to continue onward with.
  • Wondering how to toggle contexts to null? Use in conjuction with the Fast Muter

Fast Muter

A powerful 'control panel' node to quickly toggle connected node allowing it to quickly be muted or enabled

ℹ️ More Information

  • Add a collection of all connected nodes allowing a single-spot as a "dashboard" to quickly enable and disable nodes. Two distinct nodes; one for "Muting" connected nodes, and one for "Bypassing" connected nodes.

Fast Bypasser

Same as Fast Muter but sets the connected nodes to "Bypass"

Node Collector

Used to cleanup noodles, this will accept any number of input nodes and passes it along to another node.

⚠️ Currently, this should really only be connected to Fast Muter, Fast Bypasser, or Mute / Bypass Relay.

Mute / Bypass Repeater

A powerful node that will dispatch it's Mute/Bypass/Active mode to all connected input nodes.

ℹ️ More Information

  • 💡 Pro Tip #1: Connect this node's output to a Fast Muter or Fast Bypasser to have a single toggle there that can mute/bypass/enable many nodes with one click.

  • 💡 Pro Tip #2: Connect a Mute / Bypass Relay node to this node's inputs to have the relay automatically dispatch a mute/bypass/enable change to the repeater.

Mute / Bypass Relay

An advanced node that, when working with a Mute / Bypass Repeater will relay a mute/bypass/activate signal to the repeater

ℹ️ More Information

  • Useful when you want a specific node or set of nodes to be muted when a different set of nodes are also muted.

Advanced Techniques

First, a word on muting

A lot of the power of these nodes comes from Muting. Muting is the basis of correctly implementing multiple paths for a workflow utlizing the Context Switch node.

While other extensions may provide switches, they often get it wrong causing your workflow to do extra work than is needed. While these switches may have a selector to choose which input to pass along, they don't stop execution of the other inputs, which will be wasted. Instead, Context Switch works by choosing the first non-empty context to pass along. Muting is one way to make a previous node empty, and causes no extra work to be done when set up correctly.

To understand muting, is to understand the graph flow

Muting, and therefore using Switches, can often confuse people at first because it feels muting a node, or using a switch, should be able to stop or direct the forward flow of the graph. However, this is not the case and, in fact, the graph actually starts working backwards.

If you have a workflow that has a path like ... > Context > KSampler > VAE Decode > Save Image it may initially feel like you should be able to mute that first Context node and the graph would stop there when moving forward and skip the rest of that workflow.

But you'll quickly find that will cause an error, becase the graph doesn't actually move forward. When a workflow is processed, it first moves backwards starting at each "Output Node" (Preview Image, Save Image, even "Display String" etc.) and then walking backwards to all possible paths to get there.

So, with that ... > Context > KSampler > VAE Decode > Save Image example from above, we actually want to mute the Save Image node to stop this path. Once we do, since the output node is gone, none of these nodes will be run.

Let's take a look at an example.

A powerful combination: Using Context, Context Switch, & Fast Muter

Context Node

  1. Using the Context Switch (aqua colored in screenshot) feed context inputs in order of preference. In the workflow above, the Upscale Out context is first so, if that one is enabled, it will be chosen for the output. If not, the second input slot which comes from the context rerouted from above (before the Upscaler booth) will be chosen.

    • Notice the Upscale Preview is after the Upscale Out context node, using the image from it instead of the image from the upscale VAE Decoder. This is on purpose so, when we disable the Upscale Out context, none of the Upscaler nodes will run, saving precious GPU cycles. If we had the preview hooked up directly to the VAE Decoder the upscaler would always run to generate the preview, even if we had the Upscale Out context node disabled.
  2. We can now disable the Upscale Out context node by muting it. Highlighting it and pressing ctrl + m will work. By doing so, it's output will be None, and it will not pass anthing onto the further nodes. In the diagram you can see the Upscale Preview is red, but that's OK; there are no actual errors to stop execution.

  3. Now, let's hook it up to the Fast Muter node. The Fast Muter node works as dashboard by adding quick toggles for any connected node (ignoring reroutes). In the diagram, we have both the Upscaler Out context node, and the Save File context node hooked up. So, we can quickly enable and disable those.

    • The workflow seen here would be a common one where we can generate a handful of base previews cheaply with a random seed, and then choose one to upscale and save to disk.
  4. Lastly, and optionally, you can see the Node Collector. Use it to clean up noodles if you want and connect it to the muter. You can connect anything to it, but doing so may break your workflow's execution.

Extension points exported contracts — how you extend this code

SeedSerializedCtx (Interface)
(no doc)
ts/seed.ts
MenuConfig (Interface)
(no doc)
ts/utils.ts
ComfyWidget (Interface)
(no doc)
ts/typings/comfy.d.ts
SubMenuConfig (Interface)
(no doc)
ts/utils.ts
ComfyGraphNode (Interface)
(no doc)
ts/typings/comfy.d.ts
ComfyExtension (Interface)
(no doc)
ts/typings/comfy.d.ts
INodeSlot (Interface)
(no doc)
ts/typings/litegraph.d.ts
INodeInputSlot (Interface)
(no doc)
ts/typings/litegraph.d.ts

Core symbols most depended-on inside this repo

addConnectionLayoutSupport
called by 18
js/utils.js
wait
called by 10
js/utils.js
getConnectedOutputNodes
called by 10
js/utils.js
computeSize
called by 8
ts/typings/litegraph.d.ts
stripRgthree
called by 8
js/constants.js
getConnectedInputNodes
called by 8
js/utils.js
get_name
called by 8
py/constants.py
get_category
called by 8
py/constants.py

Shape

Method 130
Class 70
Function 69
Interface 20
Enum 1

Languages

TypeScript87%
Python13%

Modules by API surface

ts/typings/litegraph.d.ts33 symbols
ts/utils.ts15 symbols
ts/typings/comfy.d.ts14 symbols
ts/power_prompt.ts13 symbols
ts/base_node_mode_changer.ts13 symbols
js/power_prompt.js13 symbols
js/base_node_mode_changer.js13 symbols
js/utils.js12 symbols
ts/reroute.ts8 symbols
ts/node_mode_repeater.ts8 symbols
ts/node_collector.ts8 symbols
js/reroute.js8 symbols

Dependencies from manifests, versioned

typescript5.1.6 · 1×

For agents

$ claude mcp add rgthree-comfy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact