Measure a deviation against the base, not the innermost template
An instance edit was dropped as soon as its value matched the template object. With nested containers the template is not what the value falls back to: the outer container holds an edit for the object below it, and that one wins. If the inner template happened to carry the same value the user typed, the edit was thrown away and the value jumped to whatever the container in between says. Reported against the Jump-and-Run project: a coin narrowed to 8 inside "level", then set back to the sprite's own 24 in the scene, snapped back to 8. Reproduced through the inspector before touching anything. InstanceTarget now offers `base`: the template with the edits of every container in between woven in. Everything that judges deviation uses it - setOverride/setName/setPosition, both Revert commands, and the gold marks in the inspector. Writing still goes into the real template, which is where "apply to container" belongs. `base` is built on every read. Apply writes into the template and then asks whether the edit still deviates, so a base captured beforehand would answer for the template as it was - the e2e suite caught exactly that. Also in here, because it corrects the commit before it: placing an asset by double-clicking its row is gone, as asked for in asset-doppelklick.md. Dragging is the only way to place now. That took AssetPanel.place, the PlacementTarget interface, Editor.placementTarget and the two worldCenter() methods that existed only to feed it. A double-click on a scene asset still makes it the active scene.
This commit is contained in:
1 parent
75d377af39
commit
d7c8d3e579
16 files changed
+180
-77
No files matched your search
@@ -487,12 +487,12 @@ function markObjectRows(
|
||||
for (const axis of POSITION_AXES)
|
||||
host.fields
|
||||
.get(axis)
|
||||
?.setModified(Boolean(target) && object.position[axis] !== target!.template.position[axis]);
|
||||
?.setModified(Boolean(target) && object.position[axis] !== target!.base.position[axis]);
|
||||
for (const axis of OFFSET_AXES)
|
||||
host.fields.get(offsetKey(axis))?.setModified(object.editorOffset[axis] !== 0);
|
||||
for (const def of schemaForAsset(asset)) {
|
||||
const deviates = target
|
||||
? deviatesFromTemplate(object, target.template, def.key)
|
||||
? deviatesFromTemplate(object, target.base, def.key)
|
||||
: deviatesFromAsset(object, asset, def.key);
|
||||
host.fields.get(def.key)?.setModified(deviates);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ function deviations(
|
||||
const target = targetOf(state.project, holderId, objectId);
|
||||
const fromAsset = deviatesFromAsset(object, asset, key);
|
||||
return {
|
||||
template: Boolean(target) && deviatesFromTemplate(object, target!.template, key),
|
||||
template: Boolean(target) && deviatesFromTemplate(object, target!.base, key),
|
||||
asset: !target && fromAsset,
|
||||
applyToAsset: fromAsset,
|
||||
};
|
||||
@@ -531,7 +531,7 @@ function positionMoved(
|
||||
): boolean {
|
||||
const target = targetOf(state.project, holderId, objectId);
|
||||
const object = currentRef(state, holderId, objectId)?.object;
|
||||
return Boolean(target && object) && object!.position[axis] !== target!.template.position[axis];
|
||||
return Boolean(target && object) && object!.position[axis] !== target!.base.position[axis];
|
||||
}
|
||||
|
||||
function currentRef(
|
||||
|
||||
Reference in new issue
Block a user