ComfyUI Extension: Use Everywhere (UE Nodes)

Authored by chrisgoringe

Created

Updated

784 stars

A set of nodes that allow data to be 'broadcast' to some or all unconnected inputs. Greatly reduces link spaghetti.

README

UE Nodes

Love this node? Buy me a coffee!

Getting started? Download the test workflow below and see how it works.

Problems? Jump down to logging and debugging

Ideas for how to improve the nodes (or bug reports) - raise an issue

Shameless plug for another nodes -> Check out Image Picker for another way to make some workflows smoother. And leave a star if you like something!


TL;DR

Here's the standard ComfyUI template modified to use AnythingEverywhere

|workflow|output image you can drop into Comfy| |-|-| |simple|simple|

The MODEL, CLIP, and VAE are automatically broadcast to all the places they are needed.

Doesn't make much difference in this simple case, but with complex workflows it really does. This is what the default wan 2.2 s2v video workflow looks like:

|before|after| |-|-| |before|after|


Anything Everywhere v7

Version 7 is a major update to the Anything Everywhere nodes, so the documentation below is all new. If you are looking for the old docs, you can find them here.

If you are new to Anything Everywhere, skip to Anything Everywhere.

Major changes

If you used Anything Everywhere prior to v7, the major improvements are:

  • The Anything Everywhere3 and Anything Everywhere? nodes are deprecated, as their features are now part of the standard Anything Everywhere node.
  • Anything Everywhere nodes now have dynamic inputs, so you can plug as many different things into them as you like.
  • All the restrictions on what nodes data will be sent to are now in a restrictions editor, that can be accessed through the right click menu of the node, or by double-clicking the body of the node.
    • In the restrictions editor you can set title, input, and group regexes, color restrictions, group restrictions, and priority (for when two nodes both match)
    • The green circle is used to indicate that any restrictions are in place; if you hover over a node with restrictions they will appear in a tooltip
  • Subgraphs are supported (in the majority of cases). Yay subgraphs! Seriously, they are so much better than group nodes.
    • There are lots of odd cases with subgraphs, so if you find a case not covered properly, please raise an issue

There are a couple of features that have been removed:

  • Group nodes are no longer supported, as they are deprecated in ComfyUI in favour of the new subgraphs, which are supported (in most configurations)
  • The Simple String mechanism to provide an input to the regex of an Anything Everywhere? node is no longer supported
    • Other UI mechanisms to address this need are under consideration

Upgrade considerations

Other than the limitations noted, old workflows should load and work out of the box, with Anything Everywhere3 and Anything Everywhere? nodes automatically converted to Anything Everywhere nodes with the appropriate restrictions applied.

However, there may be edge cases that don't work; if you have any problems, please raise an issue.

You will not be able to use workflows saved using v7 with older versions of ComfyUI or older versions of UE.

Group Nodes are no longer supported


Anything Everywhere

The Anything Everywhere node takes one or more inputs (currently limited to one input of any data type) and sends the data to other nodes that need it. When you connect an input, a new one automatically appears.

Where will the data be sent?

By default the data will be sent to any input of the same data type which does not have a connection, and does not have a widget providing the value.

You can specify that an input should not accept data, or that one with a widget should, via the UE Connectable Inputs menu: the green bar indicates an input is connectable. The Reject UE links option can be used to make this node completely reject UE links, regardless of other settings.

uec

The node also has visual indications: a black ring and a glow on the input dot indicates it is connectable. In the image below, positive has been set to not accept UE inputs, steps has been set to accept them, and model has a UE connection.

uec

If a widget is getting data from a UE connection, it is grayed out, like steps below:

uec

You can also constrain where the data gets send through restrictions applied to the Anything Everywhere node. These restrictions can be accessed by double-clicking the body of the node, or through the right-click menu.

restrictions

The first three entries are regex patterns. The node will only send data to another node if the regex matches the receiving node title, the name of the input, or the name of a group the receiving node is in, respectively.

The Group and Colour restrictions will constrain the node to only send to nodes in (or not in) the same group, and of the same (or different) colour.

If you select multiple restrictions, all must be satisfied for the node to send.

If any restrictions are applied, the Anything Everywhere node gets a green circle in the top left hand corner, and a tooltip if you hover the mouse over it (as long as Show Links is not set to None).

Repeated Types determines behaviour when more than one input of the same type is connected to an Anything Everywhere node. In this case an additional constraint is used to disambiguate which inputs match by comparing the name of the input slot on the Anything Everywhere node with either the name of the input slot on the target node, or the name of the target node. The match start and match end options require that the input names match from the start (or end) for the full length of the shorter: so you can match seed to seed or noise_seed by naming the Anything Everywhere input seed and selecting Match end of input names.

You can rename input slots by right-clicking on the input dot - but you can't rename widget inputs - this is a limitation imposed by ComfyUI (discussion). The work-around is to rename the target node (or use multiple Anything Everywhere nodes with other constraints, especially color matching).

Resolving clashes

What if two or more Anything Everywhere nodes can send to the same input?

Each node has an automatically calculated priority - in general the more restrictive the node, the higher the priority. You can see this prority in the restrictions dialog, and you can choose to replace the automatically calculated value if you wish.

If two more more Anything Everywhere nodes match the same input, the higher priority node is used. If there is a tie, no connection is made. When there is a tie, if you right-click on the canvas you will find an option to show which nodes are the problem.

