Get properties / Set properties work like their variable counterparts:
one port per chosen property, an unconnected input writes its inline
value. A port chosen from the built-in list keeps that property's field
and default (height starts at 100, color is a colour field). "object" is
reserved for the fixed input, checked by the command and on load.
The property picker names the owning type ("Sprite width"), and text
fields can now carry a suggestion list; Get/Set property use it.
Double-clicking a call node shows the path of opened behaviors under the
graph header. Clicking an entry jumps back and trims the path; choosing
a behavior any other way hides it. Reopening a behavior already on the
path steps back to it instead of repeating it. The bar shows before the
graph switches, otherwise it clips the graph that was just fitted.
The "Add node..." header button is gone; nodes come from the context menu.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
/**
|
||
* The behaviors entered by double-clicking call nodes, root first. Either empty or at least two
|
||
* long, and always ending at the behavior the graph shows – anything else opened it otherwise.
|
||
*/
|
||
export type Trail = readonly string[];
|
||
|
||
/** Opening `to` from a call node in `from`. A behavior already on the trail is a step back to it. */
|
||
export function descend(trail: Trail, from: string, to: string): Trail {
|
||
const base = trail.at(-1) === from ? trail : [from];
|
||
const known = base.indexOf(to);
|
||
return known >= 0 ? backTo(base, known) : [...base, to];
|
||
}
|
||
|
||
/** Clicking crumb `index`; back at the root there is nothing left to show. */
|
||
export function backTo(trail: Trail, index: number): Trail {
|
||
const next = trail.slice(0, index + 1);
|
||
return next.length > 1 ? next : [];
|
||
}
|
||
|
||
/** What survives the graph showing `shown`: only a trail that still leads there, every step still alive. */
|
||
export function follow(trail: Trail, shown: string, exists: (id: string) => boolean): Trail {
|
||
return trail.at(-1) === shown && trail.every(exists) ? trail : [];
|
||
}
|