feat: a backwards wire re-sorts the graph instead of being refused

The evaluator walks the node list in order, which used to make the order the
user's problem -- an input of an earlier node was not even drawn as
connectable. `math_connect()` runs Kahn's algorithm over the trial edge set,
with ties broken by the current index so a graph already in order is not
permuted, and remaps every index the dialog holds in one block. A self wire
and a cycle are refused with a message and change nothing.
This commit is contained in:
Martino Ferrari committed 2026-10-07 02:14:10 +02:00
1 parent 4c726adb54
commit 5ca762031d
3 files changed
+169 -8

No files matched your search

+5
View File
@@ -117,4 +117,9 @@ double math_step(const MathChannel& channel, MathRuntime& rt, const float* value
/// input it needs connected to a node that exists (with `Source` nodes naming something).
bool math_channel_valid(const MathChannel& channel, std::string* why = nullptr);
/// The same check over a bare node list and output index, for a caller that has a graph but not yet
/// a `MathChannel` -- the editor, and the headless probe that drives it.
bool math_channel_valid_nodes(const std::vector<MathNode>& nodes, int output,
std::string* why = nullptr);
} // namespace udpscope