Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge pull request #742 from vangel76/gap-fbx-import

Brandon Thomasd57459a7d0f2
diff --cc crates/engine/src/commands/app_more.rs
index e4ece7c7f,033d57405..9d03e344e
--- a/crates/engine/src/commands/app_more.rs
+++ b/crates/engine/src/commands/app_more.rs
@@@ -316,7 -316,7 +316,8 @@@ pub const IMPORT_FORMATS: &[&str] = &
"Opus",
"glTF/GLB",
"OBJ",
+ "STL",
+ "FBX",
"Lottie JSON",
];
diff --cc crates/engine/src/commands/model3d.rs
index 9bcb3665f,0a5403a77..28b7274ef
--- a/crates/engine/src/commands/model3d.rs
+++ b/crates/engine/src/commands/model3d.rs
@@@ -1,4 -1,4 +1,4 @@@
- //! Advanced 3D: model layers (File ▸ Import of glTF/OBJ/STL, Layer ▸ New ▸ 3D primitives), the
-//! Advanced 3D: model layers (File ▸ Import of glTF/OBJ/FBX, Layer ▸ New ▸ 3D primitives), the
++//! Advanced 3D: model layers (File ▸ Import of glTF/OBJ/STL/FBX, Layer ▸ New ▸ 3D primitives), the
//! comp renderer switch, Layer ▸ Environment Layer, Geometry Options for extruded text and
//! shapes, and Layer ▸ Material commands.
@@@ -376,7 -376,7 +376,7 @@@ pub fn specs() -> Vec<CommandSpec>
"3D Model Layer",
[],
None,
- "{item?: id or name of a 3D model footage item, path?: a .gltf, .glb, .obj or .stl file to import, name?, time? (s), index? (1-based stack position), position? ([x, y] comp px)}; switches a Classic 3D comp to Advanced 3D",
- "{item?: id or name of a 3D model footage item, path?: a .gltf, .glb, .obj or .fbx file to import, name?, time? (s), index? (1-based stack position), position? ([x, y] comp px)}; switches a Classic 3D comp to Advanced 3D",
++ "{item?: id or name of a 3D model footage item, path?: a .gltf, .glb, .obj, .stl or .fbx file to import, name?, time? (s), index? (1-based stack position), position? ([x, y] comp px)}; switches a Classic 3D comp to Advanced 3D",
has_comp,
new_model
),
diff --cc crates/engine/src/media_browser.rs
index 87b1b4753,e9e984435..a3519e4f1
--- a/crates/engine/src/media_browser.rs
+++ b/crates/engine/src/media_browser.rs
@@@ -197,7 -197,7 +197,7 @@@ const VIDEO: &[&str] = &["mp4", "m4v",
const IMAGE: &[&str] = &["png", "jpg", "jpeg", "tif", "tiff", "exr", "bmp", "webp", "psd", "psb", "svg", "tga", "dpx", "hdr"];
const AUDIO: &[&str] = &["wav", "aif", "aiff", "mp3", "m4a", "aac", "flac", "ogg", "opus"];
const DATA: &[&str] = &["json", "csv", "tsv", "mgjson"];
- const MODEL: &[&str] = &["gltf", "glb", "obj", "stl"];
-const MODEL: &[&str] = &["gltf", "glb", "obj", "fbx"];
++const MODEL: &[&str] = &["gltf", "glb", "obj", "stl", "fbx"];
/// Kind of file from its extension.
pub fn kind_of(path: &str) -> Option<&'static str> {
diff --cc crates/media/src/lib.rs
index d9c0b320c,e85900c02..fe338fca1
--- a/crates/media/src/lib.rs
+++ b/crates/media/src/lib.rs
@@@ -58,7 -58,7 +58,7 @@@ pub const AUDIO_EXTENSIONS: &[&str] = f
pub const VIDEO_EXTENSIONS: &[&str] = &["mp4", "m4v", "mov", "mkv", "webm"];
/// File extensions recognised as 3D models (Advanced 3D model layers).
- pub const MODEL_EXTENSIONS: &[&str] = &["gltf", "glb", "obj", "stl"];
-pub const MODEL_EXTENSIONS: &[&str] = &["gltf", "glb", "obj", "fbx"];
++pub const MODEL_EXTENSIONS: &[&str] = &["gltf", "glb", "obj", "stl", "fbx"];
/// Whether `path` has an extension we can import.
pub fn is_importable(path: &std::path::Path) -> bool {
diff --cc crates/media/src/probe.rs
index 099450e8c,938fa4937..63bed4908
--- a/crates/media/src/probe.rs
+++ b/crates/media/src/probe.rs
@@@ -23,7 -23,7 +23,7 @@@ pub fn probe(path: impl AsRef<Path>) -
probe_bytes(&path.to_string_lossy(), bytes.into())
}
- /// Probe a 3D model (glTF 2.0 / OBJ / STL): a [`FootageKind::Model`] item whose duration is its
-/// Probe a 3D model (glTF 2.0 / OBJ / FBX): a [`FootageKind::Model`] item whose duration is its
++/// Probe a 3D model (glTF 2.0 / OBJ / STL / FBX): a [`FootageKind::Model`] item whose duration is its
/// longest animation. `resolve` reads sibling resources.
pub fn probe_model(path: &str, bytes: &[u8], resolve: &dyn Fn(&str) -> Option<Vec<u8>>) -> Result<Footage> {
let m = effectcraft_model::load(path, bytes, resolve).map_err(|e| MediaError::Decode(format!("{path}: {e}")))?;
@@@ -31,7 -31,7 +31,8 @@@
let dur = s.animations.iter().map(|a| a.1).fold(0.0f64, f64::max);
let codec = match effectcraft_model::format_of(path) {
Some("obj") => "OBJ",
+ Some("stl") => "STL",
+ Some("fbx") => "FBX",
Some("glb") => "GLB",
_ => "glTF",
};
diff --cc crates/model/Cargo.toml
index 345eea994,965a7d087..032825d3b
--- a/crates/model/Cargo.toml
+++ b/crates/model/Cargo.toml
@@@ -1,6 -1,6 +1,6 @@@
[package]
name = "effectcraft-model"
- description = "3D models: glTF 2.0 (.gltf/.glb), Wavefront OBJ/MTL and STL import, PBR metallic-roughness materials, node hierarchy, skinning and animation, parametric primitives, and extruded/bevelled outline meshes"
-description = "3D models: glTF 2.0 (.gltf/.glb), Wavefront OBJ/MTL and FBX 7.x (binary and ASCII) import, PBR metallic-roughness materials, node hierarchy, skinning and animation, parametric primitives, and extruded/bevelled outline meshes"
++description = "3D models: glTF 2.0 (.gltf/.glb), Wavefront OBJ/MTL and STL and FBX 7.x (binary and ASCII) import, PBR metallic-roughness materials, node hierarchy, skinning and animation, parametric primitives, and extruded/bevelled outline meshes"
version.workspace = true
edition.workspace = true
license.workspace = true
diff --cc crates/model/src/lib.rs
index 6c3da5eb0,3b2a62b68..19a0d37f3
--- a/crates/model/src/lib.rs
+++ b/crates/model/src/lib.rs
@@@ -5,7 -5,8 +5,9 @@@
//! metallic-roughness, normal, occlusion and emissive maps), the node hierarchy, skins and
//! animations.
//! - [`obj`]: Wavefront OBJ geometry with MTL materials (mapped onto the metallic-roughness model).
+//! - [`stl`]: STL meshes (binary and ASCII, with the binary per-facet and part colours).
+ //! - [`fbx`]: FBX 7.x scenes, binary and ASCII: meshes, the Model hierarchy, Lambert/Phong
+ //! materials and their textures.
//! - [`prim`]: parametric primitives (cube, sphere, plane, torus, cone, cylinder).
//! - [`extrude`]: extruded, bevelled meshes from 2D outlines (text and shape layers), with
//! [`triangulate`] for the caps.
@@@ -722,14 -723,14 +725,15 @@@ pub fn skin_point(inst: &Instance, p: &
[q.x, q.y, q.z]
}
- /// Which loader handles a file name (`gltf`, `glb`, `obj`, `stl`), by extension.
-/// Which loader handles a file name (`gltf`, `glb`, `obj`, `fbx`), by extension.
++/// Which loader handles a file name (`gltf`, `glb`, `obj`, `stl`, `fbx`), by extension.
pub fn format_of(path: &str) -> Option<&'static str> {
let ext = path.rsplit('.').next()?.to_ascii_lowercase();
match ext.as_str() {
"gltf" => Some("gltf"),
"glb" => Some("glb"),
"obj" => Some("obj"),
+ "stl" => Some("stl"),
+ "fbx" => Some("fbx"),
_ => None,
}
}
@@@ -739,10 -740,11 +743,12 @@@
pub fn load(path: &str, bytes: &[u8], resolve: &dyn Fn(&str) -> Option<Vec<u8>>) -> Result<Model> {
match format_of(path) {
Some("obj") => obj::parse(bytes, resolve),
+ Some("stl") => stl::parse(bytes),
+ Some("fbx") => fbx::parse(bytes, resolve),
Some(_) => gltf::parse(bytes, resolve),
None if bytes.starts_with(b"glTF") => gltf::parse(bytes, resolve),
- None => Err(ModelError::Unsupported(format!("{path}: not a glTF, OBJ or STL file"))),
+ None if bytes.starts_with(fbx::BINARY_MAGIC) => fbx::parse(bytes, resolve),
- None => Err(ModelError::Unsupported(format!("{path}: not a glTF, OBJ or FBX file"))),
++ None => Err(ModelError::Unsupported(format!("{path}: not a glTF, OBJ, STL or FBX file"))),
}
}
diff --cc crates/ui-egui/src/menus.rs
index 37abc11c5,e08126cd6..52e7625c7
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@@ -1237,7 -1226,7 +1237,7 @@@ fn file_dialog(app: &mut EffectcraftApp
}
const MEDIA: &[&str] = &[
"mp4", "mov", "m4v", "mkv", "webm", "png", "jpg", "jpeg", "gif", "webp", "tif", "tiff", "bmp", "exr", "wav", "aif", "aiff", "mp3", "flac", "ogg",
- "opus", "svg", "pdf", "ai", "eps", "psd", "psb", "gltf", "glb", "obj", "stl", "json", "csv", "tsv",
- "opus", "svg", "pdf", "ai", "eps", "psd", "psb", "gltf", "glb", "obj", "fbx", "json", "csv", "tsv",
++ "opus", "svg", "pdf", "ai", "eps", "psd", "psb", "gltf", "glb", "obj", "stl", "fbx", "json", "csv", "tsv",
];
// A host whose modal dialogs would run a nested event loop inside this frame (macOS: a
// drag over the window then re-entered winit's event handler and aborted, #511) shows the
diff --cc docs/file-format-parity.md
index ccc9fbccb,6fe4fd63d..7954356d0
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@@ -78,9 -78,9 +78,9 @@@ trips and renders, checked by tests, no
|---|---|---|---|
| glTF / GLB | R | yes (meshes, PBR, skins, animations) | good |
| OBJ / MTL | R | yes | good |
- | FBX | R (`usdFbx`) | none | gap 13 |
+ | FBX | R (`usdFbx`) | yes (7.x binary and ASCII: meshes with normals, UVs and per-polygon materials, the Model hierarchy with pivots and pre/post rotation, Lambert/Phong materials with embedded or relative textures, axes turned to Y-up; no animation, skinning, cameras or lights; 6.x rejected) | partial |
| USD / USDZ | R (`usd_plugins`) | none | gap 13 |
-| STL | R (`usdStl`) | none | gap 13 |
+| STL | R (`usdStl`) | yes (binary and ASCII, VisCAM and Magics facet colours; Z-up turned to Y-up) | good |
| Substance 3D materials `.sbsar` | R (26.0) | none | gap 13 |
## Interchange and data
@@@ -107,7 -107,7 +107,7 @@@ encoders ([hardware-parity.md](hardware
## Estimate
**≈ 130–230 h**: `.aep` / `.aepx` import 80–160 h (after the owner decision), wiring TGA / DPX /
- HDR / MXF / AVI / DNx import and DPX/TGA output 10–20 h, FBX / USD and Substance 25–45 h,
-HDR / MXF / AVI / DNx import and DPX/TGA output 10–20 h, FBX animation and skinning, USD / STL and Substance 20–40 h,
++HDR / MXF / AVI / DNx import and DPX/TGA output 10–20 h, FBX animation and skinning, USD and Substance 20–40 h,
relinking 6–12 h, `.mogrt`-compatible templates 15–30 h (partly parallel with the rest).
## Revision history
diff --cc docs/gaps.md
index c261e0055,7e772b2cb..eabe73739
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@@ -63,13 -63,13 +63,13 @@@ are grouped by area; the issue tracker
| 4 | **No CI gate on pull requests** | `.github/workflows` has release, packaging-lint, FreeBSD and Windows ARM64 jobs only; `cargo xtask ci` runs locally | Regressions reach main unseen; 49 community PRs landed in one batch (#598) | 4–8 h | G3 · this file |
| 5 | **Playback and scrubbing feel** | #595 stutter on cached frames, #304, #329 slow scrubbing, #554 / #504 / #335 audio late or crackling, #586 puppet lag | Preview is where motion designers spend their day | 25–50 h | G5 · [hardware-parity.md](hardware-parity.md) |
| 6 | **Linux and Windows interaction bugs** | #491 multi-layer edits, #488 rename arrows, #493, #492, #467 shortcuts, #268 drag and drop, #320 workspaces not persisting, #302 docking, #613 Direct3D 12 compositor, #596 GPU not detected | Many reports come from Linux; some Windows GPUs fail to start the compositor | 25–45 h | G2 · [ui-parity.md](ui-parity.md) |
-| 7 | **Animation presets: 8 against 621** | After Effects ships 621 `.ffx` presets (Behaviors, Backgrounds, Shapes, Synthetics, Text, Transitions…); we ship 8 original text-animator presets and read only our `.ecpreset` | Presets are how many designers start; tutorials assume them | 20–40 h (original presets; `.ffx` reading is out of clean-room scope) | G8 · [effects-parity.md](effects-parity.md) |
+| 7 | **Animation presets: 31 against 621** | After Effects ships 621 `.ffx` presets (Behaviors, Backgrounds, Shapes, Synthetics, Text, Transitions…); we ship 31 original presets (8 text-animator, 23 Transitions: wipes, clock and fan reveals, blinds, dissolves, card flips, CC wipes, fades; #757) and read only our `.ecpreset`. Missing: Behaviors, Backgrounds, Shapes, Synthetics, Image and more Text | Presets are how many designers start; tutorials assume them | 15–35 h (original presets; `.ffx` reading is out of clean-room scope) | G8 · [effects-parity.md](effects-parity.md) |
| 8 | **Mask and shape bugs** | #510, #513, #527 (first Intersect/Darken mask), #509 Roto Brush size, #303 Mesh Warp, #553 pen tools on motion paths | Masks are core compositing | 10–20 h | G2 · [target-app-parity.md](target-app-parity.md) |
| 9 | **Effect behaviour bugs** | #580, #526 Fractal reset, #514 Apply Color LUT, #463 Curl Noise, #369 Motion Tile output size, #473 Cryptomatte selection, #474 multi-layer EXR decoded twice, #534–#536 community fixes pending | Each one breaks a look someone built | 10–20 h | G1/G2 · [effects-parity.md](effects-parity.md) |
-| 10 | **Colour pipeline differences** | #494 32-bpc blend modes clamp and apply opacity differently; #495 no Working Gamma 2.4; #340 ProRes 4444 tagged bt709 but sRGB-encoded; ACES 2.0 / OCIO 2.5 configs (26.5) missing; #546 / #547 viewer colour | Wrong colour in delivery is a client-visible failure | 15–30 h | G1 · [file-format-parity.md](file-format-parity.md) |
+| 10 | **Colour pipeline differences** | #494 32-bpc blend modes clamp and apply opacity differently; #495 Working Gamma 2.4 (in, also for float footage: #750); #340 ProRes 4444 tagged bt709 but sRGB-encoded; ACES 2.0 / OCIO 2.5 configs (26.5) missing; #546 / #547 viewer colour | Wrong colour in delivery is a client-visible failure | 15–30 h | G1 · [file-format-parity.md](file-format-parity.md) |
| 11 | **Text rendering and layout** | #453 CJK text in comps, #316 paragraph alignment inverted, #483 squeezed at 4:3, #417 soft at Fit, #583 font search, #550 toolbar font options | Text is in almost every motion graphic | 10–20 h | G2 · [ui-parity.md](ui-parity.md) |
| 12 | **3D interaction and depth** | No 3D transform gizmos (#392, #347); Z position (#489); camera aperture (#260); reflections (#261); bevel options (#315); 3D issue reopened (#307) | Advanced 3D is After Effects' growth area since 2023 | 20–35 h | G2 · [ui-parity.md](ui-parity.md) |
- | 13 | **3D model formats and materials** | After Effects 26 imports FBX, USD/USDZ, STL besides glTF and OBJ (`usd_plugins`), and Substance 3D materials with mesh displacement (26.0–26.2); we read glTF, OBJ and STL (binary and ASCII, with facet colours), not FBX, USD/USDZ or Substance | Product shots and 3D scenes come as FBX/USDZ | 25–45 h | — · [file-format-parity.md](file-format-parity.md) |
-| 13 | **3D model formats and materials** | After Effects 26 imports FBX, USD/USDZ, STL besides glTF and OBJ (`usd_plugins`), and Substance 3D materials with mesh displacement (26.0–26.2); we read glTF, OBJ and FBX 7.x (binary and ASCII: meshes, hierarchy, Lambert/Phong materials and textures; no FBX animation or skinning yet) | Product shots and 3D scenes come as FBX/USDZ | 25–45 h | — · [file-format-parity.md](file-format-parity.md) |
++| 13 | **3D model formats and materials** | After Effects 26 imports FBX, USD/USDZ, STL besides glTF and OBJ (`usd_plugins`), and Substance 3D materials with mesh displacement (26.0–26.2); we read glTF, OBJ, STL (binary and ASCII, with facet colours) and FBX 7.x (binary and ASCII: meshes, hierarchy, Lambert/Phong materials and textures; no FBX animation or skinning yet) | Product shots and 3D scenes come as FBX/USDZ | 25–45 h | — · [file-format-parity.md](file-format-parity.md) |
| 14 | **Object Matte** (26.2, disk cache in 26.5) | Not present; MobileSAM is already in `effectcraft-segment` and could back it | The new one-click roto; Roto Brush covers part of it | 15–30 h | G7 · [target-app-parity.md](target-app-parity.md) |
| 15 | **Hardware video decode and encode** | No VideoToolbox, NVENC, Quick Sync or VA-API; #498 asks for it; FilmCraft has VideoToolbox / NVENC / VA-API paths to borrow | 4K playback and export speed | 25–45 h | G5/G6 · [hardware-parity.md](hardware-parity.md) |
| 16 | **Localization depth** | Menus in 6 languages; panels in 4; effect names and ~1,650 effect parameter names untranslated; French, German, Korean, Italian, Russian (After Effects ships them) absent; #599 Hangul boxes on macOS | After Effects is used heavily in Japan, China, Korea, Brazil, Europe | 60–110 h + native review | G9 · [localization-parity.md](localization-parity.md) |