EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Import: a 3D model doesn't ask how to interpret its alpha (#264)
bflatastic69dc1b26fbc5
diff --git a/crates/engine/src/commands/file.rs b/crates/engine/src/commands/file.rsindex fd2157512..3a3e03c50 100644--- a/crates/engine/src/commands/file.rs+++ b/crates/engine/src/commands/file.rs@@ -264,9 +264,13 @@ impl Prober {{warning = Some(format!("{path}: {gaps}"));}- // Settings ▸ Import ▸ Interpret Unlabeled Alpha As.+ // Settings ▸ Import ▸ Interpret Unlabeled Alpha As: images only (a 3D model renders its+ // own alpha, and audio and data have none).let mut ask_alpha = false;- if f.alpha != effectcraft_project::AlphaMode::Ignore && !alpha_is_labeled(path, &f.codec) {+ if matches!(f.kind, FootageKind::Still | FootageKind::Sequence | FootageKind::Video)+ && f.alpha != effectcraft_project::AlphaMode::Ignore+ && !alpha_is_labeled(path, &f.codec)+ {let setting = if f.kind == FootageKind::Video { self.movie_alpha } else { self.still_alpha };match setting {Some(a) => f.alpha = a,diff --git a/crates/engine/src/tests_model3d.rs b/crates/engine/src/tests_model3d.rsindex 1d8b80f93..d142e5f79 100644--- a/crates/engine/src/tests_model3d.rs+++ b/crates/engine/src/tests_model3d.rs@@ -229,3 +229,14 @@ fn adding_models_switches_classic_comps_to_advanced_3d() {s.execute("comp.renderer", json!({"renderer": "classic3d"})).unwrap();assert!(toasts(&mut s).iter().any(|m| m.contains("Classic 3D doesn't draw")));}++/// Importing a 3D model doesn't ask how to interpret its alpha (Interpret Footage): a model+/// renders its own.+#[test]+fn importing_a_model_does_not_ask_about_alpha() {+ let mut s = session();+ assert_eq!(s.prefs.unlabeled_alpha(false), None, "Ask User");+ let r = s.execute("file.import", json!({"paths": [fixture("quad.glb")]})).unwrap();+ assert_eq!(r["unlabeledAlpha"], json!([]));+ assert!(!s.drain_events().iter().any(|e| matches!(e, crate::Event::Frontend { command, .. } if command == "file.interpretFootage")));+}