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

+16 -2
View File
@@ -1,9 +1,23 @@
import type { Asset } from '../model/Asset';
import { ancestorIdsOf, type ObjectTree } from '../model/hierarchy';
import { instanceTargetOf, isEmptyEdit, resolveObjects } from '../model/instance';
import { findAsset, type Project } from '../model/Project';
import type { SceneObject } from '../model/SceneObject';
import { schemaForAsset } from './PropertySchema';
import { deviatesFromAsset } from './resolve';
import { COMMON_PROPS, type PropertySchema, schemaForAsset } from './PropertySchema';
import { deviatesFromAsset, isModified } from './resolve';
/**
* The rows the asset inspector marks as modified. A behavior's variables are left out: their
* default is declared on the variable itself, so the asset value cannot differ from it.
*/
export function markedAssetSchema(asset: Asset): PropertySchema {
return asset.type === 'behavior' ? COMMON_PROPS : schemaForAsset(asset);
}
/** Whether any asset property the inspector would mark gold differs from its default. */
export function assetDeviates(asset: Asset): boolean {
return markedAssetSchema(asset).some((def) => isModified(asset, def.key));
}
/**
* Whether a placed object deviates from whatever it follows: the container template it was