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
@@ -6,12 +6,14 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
CreateAssetCommand,
|
||||
CreateTextureCommand,
|
||||
CreateVideoCommand,
|
||||
DeleteAssetCommand,
|
||||
DuplicateAssetCommand,
|
||||
MakeProjectAssetCommand,
|
||||
} from '../../src/core/commands/assetCommands';
|
||||
import { AddClipCommand } from '../../src/core/commands/clipCommands';
|
||||
import { AddFrameCommand } from '../../src/core/commands/frameCommands';
|
||||
import type { Command } from '../../src/core/commands/Command';
|
||||
import { pasteCompositionItems, removeFromComposition } from '../../src/core/commands/compositionCommands';
|
||||
import {
|
||||
@@ -150,7 +152,7 @@ describe('a clip of a video laid on a track (#425)', () => {
|
||||
const film = withClip();
|
||||
expect(droppedPicture(film.project, film.clipId)).toEqual({
|
||||
picture: film.videoId,
|
||||
clip: film.clipId,
|
||||
part: film.clipId,
|
||||
name: 'Intro',
|
||||
});
|
||||
expect(droppedLength(film.project, film.comp(), film.clipId)).toBe(120);
|
||||
@@ -185,6 +187,47 @@ describe('a clip of a video laid on a track (#425)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('a frame of a picture laid on a track (#430)', () => {
|
||||
const withFrames = () => {
|
||||
const film = makeFilm();
|
||||
const texture = new CreateTextureCommand('Sheet', {
|
||||
file: `${'ab'.repeat(32)}.png`,
|
||||
width: 64,
|
||||
height: 32,
|
||||
});
|
||||
const art = new CreateAssetCommand('pixelart', 'Art');
|
||||
film.run(texture);
|
||||
film.run(art);
|
||||
const frame = new AddFrameCommand(texture.asset.id, { x: 16, y: 0, w: 16, h: 16 }, 'Run');
|
||||
film.run(frame);
|
||||
const pixel = findAssetOf(film.project, art.asset.id, 'pixelart')!;
|
||||
pixel.frames.push({ id: 'second', cels: {} });
|
||||
return { ...film, textureId: texture.asset.id, frameId: frame.frameId, art: pixel };
|
||||
};
|
||||
|
||||
it('wears the sprite of its texture with the frame as the texture, 3 s long', () => {
|
||||
const film = withFrames();
|
||||
expect(droppedPicture(film.project, film.frameId)).toEqual({
|
||||
picture: film.textureId,
|
||||
part: film.frameId,
|
||||
name: 'Sheet',
|
||||
});
|
||||
expect(droppedLength(film.project, film.comp(), film.frameId)).toBe(180);
|
||||
const whole = film.drop(0, film.filmId, film.textureId);
|
||||
const cut = film.drop(200, film.filmId, film.frameId);
|
||||
expect(film.sprites()).toHaveLength(1);
|
||||
expect(film.wornBy(film.comp(), cut)).toBe(film.wornBy(film.comp(), whole));
|
||||
expect(film.comp().objects.find((o) => o.id === cut)!.overrides).toEqual({ texture: film.frameId });
|
||||
});
|
||||
|
||||
it('of pixel art wears the sprite of its first frame, and the first frame needs no override', () => {
|
||||
const film = withFrames();
|
||||
const first = film.art.frames[0]!.id;
|
||||
expect(droppedPicture(film.project, 'second')).toEqual({ picture: first, part: 'second', name: 'Art' });
|
||||
expect(droppedPicture(film.project, first)).toEqual({ picture: first, part: null, name: 'Art' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('a copied item', () => {
|
||||
it('pasted after a cut wears its sprite again', () => {
|
||||
const film = makeFilm();
|
||||
|
||||
@@ -110,15 +110,24 @@ describe('referencedAssetId', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('referencedTarget (#425)', () => {
|
||||
describe('referencedTarget (#425, #430)', () => {
|
||||
it('is the clip itself for a clip of a video or a sound, the asset for anything else', () => {
|
||||
const f = withClips();
|
||||
expect(referencedTarget(f.project, TEXTURE, f.videoClip)).toBe(f.videoClip);
|
||||
expect(referencedTarget(f.project, SOUND, f.soundClip)).toBe(f.soundClip);
|
||||
expect(referencedTarget(f.project, TEXTURE, f.videoId)).toBe(f.videoId);
|
||||
expect(referencedTarget(f.project, TEXTURE, f.frameId)).toBe(f.textureId);
|
||||
expect(referencedTarget(f.project, SHADER, f.videoClip)).toBeNull();
|
||||
});
|
||||
|
||||
it('is the frame itself for a frame of a texture, and for one of pixel art with more than one', () => {
|
||||
const f = setup();
|
||||
expect(referencedTarget(f.project, TEXTURE, f.frameId)).toBe(f.frameId);
|
||||
const only = f.art.frames[0]!.id;
|
||||
expect(referencedTarget(f.project, TEXTURE, only)).toBe(f.art.id);
|
||||
f.art.frames.push({ id: 'second', cels: {} });
|
||||
expect(referencedTarget(f.project, TEXTURE, 'second')).toBe('second');
|
||||
expect(referencedTarget(f.project, TEXTURE, only)).toBe(only);
|
||||
});
|
||||
});
|
||||
|
||||
describe('referencesOf', () => {
|
||||
|
||||
Reference in new issue
Block a user