Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
staticFile from compositions/ finds the project's assets/: an edit in one of the layout's folders (compositions/, components/, artifacts/) or under a .raea/project had only its own folder searched, so a picture failed as missing and an <Audio> was dropped without a word and the render refused as silent ("the edit has <Audio> but no sound reached the render", "makes no sound"; reported three times on 0.1.8 and 0.1.9 as a Windows bug, the same on the Mac). A sound file that isn't there is now named, once
shinyobjectz28cc2eb72b19
diff --git a/core/scene/src/media.rs b/core/scene/src/media.rsindex 44567a9b..73e29235 100644--- a/core/scene/src/media.rs+++ b/core/scene/src/media.rs@@ -44,9 +44,16 @@ pub fn decoded(src: &str) -> String {String::from_utf8(out).unwrap_or_else(|_| s.to_string())}+/// The folders of a project's layout an edit can be in (docs/layout.feature), beside its assets/.+const LAYOUT: [&str; 3] = ["compositions", "components", "artifacts"];+/// The project an edit belongs to: the nearest folder at or above the edit's holding space.json (an object's folder,-/// docs/sdk.feature S5a, whose edit is src/main.tsx), else the edit's own folder. Remembered per folder, since media-/// paths are resolved every frame.+/// docs/sdk.feature S5a, whose edit is src/main.tsx) or .raea/project (a workspace's project); else, for an edit in+/// one of the layout's folders (docs/layout.feature: compositions/, components/, artifacts/), the folder holding it,+/// as `raea init` lays a loose folder out; else the edit's own folder. Remembered per folder, since media paths are+/// resolved every frame. An edit in compositions/ once had only its own folder searched, so a staticFile in the+/// project's assets/ was never found: a picture failed as missing, and an <Audio> was dropped without a word and the+/// render refused as silent (0.1.8, 0.1.9).pub fn project_dir(dir: &Path) -> PathBuf {static SEEN: std::sync::Mutex<Option<std::collections::HashMap<PathBuf, PathBuf>>> = std::sync::Mutex::new(None);let mut seen = SEEN.lock().unwrap_or_else(|e| e.into_inner());@@ -54,7 +61,9 @@ pub fn project_dir(dir: &Path) -> PathBuf {if let Some(p) = seen.get(dir) {return p.clone();}- let p = dir.ancestors().find(|d| d.join("space.json").is_file()).unwrap_or(dir).to_path_buf();+ let marked = dir.ancestors().find(|d| ["space.json", ".raea/project"].iter().any(|m| d.join(m).is_file()));+ let laid = || dir.ancestors().find(|d| d.file_name().is_some_and(|n| LAYOUT.iter().any(|k| n == *k))).and_then(Path::parent);+ let p = marked.or_else(laid).unwrap_or(dir).to_path_buf();seen.insert(dir.to_path_buf(), p.clone());p}@@ -126,4 +135,39 @@ mod tests {assert_eq!(media_path(&plain, "/media/e.png"), plain.join("assets/e.png"));let _ = std::fs::remove_dir_all(&root);}++ // the layout (docs/layout.feature): an edit in compositions/ finds the project's assets/, with a .raea/project+ // above it or without (a loose folder), at any depth under compositions/+ #[test]+ fn media_from_the_layout() {+ let root = std::env::temp_dir().join(format!("raea-media-layout-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&root);+ for (name, marked) in [("loose", false), ("project", true)] {+ let p = root.join(name);+ let deep = p.join("compositions/ads");+ for d in [&deep, &p.join("assets"), &p.join("components/reel")] {+ std::fs::create_dir_all(d).unwrap();+ }+ if marked {+ std::fs::create_dir_all(p.join(".raea")).unwrap();+ std::fs::write(p.join(".raea/project"), "").unwrap();+ }+ std::fs::write(p.join("assets/song.wav"), "").unwrap();+ for edit in [p.join("compositions"), deep.clone(), p.join("components/reel"), p.clone()] {+ assert_eq!(media_path(&edit, "/media/song.wav"), p.join("assets/song.wav"), "{name}: from {}", edit.display());+ }+ // the edit's own media/ still comes first+ std::fs::create_dir_all(deep.join("media")).unwrap();+ std::fs::write(deep.join("media/song.wav"), "").unwrap();+ assert_eq!(media_path(&deep, "/media/song.wav"), deep.join("media/song.wav"));+ }+ // a marked project in a folder named for a layout folder is still itself+ let odd = root.join("compositions/mine");+ std::fs::create_dir_all(odd.join(".raea")).unwrap();+ std::fs::create_dir_all(odd.join("assets")).unwrap();+ std::fs::write(odd.join(".raea/project"), "").unwrap();+ std::fs::write(odd.join("assets/a.png"), "").unwrap();+ assert_eq!(media_path(&odd, "/media/a.png"), odd.join("assets/a.png"));+ let _ = std::fs::remove_dir_all(&root);+ }}diff --git a/runtime/export/src/lib.rs b/runtime/export/src/lib.rsindex b82564a3..742e5146 100644--- a/runtime/export/src/lib.rs+++ b/runtime/export/src/lib.rs@@ -191,7 +191,8 @@ fn push_sound(cx: &mut Ctx, props: &Map<String, Value>, skey: &str) {if let (Some(src), Some(at)) = (props.get("src").and_then(|v| v.as_str()), num(props, "data-source-time")) {let Some(file) = raea_io_net::cache::remote(src).map_or_else(|| Some(media_path(cx.dir, src)), Result::ok) else { return }; // http(s): raea's URL cache (#57)// a sound track with samples: a short window says so (decoding the whole take for it held a long take whole)- let audible = *cx.audible.entry(file.clone()).or_insert_with(|| raea_io_media::decode_audio_window(&file, 0.0, 0.05).is_ok_and(|a| a.len() > 0));+ // a sound file that isn't there is named, once (raea_runtime_sound::there)+ let audible = *cx.audible.entry(file.clone()).or_insert_with(|| raea_runtime_sound::there(&file, src) && raea_io_media::decode_audio_window(&file, 0.0, 0.05).is_ok_and(|a| a.len() > 0));if !muted && volume > 0.0 && audible {// raea's mix: dialogue at one level, gainDb an offset on it (raea-sys-mix level.rs), as live play has itlet volume = volume * raea_sys_mix::level::gain(&file, num(props, "data-clip-from").unwrap_or(0.0), num(props, "data-clip-to"), props.get("data-bus").and_then(|v| v.as_str())) as f64;diff --git a/runtime/sound/src/declared.rs b/runtime/sound/src/declared.rsindex d42d13a0..79fbba73 100644--- a/runtime/sound/src/declared.rs+++ b/runtime/sound/src/declared.rs@@ -1,6 +1,17 @@//! Whether an edit's bundle writes an <Audio> that always plays (raea-runtime-export: a render with no sound although it//! does is an error, not a silent file).+/// Whether a sound's file is there, saying so once when it isn't (the caller remembers each file): a render dropped+/// it without a word and then refused as silent, with nothing naming the file (0.1.9: three reports in a day, each+/// read as a Windows bug; the files were in the project's assets/, which an edit in compositions/ didn't search).+pub fn there(file: &std::path::Path, src: &str) -> bool {+ let there = file.exists();+ if !there {+ eprintln!("raea: no sound file {} (src \"{src}\"), so it's silent: staticFile looks in the project's media/, assets/ and public/", file.display());+ }+ there+}+/// True when the bundle's JSX has an <Audio> call, `(…jsx)(Audio, {`, that isn't behind a condition. One behind `?` or/// `&&` is silent when its condition is false, as a sound-only cut's in the starter edit is before there are any cuts/// (`c.kind === "audio" ? <Audio … /> : <Video … />`), and that render is meant to be silent. One in a wrapper's children