Files
feuerwerk/src/editor/assetTabs.ts
T
adminandClaude Opus 5.5 e435c54afb Edit a composition's tracks, items and clips in its own tab (#417)
A composition could be placed and played, but not filled. Its tab
puts the picture at the playhead above a timeline of tracks, so a cut
or a cutscene is laid out by dragging assets onto tracks.

- The timeline takes the song tab's geometry with frames for ticks:
  ruler in seconds, scrubbing, play and pause, + Track. Zoom and pan
  glide through viewTween like the other tabs.
- A placeable asset dropped on a track becomes an item, 3 s long or
  as long as its sprite's video. Dropped on an item it lands behind.
- Items move without overlapping. The right edge stops at the next
  item. The left edge trims into a video and not before its start.
- An animation dropped on a track becomes a narrower clip bar above
  the item it plays on. The asset panel now starts a drag for
  animations too.
- The picture is a scene view over compositionHolder. A click picks
  an item or its child, a drag moves the real object. It takes no
  assets, since an object there would have no item.
- The hierarchy lists the items alive at the playhead. Reparenting is
  off there, items stay at the top level.
- The inspector shows a TIMING block on an item (start, length,
  offset for a video, Fit to media) and edits tracks and clips.
- Delete, the context menu and Remove item take item and object in
  one undo step.
- fitMedia: an override that gives an item another video sets its
  length in the same undo step, capped at the next item. Dragging an
  edge or typing a length turns it off.
- A composition inside a composition is refused.

Tests:
- Unit composition-edit (new): 19 tests. Four counter-checks each
  turned their test red. The "back to 3 s" test got a step in
  between after one stayed green.
- e2e 69 (new): 11 checks, 9 own. The hierarchy check reads the rows
  shown, after a counter-check on the model's rows stayed green.
- Gate on melektaus-atx: CHECK EXIT 0, 302 files, 4662 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 07:47:22 +02:00

35 lines
1023 B
TypeScript

import type { AssetType } from '../core/model/AssetTypes';
import type { CentreTab } from './Editor';
/** Where an opened asset goes; a placeable one (sprite, camera, text, collider) has no tab of its own. */
export const TAB_OF_ASSET: Partial<Record<AssetType, CentreTab>> = {
scene: 'scene',
behavior: 'graph',
statemachine: 'statemachine',
shader: 'shader',
shaderfunction: 'shader',
particles: 'particles',
sound: 'sound',
video: 'video',
soundfx: 'soundfx',
instrument: 'instrument',
pattern: 'pattern',
song: 'song',
texture: 'texture',
vectorart: 'vectorart',
pixelart: 'pixelart',
animation: 'animation',
curve: 'curve',
tile: 'tile',
container: 'container',
composition: 'composition',
};
/**
* Whether opening an asset of this type brings an editor up. Everything else is only selected, so a
* menu entry that promises to open it is offered greyed out instead.
*/
export function hasAssetEditor(type: AssetType): boolean {
return TAB_OF_ASSET[type] !== undefined;
}