Paint an asset's name gold while any of its values deviates

The inspector already marked an asset value that differs from its schema
default, but the Assets panel gave no hint, so a changed asset looked
like an untouched one until you opened it.

The rule sits next to the existing objectDeviates as a pure function:
assetDeviates asks whether any marked property differs, markedAssetSchema
says which rows the inspector marks at all. buildAssetSection now builds
its rows from that same list, replacing the behavior/rest split it used
to carry, so the list cannot claim a deviation the inspector then fails
to show.

A behavior's variables are deliberately not in it. Their default is
declared on the variable itself, which means the asset value *is* that
default; counting them would paint the fixture's Mover gold while the
inspector beside it marks nothing.
This commit is contained in:
root committed 2026-09-09 15:21:39 +02:00
1 parent e0d43e12aa
commit e9634f0f0d
10 files changed
+166 -15

No files matched your search

+38
View File
@@ -143,4 +143,42 @@ export async function assets(t) {
(await evaluate(`__gm.locate('↺')`))?.y === heightReset.y,
JSON.stringify(await evaluate(`__gm.locate('↺')`)),
);
// 12b. The same gold in the asset list: a row is marked while the asset carries anything the
// inspector marks. The Crate deviates twice, so it takes two resets to turn it plain.
const GOLD = '#f2c84b';
const PLAIN = '#e6e8ee';
const assetColor = (id) => json(`__gm.assetRowColor('${id}')`);
check('a deviating asset is marked gold in the list', (await assetColor('crate')) === GOLD);
check('an asset at its defaults is not', (await assetColor('cam')) === PLAIN, await assetColor('cam'));
// The Mover's `speed` is 200 against a declared variable default of 0. The inspector marks no
// variable, so neither may the list – the two must say the same thing.
check(
'a behavior is not marked for a variable value, which the inspector does not mark either',
(await assetColor('mover')) === PLAIN,
await assetColor('mover'),
);
await click(heightReset.x, heightReset.y);
await sleep(150);
check(
'the mark stays while the second deviation is left',
(await assetColor('crate')) === GOLD,
await assetColor('crate'),
);
const colorOnly = await evaluate(`__gm.locate('↺')`);
await click(colorOnly.x, colorOnly.y);
await sleep(150);
check(
'resetting the last deviation clears the mark, without a reload',
(await assetColor('crate')) === PLAIN,
`${await assetColor('crate')} props=${JSON.stringify((await asset('crate')).props)}`,
);
await shot('15b-asset-marks');
await undo();
await undo();
check(
'undo brings the mark back',
(await assetColor('crate')) === GOLD,
`${await assetColor('crate')} props=${JSON.stringify((await asset('crate')).props)}`,
);
}