🎥 Make videos programmatically with React
`@remotion/studio`: Add agent context copying to easing menu
JonnyBurgerd17f1baecccd
diff --git a/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx b/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsxindex 69751f9eed..4ccdf79507 100644--- a/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx+++ b/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx@@ -4,6 +4,7 @@ import {Internals, useVideoConfig} from 'remotion';import {useTimelineCalculator} from '../../helpers/calculate-timeline';import {StudioServerConnectionCtx} from '../../helpers/client-id';import {BLUE, LIGHT_TEXT, WHITE_ALPHA_10} from '../../helpers/colors';+import {formatContextForAgents} from '../../helpers/format-file-location';import {getXPositionOfItemInTimelineImperatively} from '../../helpers/get-left-of-timeline-slider';import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';import {TIMELINE_PADDING} from '../../helpers/timeline-layout';@@ -11,12 +12,16 @@ import {ContextMenuForTarget} from '../ContextMenu';import type {ComboboxValue} from '../NewComposition/ComboBox';import {OverrideIdToNodePathMappingsRefContext} from '../SequencePropsSubscriptionProvider';import {EasingPresetPreview} from './EasingEditorModal';+import {findTrackForNodePathInfo} from './find-track-for-node-path-info';+import {getCopyContextForAgentsMenuItem} from './get-copy-context-for-agents-menu-item';+import {parseKeyframeFieldFromNodePath} from './parse-keyframe-field-from-node-path';import {TIMELINE_MARQUEE_ITEM_ATTR,useCurrentTimelineSelectionStateAsRef,useTimelineEasingSelection,useTimelineMarqueeSelectableItem,} from './TimelineSelection';+import {getOriginalLocationFromStack} from './TimelineStack/get-stack';import {TimelineWidthContext} from './TimelineWidthProvider';import {getEasingSelections,@@ -161,29 +166,73 @@ const TimelineKeyframeEasingLineInteraction: React.FC<});}- return canvasKeyframeEasingPresets.map((preset) => ({- type: 'item' as const,- id: preset.id,- keyHint: null,- label: preset.label,- leftItem: (- <EasingPresetPreview- color={LIGHT_TEXT}- easing={preset.easing}- height={18}- nonScalingStroke- strokeWidth={1.5}- width={18}- />- ),- disabled: previewServerState.type !== 'connected',- onClick: () => updateEasing(preset.easing),- quickSwitcherLabel: null,- subMenu: null,- value: preset.id,- }));+ const field = parseKeyframeFieldFromNodePath(nodePathInfo.auxiliaryKeys);+ const track = findTrackForNodePathInfo({+ tracks: calculateTimeline({+ sequences: sequencesRef.current,+ overrideIdsToNodePaths: overrideIdToNodePathMappingsRef.current,+ }).tracks,+ nodePathInfo,+ });+ const stack = track?.sequence.getStack() ?? null;++ return [+ ...canvasKeyframeEasingPresets.map((preset) => ({+ type: 'item' as const,+ id: preset.id,+ keyHint: null,+ label: preset.label,+ leftItem: (+ <EasingPresetPreview+ color={LIGHT_TEXT}+ easing={preset.easing}+ height={18}+ nonScalingStroke+ strokeWidth={1.5}+ width={18}+ />+ ),+ disabled: previewServerState.type !== 'connected',+ onClick: () => updateEasing(preset.easing),+ quickSwitcherLabel: null,+ subMenu: null,+ value: preset.id,+ })),+ {+ type: 'divider',+ id: 'copy-context-for-agents-divider',+ },+ getCopyContextForAgentsMenuItem({+ contextForAgents:+ field === null || stack === null+ ? null+ : async () => {+ const location = await getOriginalLocationFromStack(+ stack,+ 'sequence',+ );+ return formatContextForAgents({+ location,+ name: `${field.type === 'effect' ? 'Effect property' : 'Property'} "${field.fieldKey}", easing from frame ${fromFrame} to ${toFrame}`,+ root: window.remotion_cwd,+ });+ },+ }),+ ];},- [onSelect, previewServerState.type, selectable, selected, updateEasing],+ [+ calculateTimeline,+ fromFrame,+ nodePathInfo,+ onSelect,+ overrideIdToNodePathMappingsRef,+ previewServerState.type,+ selectable,+ selected,+ sequencesRef,+ toFrame,+ updateEasing,+ ],);const onPointerDown = useTimelineEasingKeyframeDrag({