Let a Sequence grow an output as you connect the last one
The Outputs setting is gone. A Sequence now keeps one free output below the last connected one: nothing plugged in is one output, connecting the spare grows a new one, unplugging the bottom edge shrinks it back. It counts the last *connected* port rather than the number of edges, so unplugging a middle one leaves a gap instead of silently dropping an edge. Removing the setting also removes a bug it caused. Typing in the Outputs field did nothing and the arrow keys did nothing, while dragging the value worked: onInput fires per keystroke, the preview writes into node.params, that emits 'project', and Inspector.refreshValues() sees the node's signature change -- the port list is part of it -- so it rebuilds and destroys the row being typed in. A drag survives because it keeps receiving globalpointermove on the old widget. refreshValues() has no focus guard where refreshLive() does; the trap is still there for the next typed field that changes a node's shape. Ports that depend on the edges around a node mean derivePorts needs the graph, not just the params, so resolveDef and portSignature take it too. And a node whose ports are derived cannot know how many it has from its type, so run is handed the definition resolved for it.
This commit is contained in:
1 parent
b6a609ae24
commit
3c76106fd2
15 files changed
+159
-111
No files matched your search
+13
-1
@@ -11,6 +11,7 @@ import {
|
||||
type PointerState,
|
||||
type Value,
|
||||
requireNodeDef,
|
||||
type RunResult,
|
||||
} from '../src/core/graph';
|
||||
import type { BehaviorAsset, SceneAsset } from '../src/core/model/Asset';
|
||||
import { findObject, worldPosition } from '../src/core/model/hierarchy';
|
||||
@@ -176,6 +177,17 @@ export function fakeContext(overrides: Partial<NodeContext> = {}): FakeContext {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/** Runs a node on its registered definition: the shape it has while sitting in no graph. */
|
||||
export function runDef(
|
||||
type: string,
|
||||
ctx: NodeContext,
|
||||
inputs: Record<string, Value>,
|
||||
params: PropertyBag = {},
|
||||
): RunResult {
|
||||
const def = requireNodeDef(type);
|
||||
return def.run!(ctx, inputs, params, def);
|
||||
}
|
||||
|
||||
/** Runs one node definition in isolation and returns its data outputs. */
|
||||
export function runNode(
|
||||
type: string,
|
||||
@@ -183,7 +195,7 @@ export function runNode(
|
||||
params: PropertyBag = {},
|
||||
ctx: NodeContext = fakeContext(),
|
||||
): Record<string, Value> {
|
||||
return requireNodeDef(type).run!(ctx, inputs, params).outputs ?? {};
|
||||
return runDef(type, ctx, inputs, params).outputs ?? {};
|
||||
}
|
||||
|
||||
export interface WorldOptions {
|
||||
|
||||
Reference in new issue
Block a user