Principle:8beeeaaat Touchdesigner mcp Parameter Binding
| Knowledge Sources | |
|---|---|
| Domains | Parameters, Node_Graph |
| Last Updated | 2026-10-28 22:13 GMT |
Overview
A discipline for writing property values onto a live node by first attempting parameter binding (`par.val`) and falling back to scalar attribute assignment (`setattr`), tracking each outcome as updated or failed so the caller knows exactly what took effect.
Description
In a real-time node graph, a node's state is exposed through two surfaces: parameters (the `par` collection, each with a `.val` setter) and scalar attributes (direct Python attributes on the OP object). Writing a value requires deciding which surface to target. This principle addresses:
- Parameter-first binding: for each property name, first check `hasattr(node.par, name)`. If it matches and the parameter has a `.val`, set `par.val = value`. This is the primary path — parameters are the designed mutation surface.
- Scalar attribute fallback: if the name is not a parameter but is a direct attribute of the node and its current value is a scalar (`int`, `float`, `str`), use `setattr(node, name, value)`. This covers cases like `nodeX`, `nodeY`, `nodeWidth`, `nodeHeight` which are attributes, not parameters.
- Per-property outcome tracking: each property is recorded as either "updated" (success) or "failed" with a reason. A property fails if it is not found, is not settable, or raises during assignment. The aggregate result includes both lists so the caller can see exactly what took effect and what did not.
- All-or-nothing failure: if no properties were updated, the operation returns an error result. If some succeeded, it returns success with the failed list.
Usage
Use this principle when:
- Updating a node's parameters after creation (e.g. setting `text="Hello"` on a `textTOP`).
- Writing scalar attributes like `nodeX`/`nodeY` for explicit positioning.
- Applying a batch of property updates and needing to know which ones failed.
Theoretical Basis
# Abstract algorithm description (NOT real implementation)
updated, failed = [], []
for name, value in properties.items():
if has_par(node, name) and has_val(node.par[name]):
node.par[name].val = value
updated.append(name)
elif is_scalar_attr(node, name):
setattr(node, name, value)
updated.append(name)
else:
failed.append({"name": name, "reason": "not found or not settable"})
if updated:
return success({updated, failed, message})
else:
return error("no properties updated")
The key invariant: parameter binding is attempted before attribute assignment, and the outcome of each is tracked separately.