Let a node work out its own ports
Ports that vary per node already existed, but only for the three nested-behavior
types, and the rule for them sat as a switch on type names in nested.ts – the
one place in the project that knew node types by name. It dissolves into two
optional contracts on NodeDef, so a type carries its own rule:
declaresPorts the node holds an editable list, shown as a section in the
inspector – behavior start/end, and now Pack/Expand
derivePorts the node computes them from its settings – Sequence from a
count, Run behavior from the behavior it names
Sequence gains an Outputs setting (2 to 26). Its keys stay a, b, c and count on
with d, e, so the edges of the sequences already out there survive.
A param can now take a port away, and the edge on it would stay: it draws as
nothing yet survives every save, and comes back to life if the port returns.
SetNodeParamCommand takes those edges with it, which also closes the same leak
that switching a Run behavior node's target has always had.
The port editor addresses its node by id rather than by type, so two Pack nodes
can live in one graph, and it calls the rows Fields when they are not a
behavior's signature.
This commit is contained in:
1 parent
2cf788eedd
commit
b6a609ae24
23 files changed
+438
-98
No files matched your search
@@ -33,7 +33,7 @@ export const edge = (id, from, fromPort, to, toPort) => ({
|
||||
to: { node: to, port: toPort },
|
||||
});
|
||||
|
||||
/** A graph node; `params` holds settings and inline input values alike. `ports` only on start/end. */
|
||||
/** A graph node; `params` holds settings and inline input values alike. `ports` only on the types that declare them. */
|
||||
export const node = (id, type, x, y, params = {}, ports) => ({
|
||||
id,
|
||||
type,
|
||||
|
||||
Reference in new issue
Block a user