Skip to content

armgit / raea

Public Imported from GitHub
0

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.

DR1: a composition's stepped frames are readable outside raea-runtime-export (scene_frames and a Frame's scene are public; no lines added, the crate is at its limit), and raea scene lint steps the frame it reads and its neighbour, not the whole composition

shinyobjectze0067e2f0068
diff --git a/runtime/export/src/fed.rs b/runtime/export/src/fed.rs
index 97d31667..4c018859 100644
--- a/runtime/export/src/fed.rs
+++ b/runtime/export/src/fed.rs
@@ -56,7 +56,7 @@ pub(crate) fn scene_frames_to(js: &Path, dir: &Path, upto: i64) -> R<Option<(Vec
/// FC1a). `wanted`, the frames a still or an `--at` list draws: when they and their neighbours (what reads a frame
/// either side, as a shutter does) are under half of the frames, only those are stepped (frames are pure) and each
/// frame between holds the stepped one before it, never drawn (#26: four `--at` frames of 360 stepped all 360, 64 s)
-pub(crate) fn scene_frames(js: &Path, dir: &Path, upto: i64, whole: bool, wanted: &[i64]) -> R<Option<(Vec<(i64, Frame)>, u32, u32, f64)>> {
+pub fn scene_frames(js: &Path, dir: &Path, upto: i64, whole: bool, wanted: &[i64]) -> R<Option<(Vec<(i64, Frame)>, u32, u32, f64)>> {
edit_dir(dir);
let runtime = |js: &Path| {
let mut app = App::new();
diff --git a/runtime/export/src/lib.rs b/runtime/export/src/lib.rs
index 78e93d13..36b61e96 100644
--- a/runtime/export/src/lib.rs
+++ b/runtime/export/src/lib.rs
@@ -105,7 +105,7 @@ fn render_opts() -> raea_runtime_encode::RenderOpts {
}
/// What one frame of the composition is.
-pub(crate) struct Frame {
+pub struct Frame {
/// a <Mix>: the master's loudness target and true-peak ceiling (the master row)
mix: Option<(f64, f64)>,
/// the page's picture as an asset (its hash; the PNG written already), None where nothing is painted: frames keep
@@ -113,7 +113,7 @@ pub(crate) struct Frame {
/// what an iPhone lets an app keep)
page: Option<String>,
sounds: Vec<Sound>,
- scene: Vec<Node3>,
+ pub scene: Vec<Node3>,
clear: Option<String>,
/// the page is the frame before's (nothing changed, nothing painted)
same: bool,
diff --git a/runtime/export/src/scene.rs b/runtime/export/src/scene.rs
index 51a70e13..f64167f3 100644
--- a/runtime/export/src/scene.rs
+++ b/runtime/export/src/scene.rs
@@ -47,7 +47,7 @@ pub fn cli(args: &[String]) -> Result<String, String> {
let js = std::env::temp_dir().join(format!("raea-scene-{}.js", std::process::id()));
bundle_composition(&tsx, &js, &comp_opts(args)?, None)?;
// and the frame after it, to see what moves
- let got = scene_frames_to(&js, &dir, frame + 2);
+ let got = super::scene_frames(&js, &dir, frame + 2, false, &[frame, frame + 1]);
let _ = std::fs::remove_file(&js);
let (frames, ..) = got?.ok_or("the composition has no 3D")?;
let k = frames.iter().position(|(f, _)| *f == frame).ok_or_else(|| format!("no frame {frame}"))?;