Help pages named the raw widget (divisible_by, max_frames, color_match) where the card shows a label (Multiple, Limit, Tone match), so a reader could not find the control. Each such control now reads as the visible label with the widget name beside it, and option values show the text on the segment (match a, hist, cover, guided).
1.4 KiB
1.4 KiB
Math Expression
Evaluates one arithmetic expression over the inputs a, b and c and
returns the result as both FLOAT and INT — width and height math,
strength ramps, frame counts.
Controls
- f(a, b, c) (
expression): The arithmetic to evaluate. Allowed: numbers, the namesa/b/c, the operators+ - * / // % **, parentheses, unary minus, and the functionsmin,max,abs,round,floor,ceil,sqrt. Examples:a * 2,floor(a / 64) * 64,min(a, b) + 0.5,sqrt(a*a + b*b). - a, b, c: The values the expression reads, as three sockets on
the node's left edge that take a
FLOATor anINT. An unwired one reads as0, and an unused one costs nothing; a constant belongs in the expression itself (a * 2,floor(a / 64) * 64).
Outputs
- float: The result as a float.
- int: The result rounded to the nearest whole number; halves round away
from zero (
2.5becomes3,-2.5becomes-3).
Safety
The expression is parsed with Python's ast module and walked against a
whitelist — it is never passed to eval. Anything outside the grammar above
(other names, attribute access, subscripts, strings, comparisons) stops the
run with an error naming what to remove, so a workflow shared by someone else
cannot smuggle code through this node. Division by zero and overflowing
results are clear errors rather than a crash or an inf traveling
downstream.