Special Case Nodes

These two nodes might go away in the future; if they do, workflows using them will be automatically updated with their replacements...

Seed Everywhere

Seed Everywhere connects to any unconnected INT input which matches the regex seed|随机种 (basically all the default seed input names). It has the control_after_generate feature. So if you mark the seed widgets as allowing UE Connections, you can use the same seed everywhere.

Prompts Everywhere

Prompt Everywhere has two inputs. They will be sent with regex matching rules designed to match prompt or positive, and neg, respectively.

The actual regexes used are (_|\\b)pos(itive|_|\\b)|^prompt|正面 and (_|\\b)neg(ative|_|\\b)|负面

|strings|conditionings| |-|-| |pe|pe


Options

In the main settings menu, you will find the Use Everywhere options:

options

The top set, Graphics, modify the visual appearance only.

The bottom set, Options, modify behaviour:

  • Block workflow validation. This prevents other nodes from complaining about the lack of connections, or creating them. If you turn this off, there may be unexpected consequences.
  • Logging. Increase the logging level if you are asked to help debug.
  • Check loops before submitting will attempt to check for loops in the workflow created by Use Everywhere links. Comfy is much better at handling this now, so I would recommend leaving it off.
  • Connect to bypassed nodes. When off, Use Everywhere will not connect to a bypassed node, and will attempt to work out whether an input is connected when upstream nodes are bypassed. I recommend turning this on.

Other features

Third Party Integration - the UE API

At the suggestion of @fighting-tx, I've added a method that third party nodes can use if they want to see the prompt as generated by UE. It's attached to the app object, so you can check if it is present and use it something like this:

var prompt
if (app.ue_modified_prompt) {
  prompt = await app.ue_modified_prompt()
} else {
  prompt = await original_graphToPrompt.apply(app)
}

Other methods could be exposed if there is interest - raise an issue if you'd like to see something.

Show links - visualisation and animation.

If you want to see the UE links, you can turn them on and off by right-clicking on the canvas. For finer control, the main settings menu has options to show links when the mouse moves over the node at either end, or when one of those nodes is selected.

The links can be animated to distinguish them from normal links - this animation can take the form of moving dots, a pulsing glow, or both. This may impact performance in some cases - note that the pulse animation requires less processing than the moving dots. Control this in the main settings menu.

By default the animations turn off when the workflow is running to minimise impact on CPU/GPU - you can change this in the settings too.

Convert to real links

If you want to share a workflow without UE nodes being required, or to save an API version of a workflow, you can replace the virtual links created by UE nodes with real links (and remove the UE nodes).

This can be done for a single node by right-clicking on it and selecting Convert to real links, or for all UE nodes in a workflow by right-clicking the background and selecting Convert all UEs to real links.


Primitives and COMBOs and the like

primitives

UE nodes work with the primitives added in more recent versions of Comfy (in the primitive submenu), but not the old-style Primitive. They also do not work with COMBOs (the data type used for dropdown lists, which are also a type of primitive within Comfy), or reroute nodes.

It is very unlikely this will ever change, as it relates to some issues deep within Comfy...

For more on this, see this discussion


Roadmap

In the near future I hope to do the following:

  • Replace the Prompt Everywhere and Seed Everywhere nodes
  • Add a mechanism to retire Seed Everywhere (or auto convert to an integer node connected to a Anything Everywhere node)
  • Add localisation
  • Negative regexes ('must not match')
  • Possibly add a global variable system (so multiple modes can be changed with a single modification)

Feel free to make suggestions


More detailed notes on a few things

Subgraph creation

There are three nodes involved in every UE link:

  • Source (the link sending the data),
  • Control (the UE node connected to the source),
  • Target (the node that is receiving the data as an input)

This is how those cases are treated:

|Support|Source|Control|Target|| |-|-|-|-|-| |Yes|Graph|Graph|Graph|Nothing changes| |Yes|Graph|Graph|Subgraph|The subgraph will have inputs for the data; in the subgraph the input panel is connected to the Target with a real link| |No|Graph|Subgraph|Graph|Not supported| |No*|Graph|Subgraph|Subgraph|Not supported| |Yes|Subgraph|Graph|Graph|The subgraph will be connected to the Control| |No|Subgraph|Graph|Subgraph|Not supported| |Yes|Subgraph|Subgraph|Graph|The Source will be connected to the Control and the output panel in the subgraph, the output will be connected to the Target with a real link| |Yes|Subgraph|Subgraph|Subgraph|All nodes will be connected in the subgraph as they were in the graph|

No* indicates a case that does not work, but might get implemented.

No indicates a case I'm unlikely ever to support


Reporting a bug well

If you are having problems, the better information you give me, the more chance I can fix it!

Read the list below and include anything that seems relevant. If you can't get the information, that's ok, it just makes it less likely I'll be able to work out what's going on!

  • describe what you did, what you expected, and what happened
  • if you have a simple workflow that recreates the problem, that's a huge help
  • Comfy version information (in Settings - About, it looks like this:) versions
  • check your version of the node (look in the Use Everywhere settings)
  • press f12 and see if there are any errors in the javascript console that look like they might be relevant
  • look at the server (python) console log and see if there are any errors there

Thanks to

The following people have contributed code or helpful discussions, without which these nodes would be less good!

Feel free to make suggestions, or implement features to get your name added here!