theatre/theatre/studio/src/panels/SequenceEditorPanel/DopeSheet/Right/SheetRow.tsx
Elliot 39eb528af4
Add Sheet aggregate track (#284)
* Add Sheet aggregate track

* Update aggregate track keyframe copy algorithm

* Fix keyframe value sanitization

* Fix aggregate selections to be properly undefined

* Fix TS errors

* Remove incorrect comment and improve var name
2022-09-14 16:46:59 +00:00

40 lines
1.3 KiB
TypeScript

import type {SequenceEditorPanelLayout} from '@theatre/studio/panels/SequenceEditorPanel/layout/layout'
import type {SequenceEditorTree_Sheet} from '@theatre/studio/panels/SequenceEditorPanel/layout/tree'
import {usePrism} from '@theatre/react'
import type {Pointer} from '@theatre/dataverse'
import React from 'react'
import RightSheetObjectRow from './SheetObjectRow'
import RightRow from './Row'
import {collectAggregateKeyframesInPrism} from './collectAggregateKeyframes'
import AggregatedKeyframeTrack from './AggregatedKeyframeTrack/AggregatedKeyframeTrack'
const SheetRow: React.FC<{
leaf: SequenceEditorTree_Sheet
layoutP: Pointer<SequenceEditorPanelLayout>
}> = ({leaf, layoutP}) => {
return usePrism(() => {
const aggregatedKeyframes = collectAggregateKeyframesInPrism(leaf)
const node = (
<AggregatedKeyframeTrack
layoutP={layoutP}
aggregatedKeyframes={aggregatedKeyframes}
viewModel={leaf}
/>
)
return (
<RightRow leaf={leaf} node={node} isCollapsed={leaf.isCollapsed}>
{leaf.children.map((sheetObjectLeaf) => (
<RightSheetObjectRow
layoutP={layoutP}
key={'sheetObject-' + sheetObjectLeaf.sheetObject.address.objectKey}
leaf={sheetObjectLeaf}
/>
))}
</RightRow>
)
}, [leaf, layoutP])
}
export default SheetRow