BL36, GD11: <BlenderShot> and <GodotShot>'s native calls move to a crate of their own, raea-runtime-shots (runtime/shots), which raea-runtime-react registers: in runtime/react they took that crate to 2,202 lines, over the 2,000 limit. No change in what they do; the size and length a shot is asked for are whole numbers of 1 or more and its fps a number over 0, each said by name when it isn't. Tests: a_shot_is_keyed_by_what_it_is_made_from and the command's

This commit is contained in:
shinyobjectz committed 2026-11-11 09:50:19 -08:00
1 parent d4e23b602a
commit 9ab4e05f86
8 files changed
+42 -9

No files matched your search

Generated
+12
View File
@@ -15104,6 +15104,7 @@ dependencies = [
"raea-runtime-plugins",
"raea-runtime-scene",
"raea-runtime-shared",
"raea-runtime-shots",
"raea-runtime-twins",
"raea-runtime-view",
"raea-sys-animate",
@@ -15171,6 +15172,17 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-runtime-shots"
version = "0.1.0"
dependencies = [
"raea-io-assets",
"raea-native",
"raea-runtime-calls",
"raea-sys-bake",
"serde_json",
]
[[package]]
name = "raea-runtime-sound"
version = "0.1.0"
+1
View File
@@ -146,6 +146,7 @@ members = [
"runtime/bundle/lib",
"engine/shape-web",
"runtime/calls",
"runtime/shots",
"runtime/export",
"runtime/live",
"runtime/page",
+2
View File
@@ -72,6 +72,8 @@ raea-sys-animate = { path = "../../systems/animate" }
# Bevy plugins compiled into the engine, each behind a feature (sdk/raea/docs/bevy-plugins.md); none by default
raea-bevy-plugins = { path = "../../engine/bevy-plugins", optional = true }
raea-sys-bake = { path = "../../systems/bake" }
# <BlenderShot> and <GodotShot>'s native calls (blender.shot, godot.shot)
raea-runtime-shots = { path = "../shots" }
[package.metadata.cargo-shear]
# raea-io-media is here for its features (h264), which the platform decoders raea-render reads take
-2
View File
@@ -36,8 +36,6 @@ pub(crate) use contact::register as register_scene;
pub mod physics;
// matchmove: `track` and the matchmove.solve native call (scene/track.rs)
pub mod track;
// shots drawn by Blender and Godot: <BlenderShot>, <GodotShot> as native calls made by `raea blender|godot shot` (scene/shots.rs)
pub mod shots;
thread_local! {
/// each part's data-props as last parsed: its text and the props, and the scene it was last read in
+2 -2
View File
@@ -39,8 +39,8 @@ pub fn register_natives() {
native::register();
raea_native::register("page.viewBox", "{}", "[number, number, number, number] | null", "the box (x, y, w, h in frame px) a camera in a page element draws its view in, as last laid out; null when it draws under the whole frame (3D picking in the box, docs/sdk.feature S3a)", |_| Ok(serde_json::json!(*VIEW_BOX.lock().unwrap())));
// matchmove.solve (scene/track.rs), physics.* for <Physics> and <Goo> (systems/bake), scene.bounds and facing
// (scene/contact.rs), blender.shot and godot.shot (scene/shots.rs)
for register in [scene::track::register, scene::physics::register, scene::shots::register, scene::register_scene] {
// (scene/contact.rs), blender.shot and godot.shot (runtime/shots)
for register in [scene::track::register, scene::physics::register, raea_runtime_shots::register, scene::register_scene] {
register();
}
}
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "raea-runtime-shots"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "<BlenderShot> and <GodotShot> as native calls: a shot's frames made once by `raea blender|godot shot` and kept in the composition's asset store"
[dependencies]
# the native-call registry, and the composition's folder the shot's paths are read from
raea-native = { path = "../../engine/native", default-features = false }
raea-runtime-calls = { path = "../calls" }
# the composition's asset store, where the frames are kept
raea-io-assets = { path = "../../io/assets" }
# the bake's progress while another engine draws the frames
raea-sys-bake = { path = "../../systems/bake" }
serde_json = "1"
@@ -14,7 +14,7 @@ type R<T> = Result<T, String>;
const GIVES: &str = "{ dir: string; frames: number }";
pub(crate) fn register() {
pub fn register() {
raea_native::register(
"blender.shot",
"{ script?: string; file?: string; engine?: string; samples?: number; transparent?: boolean; args?: string[]; fps: number; width: number; height: number; frames: number }",
@@ -83,15 +83,17 @@ fn identity(k: &mut Key, p: &Path) {
/// `raea blender shot` / `raea godot shot`'s arguments for this request, the source first.
fn command(engine: &str, v: &Value, dir: &Path, out: &Path) -> R<Vec<String>> {
let s = |k: &str| v.get(k).and_then(Value::as_str).map(str::to_string);
let n = |k: &str| v.get(k).and_then(Value::as_f64).ok_or_else(|| format!("{engine}.shot: {k} is a number"));
// the size and length as whole counts, at least one
let whole = |k: &str| v[k].as_f64().filter(|x| *x >= 1.0).map(|x| x.round() as u32).ok_or_else(|| format!("{engine}.shot: {k} is a number of 1 or more"));
let fps = v["fps"].as_f64().filter(|f| *f > 0.0).ok_or_else(|| format!("{engine}.shot: fps is a number over 0"))?;
let at = |p: String| if p.starts_with("res://") { p } else { dir.join(p).to_string_lossy().into_owned() };
let src = match engine {
"blender" => s("script").or_else(|| s("file")).ok_or("BlenderShot: give script or file")?,
_ => s("script").or_else(|| s("scene")).ok_or("GodotShot: give script or scene")?,
};
let (w, h) = (n("width")?.round() as u32, n("height")?.round() as u32);
let (w, h) = (whole("width")?, whole("height")?);
let mut a = vec![engine.to_string(), "shot".into(), at(src), "-o".into(), out.to_string_lossy().into_owned()];
a.extend(["--frames".into(), (n("frames")?.round() as u32).to_string(), "--fps".into(), n("fps")?.to_string(), "--size".into(), format!("{w}x{h}")]);
a.extend(["--frames".into(), whole("frames")?.to_string(), "--fps".into(), fps.to_string(), "--size".into(), format!("{w}x{h}")]);
if engine == "blender" {
if let (Some(_), Some(f)) = (s("script"), s("file")) {
a.extend(["--file".into(), at(f)]);
@@ -122,7 +124,7 @@ fn command(engine: &str, v: &Value, dir: &Path, out: &Path) -> R<Vec<String>> {
}
fn shot(engine: &str, v: &Value) -> R<Value> {
let dir = crate::native::composition_dir().unwrap_or_else(|| PathBuf::from("."));
let dir = raea_runtime_calls::composition_dir().unwrap_or_else(|| PathBuf::from("."));
let frames = v.get("frames").and_then(Value::as_u64).filter(|n| *n > 0).ok_or_else(|| format!("{engine}.shot: frames must be a whole number over 0"))?;
// what the frames are made from
let mut k = Key::new();
+1
View File
@@ -129,6 +129,7 @@ raea-runtime-bake = "runtime"
raea-runtime-bundle = "runtime"
raea-runtime-bundle-lib = "runtime"
raea-runtime-calls = "runtime"
raea-runtime-shots = "runtime"
raea-runtime-export = "runtime"
raea-runtime-page = "runtime"
raea-runtime-sound = "runtime"