A transition step or retyped number arms only what moved
Browse files at this commit7752ec5b55170be25cd29093fd9d976a1cd876e5Parent: a5f4c04- fix
- a transition step or retyped number arms only what moved
1 changed file +36 -9
crates/app/src/player/timeline_edit.rsmodified+36 -9
| @@ -1869,17 +1869,44 @@ impl Player { | |||
| 1869 | if self.exporting().is_some() { | 1869 | if self.exporting().is_some() { |
| 1870 | return; | 1870 | return; |
| 1871 | } | 1871 | } |
| 1872 | - let Some(session) = &mut self.session else { | 1872 | + if self.session.is_none() { |
| 1873 | - return; | 1873 | + return; |
| 1874 | - }; | 1874 | + } |
| 1875 | - let ok = match lane.kind { | 1875 | + // The engine's bool answers "the two clips are adjacent" -- both |
| 1876 | - LaneKind::Video => session.set_transition_out(lane, idx, frames), | 1876 | + // setters snapshot and clamp, and a `frames` already in force (a step |
| 1877 | - LaneKind::Audio => session.crossfade(lane, idx, frames), | 1877 | + // past the cap, a number retyped in the field) writes the value the |
| 1878 | - _ => false, | 1878 | + // clip already carried and still says true. The arm therefore rides |
| 1879 | + // the join's own edges read back, the same before/after comparison | ||
| 1880 | + // `move_sub` and `commit_fade` make. | ||
| 1881 | + let before = self.transition_edges(lane, idx); | ||
| 1882 | + let ok = match &mut self.session { | ||
| 1883 | + Some(session) => match lane.kind { | ||
| 1884 | + LaneKind::Video => session.set_transition_out(lane, idx, frames), | ||
| 1885 | + LaneKind::Audio => session.crossfade(lane, idx, frames), | ||
| 1886 | + _ => false, | ||
| 1887 | + }, | ||
| 1888 | + None => false, | ||
| 1879 | }; | 1889 | }; |
| 1880 | - if ok { | 1890 | + if ok && self.transition_edges(lane, idx) != before { |
| 1881 | self.mark_dirty(); | 1891 | self.mark_dirty(); |
| 1882 | - cx.notify(); | 1892 | + } |
| 1893 | + cx.notify(); | ||
| 1894 | + } | ||
| 1895 | + | ||
| 1896 | + /// What the join at `idx` of `lane` carries on both sides, for the doors | ||
| 1897 | + /// that only the *pair* can answer for: a crossfade writes `idx`'s | ||
| 1898 | + /// `fade_out` and its neighbour's `fade_in`, so a comparison of the | ||
| 1899 | + /// anchor's own field alone would miss a neighbour-side no-op. `None` | ||
| 1900 | + /// for a lane with no such pair, which is a value no write can equal. | ||
| 1901 | + fn transition_edges(&self, lane: Lane, idx: usize) -> Option<(u32, u32)> { | ||
| 1902 | + let session = self.session.as_ref()?; | ||
| 1903 | + match lane.kind { | ||
| 1904 | + LaneKind::Video => Some((session.transition_out_of(lane, idx), 0)), | ||
| 1905 | + LaneKind::Audio => { | ||
| 1906 | + let clips = session.lane_clips(lane); | ||
| 1907 | + Some((clips.get(idx)?.fade_out, clips.get(idx + 1)?.fade_in)) | ||
| 1908 | + } | ||
| 1909 | + _ => None, | ||
| 1883 | } | 1910 | } |
| 1884 | } | 1911 | } |
| 1885 | 1912 | ||