Skip to content

🎥 Make videos programmatically with React

`remotion`: New `showInTimeline` prop for `<Sequence>`

Jonny Burgercb3567a96e9e
diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsx
index 0410fb587e..15356ba8d2 100644
--- a/packages/core/src/Sequence.tsx
+++ b/packages/core/src/Sequence.tsx
@@ -37,9 +37,6 @@ export type SequencePropsWithoutDuration = {
height?: number;
from?: number;
name?: string;
- /**
- * @deprecated For internal use only.
- */
showInTimeline?: boolean;
/**
* @deprecated For internal use only.
diff --git a/packages/docs/docs/sequence.mdx b/packages/docs/docs/sequence.mdx
index fc3320a6e3..0d31303de2 100644
--- a/packages/docs/docs/sequence.mdx
+++ b/packages/docs/docs/sequence.mdx
@@ -99,6 +99,14 @@ _optional_
A class name to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.
+### `showInTimeline`<AvailableFrom v="4.0.110" />
+
+_optional_
+
+If set to `false`, the track will not be shown in the Studio's timeline.
+Child `<Sequence>`'s will show by default, unless `showInTimeline` is also set to false.
+This behavior is stable as of v4.0.110, previously the behavior was different, but this prop not documented.
+
## Cascading
You can nest sequences within each other and they will cascade.
diff --git a/packages/studio/src/components/Timeline/Timeline.tsx b/packages/studio/src/components/Timeline/Timeline.tsx
index b2f028342e..f7c84535ac 100644
--- a/packages/studio/src/components/Timeline/Timeline.tsx
+++ b/packages/studio/src/components/Timeline/Timeline.tsx
@@ -60,7 +60,7 @@ export const Timeline: React.FC = () => {
const durationInFrames = videoConfig?.durationInFrames ?? 0;
const filtered = useMemo(() => {
- const withoutHidden = timeline.filter((t) => !isTrackHidden(t, timeline));
+ const withoutHidden = timeline.filter((t) => !isTrackHidden(t));
const withoutAfter = withoutHidden.filter((t) => {
return t.sequence.from <= durationInFrames && t.sequence.duration > 0;
diff --git a/packages/studio/src/components/Timeline/TimelineTracks.tsx b/packages/studio/src/components/Timeline/TimelineTracks.tsx
index 7d523ddcbc..f33f2e8c7d 100644
--- a/packages/studio/src/components/Timeline/TimelineTracks.tsx
+++ b/packages/studio/src/components/Timeline/TimelineTracks.tsx
@@ -43,7 +43,7 @@ export const TimelineTracks: React.FC<{
<div style={content}>
<TimelineTimePadding />
{timeline.map((track) => {
- if (isTrackHidden(track, timeline)) {
+ if (isTrackHidden(track)) {
return null;
}
diff --git a/packages/studio/src/components/Timeline/is-collapsed.ts b/packages/studio/src/components/Timeline/is-collapsed.ts
index 0f54e0cd66..bd9aed71c2 100644
--- a/packages/studio/src/components/Timeline/is-collapsed.ts
+++ b/packages/studio/src/components/Timeline/is-collapsed.ts
@@ -1,22 +1,9 @@
import type {TrackWithHash} from '../../helpers/get-timeline-sequence-sort-key';
-export const isTrackHidden = (
- track: TrackWithHash,
- allTracks: TrackWithHash[],
-): boolean => {
+export const isTrackHidden = (track: TrackWithHash): boolean => {
if (!track.sequence.parent) {
return false;
}
- const parent = allTracks.find(
- (t) => t.sequence.id === track.sequence.parent,
- ) as TrackWithHash;
-
- // Due to effects and conditional `showInTimeline`, a parent
- // may not exist in the `allTracks` array.
- if (!parent) {
- return true;
- }
-
- return isTrackHidden(parent, allTracks);
+ return !track.sequence.showInTimeline;
};