cinematicEdits
Namespace of @v12-engine/editor
Members
addItem beta
export declare function addItem(def: CinematicDef, laneId: string, item: LaneItem, options?: EditOptions): CinematicEdit;Puts an item on a lane (at its time among the others), selected: where it is free, at its time or the first free one after, cut short to the gap there where it says how long it lasts (a lane's items do not lie over each other)
addLane beta
export declare function addLane(def: CinematicDef, kind: string, options?: {
name?: string;
index?: number;
}): {
def: CinematicDef;
lane: string;
};Adds a lane of a kind at the bottom (or at index): its id its kind, or with a number after it
addMarker beta
export declare function addMarker(def: CinematicDef, at: number, name?: string): CinematicEdit;Puts a marker at a time (marker-1, marker-2... when not named), selected
addStep beta
export declare function addStep(def: CinematicDef, selection: CinematicSelection, options?: EditOptions): CinematicEdit;The items selected made sequences (UnitsClip.steps): what each does becomes its first step, and a second is added to be filled in. An item that is one gets one more step
CINEMATIC_FPS beta
CINEMATIC_FPS = 30How many frames a second the panel counts in, where a game says nothing: the engine's ticks a second
CINEMATIC_ID beta
CINEMATIC_ID: RegExpWhat an id may be: words, digits, dots and dashes, as a file is named (as readCinematic checks it)
CinematicClipboard beta
export interface CinematicClipboardWhat is copied (Ctrl+C): items with their lane's id and kind, and markers, their times from the first of them
CinematicEdit beta
export interface CinematicEditA cinematic after an edit, and what is selected in it
cinematicFile beta
cinematicFile: (id: string) => stringThe file of a cinematic, by its id
CinematicFiles beta
export declare class CinematicFilesThe cinematics of a game as files (cinematics/<id>.json), through editor.files: what is written is a change until the map is saved (Ctrl+S), as every panel's file is. Read with the game's lanes (LaneDef), so that what is wrong in a file is said with its path
cinematicIdOf beta
export declare function cinematicIdOf(path: string): string | undefined;The id of a cinematic from its file's path; nothing for a file that is not one
CINEMATICS_FOLDER beta
CINEMATICS_FOLDER = "cinematics"The folder of a game's cinematics, a file each (cinematics/td.intro.json)
CinematicSelection beta
export interface CinematicSelectionWhat is selected in a cinematic: items of its lanes and its markers (by their place, in order of time)
copySelection beta
export declare function copySelection(def: CinematicDef, selection: CinematicSelection): CinematicClipboard;What is selected, to paste: its times from the first of it
defaultItem beta
export declare function defaultItem(lane: LaneDef | undefined, at: number, context?: {
pose?: unknown;
speaker?: string;
}): LaneItem;A new item of a lane at a time, as a double-click or the lane's + puts one down: a key where the lane keys a value (value: the camera's, the editor's view as it is), else a clip of a second; its fields as its lane's editor lists them, each an empty start (the first speaker, the first of a choice, a point at the corner), so that it reads back
deleteSelection beta
export declare function deleteSelection(def: CinematicDef, selection: CinematicSelection, options?: EditOptions): CinematicEdit;Takes away what is selected (but what is on a locked lane)
duplicateSelection beta
export declare function duplicateSelection(def: CinematicDef, selection: CinematicSelection, dt?: number, options?: EditOptions): CinematicEdit;Copies what is selected, dt seconds later (an Alt-drag's way, which moves them after), or where left out (Ctrl+D) just after the last of it, later still where that is not free on their lanes. The copies are selected
EditOptions beta
export interface EditOptionsHow an edit is done: lanes not to touch (locked), and the lanes' defs (the client's own when left out): how long their clips last where they do not say (LaneDef.length), what of a lane an item takes up (LaneEditor.slot)
fieldOf beta
export declare function fieldOf(item: LaneItem, key: string): unknown;The value of a field of an item, by its key: text, or a field of a field (value.hour, the picture's keys' fields), as the lanes' editors name them (LaneField.key)
freeRefName beta
export declare function freeRefName(def: CinematicDef, name?: string): string;A name for a new ref free among the cinematic's (unit, unit-2...)
groupLanes beta
export declare function groupLanes(def: CinematicDef, ids: readonly string[], group: string | undefined): CinematicDef;Puts lanes in a group, by its name (none: out of any), and the group's lanes side by side: where its first lane is, the others after it in their order
insertTime beta
export declare function insertTime(def: CinematicDef, at: number, seconds: number, options?: EditOptions): CinematicEdit;Time put in at a moment (ripple): what starts at or after it goes on by seconds, markers too; a clip it is in the middle of stays where it starts and lasts as long. Locked lanes are left as they are
itemAt beta
itemAt: (def: CinematicDef, ref: ItemRef) => LaneItem | undefinedThe item a reference points to, or undefined when its lane or place is not there
itemEnd beta
itemEnd: (item: LaneItem, lane?: LaneDef) => numberWhere an item ends: its start, and how long it lasts
itemLength beta
export declare function itemLength(item: LaneItem, lane?: LaneDef): number;How long an item lasts: as it says (for), as its lane measures it (a line's reading time), or not at all (a key, a clip whose end the lane cannot know)
ItemRef beta
export interface ItemRefAn item of a cinematic: its lane's id and its place among the lane's items (in order of time)
itemsInView beta
export declare function itemsInView(items: readonly LaneItem[], from: number, to: number, lane?: LaneDef, margin?: number): {
item: LaneItem;
index: number;
}[];The items of a lane that a view between two times shows (with margin seconds either side): only those are drawn, however many the lane has. Its items are in order of time; a clip that starts before the view and goes into it counts
keysOfRail beta
export declare function keysOfRail(def: CinematicDef, ref: ItemRef, context: {
path: (name: string) => readonly Vec2[] | undefined;
eases?: EaseRegistry;
}): CinematicEdit | undefined;A rail key of the camera lane made into keys (cameraKeysFromPath): the camera's run along the path, as the rail ran it, as keys a designer changes one by one, selected. From the rail's time to a frame before the key after it (LAST_RAIL_SECONDS when it is the last), its bends rounded as the rail rounds them (a key at each of the path's points for a rail that does not), spread in time by the ease the rail ran with (the key after's); the first key is reached as the rail was (its path, ease, handle in and transition). Nothing for a key that is no rail, or a rail of a path the map has not (path finds the map's paths)
keyTimes beta
export declare function keyTimes(def: CinematicDef, lanes?: readonly string[], options?: EditOptions): number[];The moments things start and end at, in order, each once: of the lanes given (those of what is selected), else of every lane. Where the playhead steps to the key before or after (, and .)
laneOf beta
laneOf: (def: CinematicDef, id: string) => LaneData | undefinedThe lane of that id in the cinematic, or undefined when it has none
LAST_RAIL_SECONDS beta
LAST_RAIL_SECONDS = 4How long a rail runs that is the last key of its lane, when it is made into keys: it had nothing to run to
moveLane beta
export declare function moveLane(def: CinematicDef, id: string, to: number): CinematicDef;Moves a lane to another place in the list (what the panel's drag of a lane's name does)
moveSelection beta
export declare function moveSelection(def: CinematicDef, selection: CinematicSelection, dt: number, rows?: number, options?: EditOptions): CinematicEdit;Moves what is selected by dt seconds (none before 0: the whole selection stops at it together), and its items rows lanes down (up, below 0) where the lane there is of the same kind and not locked: a dialog line dragged onto the other dialog lane. Where that would lie over another item of a lane, it goes by the nearest it may instead: up against that one, before it or after (one dragged far enough past another jumps it)
newCinematic beta
export declare function newCinematic(id: string, name?: string): CinematicDef;An empty cinematic of an id, to make one from nothing
NO_SELECTION beta
NO_SELECTION: CinematicSelectionThe selection with nothing selected, no items and no markers
paste beta
export declare function paste(def: CinematicDef, clipboard: CinematicClipboard, at: number, into?: string, options?: EditOptions): CinematicEdit;Pastes what was copied at a time: the items of each lane copied onto into where that lane is of their kind (lines pasted onto the other dialog lane), else onto the lane they came from, else onto another of their kind, the first where they lie over nothing; else onto a new lane of their kind (two things at once are on two lanes). Markers keep their names where those are free. What was pasted is selected
removeLane beta
export declare function removeLane(def: CinematicDef, id: string): CinematicDef;Takes a lane away, with what is on it
removeTime beta
export declare function removeTime(def: CinematicDef, from: number, to: number, options?: EditOptions): CinematicEdit;Time taken out between two moments (ripple delete): what starts in it is gone, markers too, and what starts after comes back by its length; a clip that goes on into it (saying how long it lasts) is shorter by as much of it as it had, so that it does not lie over what comes back. Locked lanes are left as they are
sameRef beta
sameRef: (a: ItemRef, b: ItemRef) => booleanWhether two references point to the same place of the same lane
sectionAt beta
export declare function sectionAt(def: CinematicDef, at: number, length: number): {
name: string;
from: number;
to: number;
} | undefined;The section at is in: from its marker to the next section's, or the end (length); nothing before the first
selectAll beta
export declare function selectAll(def: CinematicDef, lane?: string): CinematicSelection;Everything of a lane, or of every lane, selected: Ctrl+A
selectInBox beta
export declare function selectInBox(def: CinematicDef, box: {
from: number;
to: number;
lanes: readonly string[];
markers?: boolean;
}, options?: EditOptions): CinematicSelection;What a box drawn over the lanes takes: the items of the lanes it goes over (lanes, by id) that it touches between two times, and the markers between them when it starts on the ruler (markers)
selectionSize beta
selectionSize: (selection: CinematicSelection) => numberHow many things are selected, items and markers together
setDefLoop beta
export declare function setDefLoop(def: CinematicDef, loop: {
from?: number;
to?: number;
} | null): CinematicDef;The cinematic made to loop between two times when it is played (D3), or not (null)
setItem beta
export declare function setItem(def: CinematicDef, ref: ItemRef, fields: Partial<LaneItem> & Record<string, unknown>): CinematicEdit;Changes the fields of an item (at kept in order with the others), selected
setLane beta
export declare function setLane(def: CinematicDef, id: string, fields: {
name?: string;
muted?: boolean;
group?: string;
}): CinematicDef;Changes a lane's name (none: its kind's) or whether it is muted (kept, not played)
setMarker beta
export declare function setMarker(def: CinematicDef, index: number, fields: Partial<Marker>): CinematicEdit;Changes a marker's name, time or colour; a name taken by another is made free (gate-2)
setRef beta
export declare function setRef(def: CinematicDef, name: string, ref: RefDef | undefined, rename?: string): CinematicDef;Names a ref of the cinematic (refs.hero), changes it, or takes it away (undefined); with rename, under another name
setSelected beta
export declare function setSelected(def: CinematicDef, selection: CinematicSelection, key: string, value: unknown, options?: EditOptions): CinematicEdit;Sets a field (fieldOf's key) of every item selected to one value: what the Inspector does with several selected, one step. Items of locked lanes are left as they are; what is selected stays so. Set to a time (at) or a length (for) that would lie over another item of their lane, they go where they are free (as addItem puts one)
SHORTEST beta
SHORTEST: numberThe shortest a clip may be trimmed to: a frame
shownLength beta
export declare function shownLength(def: CinematicDef, lanes?: readonly LaneDef[], least?: number): number;The length a panel shows a cinematic at: its own, else to its last item, never under least seconds
snapTargets beta
export declare function snapTargets(def: CinematicDef, options?: EditOptions & {
except?: CinematicSelection;
playhead?: number;
}): number[];Every start and end of the items, every marker, the playhead: what a time dragged near snaps to, but what is being dragged
splitAt beta
export declare function splitAt(def: CinematicDef, selection: CinematicSelection, t: number, options?: EditOptions): CinematicEdit;Cuts clips in two at a time: those selected that go across it, or every clip that does (but on a locked lane) with nothing selected. Each half keeps the clip's fields; the second halves are selected. Keys are not cut
toggleSections beta
export declare function toggleSections(def: CinematicDef, indices: readonly number[], at?: number): CinematicEdit;Makes markers sections' starts, or plain markers again (D3): all of them sections unless all already are. The markers at indices, else the one at at (the playhead)
trimItem beta
export declare function trimItem(def: CinematicDef, ref: ItemRef, edge: 'start' | 'end', t: number, options?: EditOptions): CinematicEdit;Trims a clip at one of its edges to a time: its start (it ends where it did) or its end (it starts where it did), never shorter than a frame, nor over the clip before or after it on its lane. A clip that did not say how long it lasts says so after
withField beta
export declare function withField<T extends LaneItem>(item: T, key: string, value: unknown): T;An item with a field changed (undefined takes it out, and a field of a field left empty with it), the item handed in kept. A number in the key is a place in a list (steps.1.order, until.inRange.2), the list kept a list