Properties node: name each shader param by its shader (#66)
game-maker / suite (push) Successful in 8m23s

The + Property menu of the Properties node offered every shader's params
for every sprite. Each shader row now carries its shader name, and a name
shared by two shaders lists both: "brightness (Adjust colors, Neon glow)".
Sprite-owned rows stay unlabelled.

The note hangs off a map keyed by the def object, not by the name -- a
sprite property and a shader param may share a name (#63), and keying by
name would label the wrong row.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-13 14:05:01 +02:00
1 parent 05f7a2745e
commit 5c1c3c6fd6
5 files changed
+103 -13

No files matched your search

+50 -3
View File
@@ -43,15 +43,22 @@ export async function propertyNodes(t) {
);
await sleep(300);
};
/** A port section takes its choices when it is built, and re-selecting the same node is a no-op. */
const rebuildInspector = async () => {
await evaluate('__gm.state.select(null)');
await sleep(150);
await select('pp-set');
};
/** The inspector is drawn over the graph, so the last match is the row rather than the port. */
const clickLast = async (text) => {
const p = await locate(text, true);
await click(p.x, p.y);
await sleep(200);
};
const offered = async () => {
const offered = async (shotName) => {
await clickLast('+ Property');
const texts = await json('__gm.overlayTexts()');
if (shotName) await shot(shotName);
await press('Escape');
await sleep(200);
return texts;
@@ -146,6 +153,46 @@ export async function propertyNodes(t) {
sprite.join(' | '),
);
// 24d-ii. Which sprite the node will meet is only known at runtime, so it offers the parameters of
// every shader – each entry saying whose it is, and one shared name naming both shaders.
await mutate(`
__gm.state.project.assets.push({
id: 'pp-neon',
type: 'shader',
name: 'Neon glow',
props: {},
graph: {
nodes: [
{ id: 'pp-n1', type: 'ShaderProperty', x: 0, y: 0, params: { name: 'brightness', default: 1, min: 0, max: 2 } },
{ id: 'pp-n2', type: 'ShaderProperty', x: 0, y: 120, params: { name: 'glow', default: 1, min: 0, max: 2 } },
],
edges: [],
},
});
`);
await rebuildInspector();
const shared = await offered('02-shader-parameters');
check(
'a shader parameter names the shader it comes from, a shared name both of them',
shared.includes('brightness (Adjust colors, Neon glow)') &&
shared.includes('glow (Neon glow)') &&
!shared.includes('brightness') &&
shared.includes('width'),
shared.filter((s) => s.includes('(') || s === 'brightness' || s === 'width').join(' | '),
);
await mutate(`
const list = __gm.state.project.assets;
const i = list.findIndex((a) => a.id === 'pp-neon');
if (i >= 0) list.splice(i, 1);
`);
await rebuildInspector();
const alone = await offered();
check(
'with that shader gone the parameter names only the one left',
alone.includes('brightness (Adjust colors)'),
alone.filter((s) => s.includes('(')).join(' | '),
);
// 24e. Picked, then switched to Set: its typed-in value starts at the property's own default –
// a height of 100, not a bare 0 that would flatten the box.
await addProperty('height');
@@ -164,7 +211,7 @@ export async function propertyNodes(t) {
inputs.includes('height 100'),
JSON.stringify(inputs),
);
await shot('02-height-set');
await shot('03-height-set');
await undo();
await undo();
await sleep(300);
@@ -185,7 +232,7 @@ export async function propertyNodes(t) {
(await portsOf('pp-set')).length === 2 && (await find('"color" is not a property of a Camera.')) !== null,
(await portsOf('pp-set')).join(),
);
await shot('03-camera');
await shot('04-camera');
await undo();
await sleep(300);
check('undo switches back', (await settings('pp-set')).join() === 'Type: Sprite', await settings('pp-set'));