Mark overrides in gold instead of bold, and up the hierarchy

An inspector label whose value deviates from its base was drawn bold, which is
easy to miss next to the regular labels and says nothing in the hierarchy, where
a folded subtree could hide a change entirely.

The colour now lives as a theme token (`override`, #f2c84b) used by both the
inspector labels and the hierarchy rows. Whether a row deviates is decided by
`src/core/properties/deviation.ts`: `objectDeviates` compares an object against
what it follows -- the container template for content, the asset otherwise --
and `deviationMarks` carries the mark up to every ancestor, so a folded subtree
still shows that something inside was changed.

`deviationMarks` takes the stored holder, not the resolved one: in the resolved
view container content looks like an ordinary object and `instanceTargetOf`
would compare against the asset, marking every instance.

Covered by 3 unit tests and 5 e2e checks, including one that strips an object's
own overrides to prove the row stays gold for a deviating child and restores
them byte for byte. Full suite remote on the RTX 4070: 275 checks, all passed.
This commit is contained in:
root committed 2026-09-09 10:54:25 +02:00
1 parent 37e1450fca
commit b87fcdfbad
13 files changed
+197 -14

No files matched your search

+23
View File
@@ -14,6 +14,7 @@ export async function inspector(t) {
drag,
press,
typeText,
mutate,
undo,
redo,
state,
@@ -33,6 +34,28 @@ export async function inspector(t) {
);
await shot('02-object-selected');
// 1b. Deviations are shown in gold – on the inspector label and on the hierarchy row. The blue
// crate overrides width and color, the camera and the red crate's subtree nothing.
const GOLD = '#f2c84b';
const PLAIN = '#e6e8ee';
const rowColor = (id) => json(`__gm.hierarchyRowColor('${id}')`);
check('an overridden object is marked gold in the hierarchy', (await rowColor('o2')) === GOLD);
check('an untouched object is not', (await rowColor('o3')) === PLAIN, await rowColor('o3'));
check('nor is a parent whose subtree is untouched', (await rowColor('o1')) === PLAIN);
check(
'the overridden field is gold, an inherited one is not',
(await json(`__gm.textColor('Width')`)) === GOLD &&
(await json(`__gm.textColor('Height')`)) === '#8a90a0',
JSON.stringify(await json(`[__gm.textColor('Width'), __gm.textColor('Height')]`)),
);
// The mark also travels up: with the crate's own overrides taken away the row must stay gold
// for the sake of its collider child, which keeps one. Put back right after, byte for byte.
await mutate(`__gm.state.activeScene.objects.find(o => o.id === 'o2').overrides = {}`);
check('a parent carries the mark of a deviating child', (await rowColor('o2')) === GOLD);
await mutate(
`__gm.state.activeScene.objects.find(o => o.id === 'o2').overrides = { width: 140, color: 0x4488ff }`,
);
// 2. Rename via inspector: the name field sits right of the "Name" label.
const nameLabel = await locate('Name');
await click(nameLabel.x + 160, nameLabel.y);