Make texture and colour full kinds and drop the load-time migrations
- `Texture` and `Color` can be picked as a variable kind, a struct field kind and a declared port kind; a new `Texture` node hands a picture id into the graph. Declared, a texture is its bare id – the `$texture` tag stays a list-only thing. - The `String` node is labelled "Text" like its kind; the type id stays. - Whole-number inputs (`Item at`, `Set item`, `Sub list`, `Fill`, `Repeat`, `Substring`, `To text`) show no decimals (`int()` in shared.ts). - All server projects are reseeded, so `legacyNodes.ts`, `migrateDeclaredLists` and the `ownerId` fallback go, with their tests. - Note `reseed-because-of-list` moved to done/; new note `refactor-types`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
11c900c998
commit
8a7185948d
39 files changed
+378
-765
No files matched your search
@@ -262,9 +262,9 @@ export async function variableNodes(t) {
|
||||
await sleep(300);
|
||||
const seeded = await portsOf('vp-pack');
|
||||
check(
|
||||
'picking a struct variable declares every field at once, a color among them as a number',
|
||||
'picking a struct variable declares every field at once, each of its own kind',
|
||||
JSON.stringify(seeded) ===
|
||||
'[{"key":"shape","kind":"number"},{"key":"tint","kind":"number"},{"key":"cells","kind":"list"}]',
|
||||
'[{"key":"shape","kind":"number"},{"key":"tint","kind":"color"},{"key":"cells","kind":"list"}]',
|
||||
JSON.stringify(seeded),
|
||||
);
|
||||
check('and the node grew those inputs', Boolean(await portAt('vp-pack', 'cells', false)));
|
||||
|
||||
@@ -14,7 +14,7 @@ const logicGraph = {
|
||||
node('pp-owner', 'Owner', 0, 240),
|
||||
node('pp-set', 'Properties', 260, 0, { ...propertiesOf('sprite'), width: 40, color: 0xff0000 }, [
|
||||
written('width', 'number'),
|
||||
written('color', 'number'),
|
||||
written('color', 'color'),
|
||||
]),
|
||||
node('pp-store', 'Variables', 560, 0, {}, [written('seen', 'number')]),
|
||||
node('pp-any', 'Properties', 260, 420),
|
||||
@@ -152,7 +152,7 @@ export async function propertyNodes(t) {
|
||||
const grown = await portsOf('pp-set');
|
||||
check(
|
||||
'picking a property adds it as an output',
|
||||
grown.join(',') === 'width:number:set,color:number:set,height:number',
|
||||
grown.join(',') === 'width:number:set,color:color:set,height:number',
|
||||
grown.join(','),
|
||||
);
|
||||
const toggle = await json(`__gm.inspectorField('Set', true)`);
|
||||
@@ -196,7 +196,7 @@ export async function propertyNodes(t) {
|
||||
const kinds = await offered();
|
||||
check(
|
||||
'Any offers the kinds to pick from, not property names',
|
||||
['Number', 'Text', 'Boolean', 'List', 'Struct'].every((k) => kinds.includes(k)) &&
|
||||
['Number', 'Text', 'Boolean', 'Color', 'Texture', 'List', 'Struct'].every((k) => kinds.includes(k)) &&
|
||||
!kinds.includes('width'),
|
||||
kinds.join(' | '),
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ const logicGraph = (walkId) => ({
|
||||
node('an-add', 'Add', 300, 200, { b: 1 }),
|
||||
node('an-owner', 'Owner', 300, 360),
|
||||
node('an-wear', 'Properties', 600, 0, { ...propertiesOf('sprite'), texture: 'an-run' }, [
|
||||
written('texture', 'text'),
|
||||
written('texture', 'texture'),
|
||||
]),
|
||||
],
|
||||
edges: [
|
||||
@@ -398,6 +398,43 @@ export async function animation(t) {
|
||||
JSON.stringify({ texture: worn?.props.texture, clock: worn?.animation, after }),
|
||||
);
|
||||
|
||||
// 25l'. A picture is a kind of its own: the Texture node hands one into the graph, and a
|
||||
// variable may be one. Both are picked, never typed.
|
||||
const pickPicture = async (label, name) => {
|
||||
const field = await json(`__gm.inspectorField(${JSON.stringify(label)}, true)`);
|
||||
await click(field.x, field.y);
|
||||
await sleep(200);
|
||||
await typeText(name);
|
||||
await sleep(150);
|
||||
await press('Enter');
|
||||
await sleep(300);
|
||||
};
|
||||
await mutate(`
|
||||
const logic = __gm.state.project.assets.find((a) => a.id === 'an-logic');
|
||||
logic.graph.nodes.push(${JSON.stringify(node('an-pic', 'Texture', 600, 300))});
|
||||
logic.variables.push(${JSON.stringify(variable('pic', 'texture', ''))});
|
||||
logic.props.pic = '';
|
||||
__gm.state.select({ kind: 'node', assetId: 'an-logic', nodeId: 'an-pic', nodeIds: ['an-pic'] });
|
||||
`);
|
||||
await sleep(400);
|
||||
await pickPicture('Value', walk.name);
|
||||
const picNode = (await t.asset('an-logic')).graph.nodes.find((n) => n.id === 'an-pic');
|
||||
const picRows = (await json("__gm.graph.nodeSettings('an-pic')")) ?? [];
|
||||
check(
|
||||
'the Texture node picks its picture and shows it by name',
|
||||
picNode?.params.value === walk.id && picRows.some((r) => r.includes(walk.name)),
|
||||
JSON.stringify({ params: picNode?.params, rows: picRows }),
|
||||
);
|
||||
await evaluate("__gm.state.select({ kind: 'asset', assetId: 'an-logic' })");
|
||||
await sleep(400);
|
||||
await pickPicture('pic', walk.name);
|
||||
check(
|
||||
'a texture variable is picked with the same picker',
|
||||
(await t.asset('an-logic')).props.pic === walk.id,
|
||||
JSON.stringify((await t.asset('an-logic')).props),
|
||||
);
|
||||
await shot('04b-texture-kind');
|
||||
|
||||
// 25m. Deleting the texture counts the animations that play its frames.
|
||||
const again = await json(`__gm.assetRow(${JSON.stringify(strip)})`);
|
||||
await click(again.x, again.y, 'right');
|
||||
|
||||
@@ -148,8 +148,8 @@ const nodes = [
|
||||
]),
|
||||
node('pick-walk', 'ItemAt', 1680, 1430),
|
||||
node('pick-idle', 'ItemAt', 1680, 1640),
|
||||
node('wear-walk', 'Properties', 1920, 1280, propertiesOf('sprite'), [written('texture', 'text')]),
|
||||
node('wear-idle', 'Properties', 1920, 1510, propertiesOf('sprite'), [written('texture', 'text')]),
|
||||
node('wear-walk', 'Properties', 1920, 1280, propertiesOf('sprite'), [written('texture', 'texture')]),
|
||||
node('wear-idle', 'Properties', 1920, 1510, propertiesOf('sprite'), [written('texture', 'texture')]),
|
||||
];
|
||||
|
||||
const edges = [
|
||||
|
||||
@@ -440,7 +440,7 @@ function drawBoardGraph() {
|
||||
g.at('show', 'Properties', 6, 0, propertiesOf('sprite'), [written('enabled', 'boolean')]);
|
||||
g.at('br', 'Branch', 7, 0);
|
||||
g.at('color', 'ItemAt', 7, 4);
|
||||
g.at('paint', 'Properties', 8, 0, propertiesOf('sprite'), [written('color', 'number')]);
|
||||
g.at('paint', 'Properties', 8, 0, propertiesOf('sprite'), [written('color', 'color')]);
|
||||
g.link('start', 'grid', 'cell', 'list');
|
||||
g.link('loop', 'index', 'cell', 'index');
|
||||
g.link('cell', 'item', 'filled', 'a');
|
||||
@@ -656,7 +656,7 @@ function drawPieceGraph() {
|
||||
at('place', 'SetPosition', 6, 0);
|
||||
at('paint', 'Properties', 7, 0, { ...propertiesOf('sprite'), enabled: true }, [
|
||||
written('enabled', 'boolean'),
|
||||
written('color', 'number'),
|
||||
written('color', 'color'),
|
||||
]);
|
||||
link('cell', 'exec', 'place', 'exec');
|
||||
for (const id of ['place', 'paint']) link(object, 'object', id, 'object');
|
||||
|
||||
Reference in new issue
Block a user