Give unconnected node inputs the default the node shows (#234)
A new node handed null to every unconnected input that had no port default, even a Bool. The inspector showed false, 0, "" or an empty list at the same time, so what the node read was not what the editor said. 97 of 135 inputs of the built-in nodes were affected. - inlineValue() falls back to the default the inspector shows. One place covers every node, also future ones and saved projects. - A default list is handed out as a fresh copy per read, so a node that edits its input in place cannot change the shared default. - The node shows the value it reads: an empty text or list as (empty), an object or struct input without a link as (null). Live values while playing use the same words. - A key input without a key keeps showing a dash, like the key field in the inspector. - Visible changes in old projects: To text without input gives "" instead of "0", Select and First not empty give "" instead of null. Tests: - 8 new unit tests in tests/core/inline-defaults.test.ts, among them one over all built-in nodes that no typed-in input reads null. - The e2e check in module 6 reads the rows of an unlinked Name of node. The check sum stays the same. - ./check.sh: 167 files, 2434 tests, exit 0. e2e 6: 117 checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b44f97c35
commit
1d18862ed6
4 files changed
+149
-10
No files matched your search
@@ -946,6 +946,7 @@ export async function graph(t) {
|
||||
{ id: 'p-text', type: 'String', x: 0, y: 300, params: { value: 'hi' } },
|
||||
{ id: 'p-pick', type: 'FirstNotEmpty', x: 300, y: 60, params: {} },
|
||||
{ id: 'p-sub', type: 'Substring', x: 600, y: 60, params: {} },
|
||||
{ id: 'p-name', type: 'NameOf', x: 600, y: 300, params: {} },
|
||||
],
|
||||
edges: [],
|
||||
},
|
||||
@@ -959,6 +960,20 @@ export async function graph(t) {
|
||||
(await pickTypes()).outputs.value === 'any',
|
||||
JSON.stringify(await pickTypes()),
|
||||
);
|
||||
// An untouched input shows the value the node computes with: empty text reads "(empty)", a
|
||||
// number 0, and an object with nothing plugged in "(null)".
|
||||
const untouched = {
|
||||
pick: await json(`__gm.graph.nodeInputs('p-pick')`),
|
||||
sub: await json(`__gm.graph.nodeInputs('p-sub')`),
|
||||
name: await json(`__gm.graph.nodeInputs('p-name')`),
|
||||
};
|
||||
check(
|
||||
'untouched inputs show their default beside the name: (empty), 0 and (null) for an object',
|
||||
JSON.stringify(untouched.pick) === JSON.stringify(['a (empty)', 'b (empty)']) &&
|
||||
JSON.stringify(untouched.sub) === JSON.stringify(['text (empty)', 'start 0', 'count -1']) &&
|
||||
JSON.stringify(untouched.name) === JSON.stringify(['object (null)']),
|
||||
JSON.stringify(untouched),
|
||||
);
|
||||
|
||||
const wire = async (fromNode, fromPort, toNode, toPort) => {
|
||||
const from = await json(
|
||||
|
||||
Reference in new issue
Block a user