comfyui_pcg docs

Tutorial 6: controller panel#

One Parameters (PCG) node acts as the control panel for a small model: three values on it drive six widgets on four other nodes. This is the comfyui_pcg version of putting spare parameters on a Houdini null and pasting relative references to them.

A ring of pillars driven by three panel values

Load it#

Drag example_workflows/tutorial_06_controller.json onto the ComfyUI canvas and press Queue. No model files or other custom nodes are needed.

Step by step#

The panel

Parameters (PCG) ("Controls") declares its parameters as text, one per line:

float ring_radius = 4 : 1 12  # Ring radius
int pillars = 12 : 3 48  # Pillar count
float pillar_height = 3 : 0.5 10  # Pillar height

Each line is <type> <name> = <default> : <min> <max> # <label>. The front end grows one control per parameter on the node. The panel has no wires: nothing is connected to its outputs.

The bindings

NodeWidgetBound to
Circle ("Pillar positions")radius_x, radius_yring_radius
Circledivisionspillars
Tube ("Pillar")heightpillar_height
Torus ("Top ring")radiusring_radius
Transform ("Lift to the pillar tops")typillar_height

A bound widget shows its reference in its label, for example radius_x ←ch("../Controls/ring_radius"). Change a value on the panel and every widget bound to it follows. Bindings are made from the target node's right-click menu (the PCG bind-parameter entry), or by copying a parameter reference on one node and pasting it on another.

The model

  1. Circle (PCG) (orientation ZX) gives pillars points on a circle of radius ring_radius.
  2. Tube (PCG) ("Pillar") is a slightly tapered cylinder of height pillar_height; Match Size (PCG) ("Base at y = 0", Justify Y min) moves its base onto the ground.
  3. Copy to Points (PCG) ("Pillars on the circle") puts one pillar on every circle point. Transform Using Target Point Orientations is off, so the pillars are only translated and stay upright.
  4. Torus (PCG) ("Top ring", radius ring_radius) is lifted by Transform (PCG) to y = pillar_height.
  5. Merge (PCG), Color (PCG), Geometry Preview (PCG) and Viewport (PCG) combine and display the result.

How bindings run#

Bindings are evaluated in the browser: when a panel value changes, the new value is written straight into each bound widget. The bindings themselves are stored in the workflow (in each node's properties), but the prompt sent to the server only contains plain widget values. Two consequences:

  • Only nodes whose widget value actually changed are recomputed; the rest of the graph stays cached.
  • When the workflow is run through the API or headless, nothing is re-evaluated: the values last written into the widgets are used. The saved tutorial has every bound widget already set to the panel's value.

Worth tweaking#

WhereWhatEffect
Controlsring_radius, pillars, pillar_heightThe whole point of the panel: change them here, not on the individual nodes.
ControlsdeclareAdd a parameter (for example float pillar_radius = 0.25 : 0.05 1) and bind the Tube's radius1 and radius2 to it.
Pillarradius1, radius2, colsPillar shape (not bound, so edit them directly).

See also#

  • Parameters: the panel, the Edit Parameter Interface dialog, copy/paste references and ch() expressions.
  • Expressions: expressions in fields, which can reference panel values too.
  • Example index.