From f5a82152394fde4d8f740f664ab7737b82861618 Mon Sep 17 00:00:00 2001 From: cashmere Date: Tue, 28 Jul 2026 19:41:16 +0200 Subject: feat: GPUI desktop port foundation - scene crate: full project/scene/element model, serde round-trip proven against the web SerializedProject shape - transfer crate: .ocp zip container, cross-compat with web fflate archives proven in both directions - storage crate: filesystem project store replacing IndexedDB, .ocp import/export - media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails, waveform summaries) - playback crate: wall-clock anchored, frame-rounded playback clock - gpu crate: native texture readback; compositor renders headless offscreen on Vulkan (spike test) - flake devshell: rust toolchain, GPUI native deps, ffmpeg dev, bindgen clang args; GPUI hello-world builds - port plan in notes/gpui-port.md --- .../crates/timeline/src/placement/compatibility.rs | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 rust/crates/timeline/src/placement/compatibility.rs (limited to 'rust/crates/timeline/src/placement/compatibility.rs') diff --git a/rust/crates/timeline/src/placement/compatibility.rs b/rust/crates/timeline/src/placement/compatibility.rs new file mode 100644 index 00000000..9512af49 --- /dev/null +++ b/rust/crates/timeline/src/placement/compatibility.rs @@ -0,0 +1,43 @@ +use crate::types::{ElementType, TrackType}; + +pub fn get_track_type_for_element_type(element_type: ElementType) -> TrackType { + match element_type { + ElementType::Audio => TrackType::Audio, + ElementType::Text => TrackType::Text, + ElementType::Sticker | ElementType::Graphic => TrackType::Graphic, + ElementType::Effect => TrackType::Effect, + ElementType::Video | ElementType::Image => TrackType::Video, + } +} + +pub fn can_element_go_on_track(element_type: ElementType, track_type: TrackType) -> bool { + get_track_type_for_element_type(element_type) == track_type +} + +pub struct TrackCompatibility { + pub is_valid: bool, + pub error_message: Option, +} + +pub fn validate_element_track_compatibility( + element_type: ElementType, + track_type: TrackType, +) -> TrackCompatibility { + let is_valid = can_element_go_on_track(element_type, track_type); + + if !is_valid { + return TrackCompatibility { + is_valid: false, + error_message: Some(format!( + "{} elements cannot be placed on {} tracks", + element_type.as_str(), + track_type.as_str(), + )), + }; + } + + TrackCompatibility { + is_valid: true, + error_message: None, + } +} -- cgit v1.3.1