🎥 Make videos programmatically with React
Merge remote-tracking branch 'origin/main' into codex/track-prototype
Jonny Burger517e0a5f2aed
diff --cc packages/core/src/Sequence.tsxindex aaa2cfefc2,62d71d889d..756d12fba5--- a/packages/core/src/Sequence.tsx+++ b/packages/core/src/Sequence.tsx@@@ -826,18 -828,33 +855,33 @@@ const RegularSequenceRefForwardingFunct) : null;}+ // Retain resolved scene registrations so Studio can recover the natural end+ // even when seeking past an explicit wrapper trim. Scene contents stay hidden.+ const retainSeriesRegistration = env.isStudio && canInferDuration;- const sequenceContent =++ const renderedContent =+ loopedContent === null ? (+ retainSeriesRegistration ? (+ children+ ) : null+ ) : other.layout === 'none' ? (+ loopedContent+ ) : (+ <AbsoluteFillElement+ ref={sequenceRef}+ style={defaultStyle}+ className={other.className}+ >+ {loopedContent}+ </AbsoluteFillElement>+ );- const sequence = (+ const sequenceContent = (<SequenceContext.Provider value={contextValue}>- {loopedContent === null ? null : other.layout === 'none' ? (- loopedContent+ {retainSeriesRegistration ? (+ <SeriesContentVisibilityContext.Provider value={content !== null}>- {sequenceContent}++ {renderedContent}+ </SeriesContentVisibilityContext.Provider>) : (- <AbsoluteFillElement- ref={sequenceRef}- style={defaultStyle}- className={other.className}- >- {loopedContent}- </AbsoluteFillElement>- sequenceContent++ renderedContent)}</SequenceContext.Provider>);diff --cc packages/studio/src/components/Timeline/TimelineSelection.tsxindex a162943e02,d69d5b871e..fbd249987e--- a/packages/studio/src/components/Timeline/TimelineSelection.tsx+++ b/packages/studio/src/components/Timeline/TimelineSelection.tsx@@@ -654,6 -658,115 +658,115 @@@ export const getSelectableTimelineSeque});};+ const getSelectableTimelineItemsForTrack = ({+ getDragOverrides,+ getEffectDragOverrides,+ getIsExpanded,+ propStatuses,+ selectedRowKeys,+ track,+ timelinePosition,+ }: {+ readonly getDragOverrides: GetDragOverrides;+ readonly getEffectDragOverrides: GetEffectDragOverrides;+ readonly getIsExpanded: GetIsExpanded;+ readonly propStatuses: PropStatuses;+ readonly selectedRowKeys: ReadonlySet<string>;+ readonly track: TimelineTrackData;+ readonly timelinePosition: number;+ }): TimelineSelection[] => {+ const {nodePathInfo} = track;+ if (nodePathInfo === null) {+ return [];+ }++ const sequenceSelection = getTimelineSelectionFromNodePathInfo(nodePathInfo);+ if (sequenceSelection === null) {+ return [];+ }+- if (!getIsExpanded(nodePathInfo)) {++ if (track.sequence.timelineTrack || !getIsExpanded(nodePathInfo)) {+ return [sequenceSelection];+ }++ const tree = buildTimelineTree({+ sequence: track.sequence,+ nodePathInfo,+ getDragOverrides,+ getEffectDragOverrides,+ propStatuses,+ includeTextContent: false,+ includeSourceControls: false,+ runtimeValues: null,+ });+ const filteredTree = filterTimelineExpandedTree({+ nodes: tree,+ shouldShowNode: (node) =>+ isTimelineExpandedNodeSelected({+ nodePathInfo: node.nodePathInfo,+ selectedRowKeys,+ }) ||+ getNodeHasKeyframes({+ node,+ nodePath: nodePathInfo.sequenceSubscriptionKey,+ propStatuses,+ getDragOverrides,+ getEffectDragOverrides,+ }),+ });+ const visibleTreeRows = flattenVisibleTreeNodes({+ nodes: filteredTree,+ getIsExpanded,+ });++ return [+ sequenceSelection,+ ...visibleTreeRows.flatMap(({node}): TimelineSelection[] => {+ const rowSelection = getTimelineSelectionFromNodePathInfo(+ node.nodePathInfo,+ );+ if (rowSelection === null) {+ return [];+ }++ const keyframes = getNodeKeyframes({+ node,+ nodePath: nodePathInfo.sequenceSubscriptionKey,+ propStatuses,+ keyframeDisplayOffset: track.keyframeDisplayOffset,+ keyframePlaybackRate: track.keyframePlaybackRate,+ getDragOverrides,+ getEffectDragOverrides,+ timelinePosition,+ });+ const keyframeSelections = keyframes.map(+ (keyframe): TimelineSelection => ({+ type: 'keyframe',+ nodePathInfo: node.nodePathInfo,+ frame: keyframe.frame,+ }),+ );+ const easingSelections = getNodeCanEditEasing({+ node,+ nodePath: nodePathInfo.sequenceSubscriptionKey,+ propStatuses,+ })+ ? getKeyframeSegments(keyframes).map(+ (segment): TimelineSelection => ({+ type: 'easing',+ nodePathInfo: node.nodePathInfo,+ fromFrame: segment.fromFrame,+ toFrame: segment.toFrame,+ segmentIndex: segment.segmentIndex,+ }),+ )+ : [];++ return [rowSelection, ...easingSelections, ...keyframeSelections];+ }),+ ];+ };+export const getSelectableTimelineItems = ({getDragOverrides,getEffectDragOverrides,diff --cc packages/studio/src/components/Timeline/TimelineSequence.tsxindex dae99bebec,19cfb0b873..909ec2d19a--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx@@@ -1412,22 -1522,16 +1559,22 @@@ const TimelineSequenceInner: React.FC<const showRightBorderRadius =visibleLayout?.rightEdgeVisible === true &&- (endsAtContainerBoundary || endsAtNaturalMediaDuration);+ (s.autoDuration || endsAtContainerBoundary || endsAtNaturalMediaDuration);const style: React.CSSProperties = useMemo(() => {+ const role = s.timelineTrack?.role;+ const isEffect = role === 'transition' || role === 'overlay';return {background:- s.type === 'audio'- ? TIMELINE_AUDIO_GRADIENT- : s.type === 'video'- ? TIMELINE_VIDEO_GRADIENT- : BLUE,+ role === 'transition'+ ? `repeating-linear-gradient(135deg, ${BLUE} 0 5px, ${WHITE_ALPHA_20} 5px 7px), ${BLUE}`+ : role === 'overlay'+ ? WARNING_COLOR+ : s.type === 'audio'+ ? TIMELINE_AUDIO_GRADIENT+ : s.type === 'video'+ ? TIMELINE_VIDEO_GRADIENT+ : BLUE,borderTopLeftRadius: showLeftBorderRadius ? 2 : 0,borderBottomLeftRadius: showLeftBorderRadius ? 2 : 0,borderTopRightRadius: showRightBorderRadius ? 2 : 0,diff --cc packages/studio/src/components/Timeline/TimelineVirtualization.tsxindex 5e9131e340,d67194bcaa..e29ea4c31a--- a/packages/studio/src/components/Timeline/TimelineVirtualization.tsx+++ b/packages/studio/src/components/Timeline/TimelineVirtualization.tsx@@@ -115,25 -96,29 +116,33 @@@ export const TimelineVirtualizationProvoffsets[index + 1] = offsets[index] + trackHeights[index];}- const rows = timeline.map(- ({track, items}, index): TimelineVirtualRow => ({- afterDropLineOffset: offsets[subtreeEndIndexes[index]] - offsets[index],- siblingIndex: siblingIndexes[index],- track,- items,- }),- );- const rows = timeline.map((track, index): TimelineVirtualRow => {++ const rows = timeline.map(({track, items}, index): TimelineVirtualRow => {+ const afterDropLineOffset =+ offsets[subtreeEndIndexes[index]] - offsets[index];+ const siblingIndex = siblingIndexes[index];+ const previous = previousRowsRef.current[index];+ if (+ previous?.track === track &&++ previous.items === items &&+ previous.afterDropLineOffset === afterDropLineOffset &&+ previous.siblingIndex === siblingIndex+ ) {+ return previous;+ }+- return {afterDropLineOffset, siblingIndex, track};++ return {afterDropLineOffset, siblingIndex, track, items};+ });const rootTrackIndexes = new Map<string, number>();for (let index = 0; index < timeline.length; index++) {- const {nodePathInfo} = timeline[index];- if (nodePathInfo !== null) {- rootTrackIndexes.set(- getTimelineSequenceSelectionKey(nodePathInfo),- index,- );+ for (const {nodePathInfo} of timeline[index].items ?? [+ timeline[index].track,+ ]) {+ if (nodePathInfo !== null) {+ rootTrackIndexes.set(+ getTimelineSequenceSelectionKey(nodePathInfo),+ index,+ );+ }}}