Open clips and frames from the asset panel by double click (#430)
A double click on a clip row did not open its tab. The first click of the double click had already selected the clip for the inspector, so the second click selected the same thing again and the editor saw no change. Frames of textures and pixel art had no rows at all. - A double click now asks for the tab with openSelection, even when the selection is already right. - Textures with frames and pixel art with more than one frame get a chevron and one row per frame, like sounds and videos. Which rows an asset has is decided in one place, src/core/model/assetParts.ts, used by the panel and the inspector link. - A texture frame shows in the inspector on click and opens the texture with the frame selected on double click. - A pixel art frame selects the pixel art on click, so an open tab paints on that frame. A double click opens the tab on the frame. - A frame can be dragged onto a composition track like a video clip. The item carries the sprite of the whole image, the frame becomes the texture of its object, and it is 3 s long. The agent can do the same with add_composition_item. - A texture label that names a frame now points at the frame row. Found on the way: the e2e check from #425 only double clicked the texture label, where the first click is a ping, so the bug never showed there. Tests: - Unit: asset-parts (new, 6), composition-sprites and references extended, related tests 303/303, agent tests 21/21 - 5 mutations, all red in the matching test - e2e 69 (atx): ALL PASSED, 26 checks, 69t new - Gate (atx): CHECK EXIT 0, 325 files, 5017 tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
37779a2070
commit
2e4c0a09ea
15 files changed
+405
-77
No files matched your search
@@ -830,6 +830,69 @@ export async function compositionTab(t) {
|
||||
JSON.stringify({ refolded, textureLink, clipPing, clipOpened }),
|
||||
);
|
||||
|
||||
// 69t (#430). A double-click on a clip's row opens its video, though its first press has picked the
|
||||
// clip already. The frames of a texture, and of pixel art with more than one, have rows too: a
|
||||
// double-click opens the texture with the frame picked, or the pixel art painting on that frame, and
|
||||
// one click there switches the frame. A frame dragged onto a track is an item wearing the texture's
|
||||
// sprite with the frame as its texture.
|
||||
await mutate(`
|
||||
const p = __gm.state.project;
|
||||
p.assets.push({ id: 'ct69-sheet', type: 'texture', name: 'Sheet 69', props: {}, file: '', width: 64, height: 32,
|
||||
frames: [{ id: 'ct69-f1', name: 'Run', x: 16, y: 0, w: 16, h: 16 }] });
|
||||
p.assets.push({ id: 'ct69-art', type: 'pixelart', name: 'Art 69', props: {}, width: 8, height: 8,
|
||||
layers: [{ id: 'ct69-layer', name: 'Layer 1', opacity: 1 }],
|
||||
frames: [{ id: 'ct69-p1', cels: {} }, { id: 'ct69-p2', cels: {} }] });`);
|
||||
/** Double-clicks a part's row from the scene tab, its asset unfolded first as a user would. */
|
||||
const openRow = async (id) => {
|
||||
await showTab('scene');
|
||||
await sleep(200);
|
||||
const row = await json(`__gm.assetRow(${JSON.stringify(id)})`);
|
||||
if (row) await t.doubleClick(row.x, row.y);
|
||||
await sleep(300);
|
||||
return { selection: await json('__gm.state.selection'), active: (await json('__gm.documents()')).active };
|
||||
};
|
||||
const clipRow = await openRow('ct69-vclip');
|
||||
const frameRow = await openRow('ct69-f1');
|
||||
const pixelRow = await openRow('ct69-p2');
|
||||
const paintedOn = await json('__gm.pixelArt.frameId()');
|
||||
const firstRow = await json(`__gm.assetRow('ct69-p1')`);
|
||||
if (firstRow) await t.click(firstRow.x, firstRow.y);
|
||||
await sleep(300);
|
||||
const switched = {
|
||||
frame: await json('__gm.pixelArt.frameId()'),
|
||||
active: (await json('__gm.documents()')).active,
|
||||
};
|
||||
await evaluate(`__gm.state.openAsset('${CUT}')`);
|
||||
await sleep(300);
|
||||
const frameDrop = await dragClip('ct69-f1', await json(`__gm.composition.laneAt('ct69-t1', 100)`));
|
||||
const framed = await json(`(() => {
|
||||
const c = __gm.state.project.assets.find((a) => a.id === '${CUT}');
|
||||
const item = c.items.find((i) => i.start === 100);
|
||||
const object = c.objects.find((o) => o.id === item?.id);
|
||||
const sprite = object && __gm.state.project.assets.find((a) => a.id === object.assetId);
|
||||
return { overrides: object?.overrides ?? null, texture: sprite?.props.texture ?? null };
|
||||
})()`);
|
||||
check(
|
||||
'a double-click on a clip or frame row opens its asset with it picked, and a frame lands on a track',
|
||||
clipRow.selection?.kind === 'clip' &&
|
||||
clipRow.selection.clipId === 'ct69-vclip' &&
|
||||
clipRow.active === `asset:${VIDEO}` &&
|
||||
frameRow.selection?.kind === 'frame' &&
|
||||
frameRow.selection.frameId === 'ct69-f1' &&
|
||||
frameRow.active === 'asset:ct69-sheet' &&
|
||||
pixelRow.selection?.kind === 'asset' &&
|
||||
pixelRow.selection.assetId === 'ct69-art' &&
|
||||
pixelRow.active === 'asset:ct69-art' &&
|
||||
paintedOn === 'ct69-p2' &&
|
||||
switched.frame === 'ct69-p1' &&
|
||||
switched.active === 'asset:ct69-art' &&
|
||||
frameDrop?.what === 'item' &&
|
||||
frameDrop.rejection === '' &&
|
||||
framed.overrides?.texture === 'ct69-f1' &&
|
||||
framed.texture === 'ct69-sheet',
|
||||
JSON.stringify({ clipRow, frameRow, pixelRow, paintedOn, switched, frameDrop, framed }),
|
||||
);
|
||||
|
||||
await showTab('scene');
|
||||
await mutate(`
|
||||
const p = __gm.state.project;
|
||||
|
||||
Reference in new issue
Block a user