Replace the five variable nodes with one Variables node
A single node now lists any number of variables. Every entry is an output that reads the current value whenever it is pulled; an entry switched to Set is also an input and is written when the flow arrives. Exec pins only exist while at least one entry writes, and all inputs are read before any write, so one node can swap two variables. Get/Set variable, Get/Set variables and Variable are gone. Old project files are converted on load: each old node becomes a Variables node with the same variables, edges and typed values. A written port without a typed value now shows the zero of its kind on the node body, matching what the inspector shows and what the run writes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
854ae2e756
commit
7c63c884ef
40 files changed
+895
-590
No files matched your search
@@ -75,9 +75,10 @@ export interface NodeDef {
|
||||
hiddenParams?(params: PropertyBag): string[];
|
||||
/**
|
||||
* Which side the ports this node declares for itself (`GraphNode.ports`) appear on. Setting it
|
||||
* is what gives a node the port editor in the inspector.
|
||||
* is what gives a node the port editor in the inspector. `both`: every port is an output, and an
|
||||
* input as well where it is marked `write`.
|
||||
*/
|
||||
declaresPorts?: 'inputs' | 'outputs';
|
||||
declaresPorts?: 'inputs' | 'outputs' | 'both';
|
||||
/** How a declared port becomes a port; without it, named after its key and typed by its kind. */
|
||||
declaredPort?(port: DeclaredPort): PortDef;
|
||||
/**
|
||||
@@ -132,7 +133,16 @@ export function hasExecInput(def: NodeDef): boolean {
|
||||
* struct is assembled from its parts, so neither has a value that could be typed on one line.
|
||||
*/
|
||||
export function inlineInputs(def: NodeDef): PortDef[] {
|
||||
return def.inputs.filter((p) => p.type !== 'exec' && p.type !== 'object' && p.type !== 'struct');
|
||||
return def.inputs.filter(isInlinePort);
|
||||
}
|
||||
|
||||
function isInlinePort(port: PortDef): boolean {
|
||||
return port.type !== 'exec' && port.type !== 'object' && port.type !== 'struct';
|
||||
}
|
||||
|
||||
/** Untyped, an input writes the zero of its kind; as its default the node body shows it, not just the name. */
|
||||
export function withInlineDefault(port: PortDef): PortDef {
|
||||
return isInlinePort(port) ? { ...port, default: inlineInputDef(port).default } : port;
|
||||
}
|
||||
|
||||
export function inlineInputDef(port: PortDef): PropertyDef {
|
||||
|
||||
Reference in new issue
Block a user