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.

FP5a: a reading keeps the layers under its pin. On a render with a layer pass, pinned() reads the layer-pass names under the pin's x,y at its moment (located.rs layers, now public) into the reading, and the reader's prompt says "pinned on NAME". On the things red-team render a pin on a block reads Box and one on the empty sky none (ignored test layers_under_a_pin). FP5a is tagged done with its status: read, readings, learn-notes

shinyobjectz923163e7b9c5
diff --git a/apps/fingerprint/src/notes.rs b/apps/fingerprint/src/notes.rs
index c2654ff8..6793b63b 100644
--- a/apps/fingerprint/src/notes.rs
+++ b/apps/fingerprint/src/notes.rs
@@ -6,7 +6,8 @@
//! once the kind is right 45 times in 50 and the axis 40 (FP5b) does `raea fingerprint learn-notes` make each defect
//! or praise an evidence row over its span (1.5 s before the pin to 0.5 s after). A direction goes to the brief and the
//! agent, never into a head. A note's marks (FP11b) make its row a region label: the box around its marks, boxes and
-//! lassos; a span pin sets the row's time.
+//! lassos; a span pin sets the row's time. On a render with a layer pass, a reading keeps the layers under its pin,
+//! and the reader is told them.
use crate::{flag, has, words};
use raea_sys_fingerprint::folder::Folder;
@@ -44,6 +45,9 @@ pub struct Reading {
/// where in the frame the note's marks say the thing is, x0,y0,x1,y1 in 0-1 (FP11b)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub region: Option<[f32; 4]>,
+ /// the layers under the pin's x,y in the layer pass, on a render with one (FP5a)
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub layers: Vec<String>,
}
@@ -82,7 +86,9 @@ pub fn pinned(project: &Path) -> Vec<Reading> {
continue;
}
let to = n["pin"]["to"].as_f64().filter(|&to| to > t);
- out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), ..Default::default() });
+ let at = n["pin"]["x"].as_f64().zip(n["pin"]["y"].as_f64()).map(|(x, y)| [x - 0.01, y - 0.01, x + 0.01, y + 0.01].map(|v| v.clamp(0.0, 1.0)));
+ let layers = at.map(|b| raea_sys_fingerprint_things::located::layers(&video, t, b)).unwrap_or_default();
+ out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), layers, ..Default::default() });
}
}
out
@@ -91,7 +97,8 @@ pub fn pinned(project: &Path) -> Vec<Reading> {
/// The reading prompt: the axes with their words, then the notes, and the JSON to answer
pub fn prompt(fp: &Fingerprint, notes: &[Reading]) -> String {
let axes = fp.axes.iter().map(|a| format!("- {}: {}", a.name, a.words.join("; "))).collect::<Vec<_>>().join("\n");
- let list = notes.iter().map(|n| format!("{}: {}", n.note, n.text.replace('\n', " "))).collect::<Vec<_>>().join("\n");
+ let on = |n: &Reading| if n.layers.is_empty() { String::new() } else { format!(" (pinned on {})", n.layers.join(", ")) };
+ let list = notes.iter().map(|n| format!("{}: {}{}", n.note, n.text.replace('\n', " "), on(n))).collect::<Vec<_>>().join("\n");
format!(
"You read a person's review notes on their videos. Read each note only; open no file and change nothing.\n\
For each note say its kind: \"defect\" (it names something wrong at that moment), \"direction\" (it asks for a creative change, \
@@ -322,7 +329,8 @@ mod tests {
assert_eq!((n[0].kind.as_str(), n[0].axis.as_deref()), ("defect", Some("glitch")));
assert_eq!((n[1].kind.as_str(), n[1].axis.as_deref()), ("direction", None), "an axis the fingerprint hasn't is dropped");
assert_eq!(n[2].kind, "", "a kind it doesn't know is no reading");
- assert!(prompt(&fp, &n).contains("n1: "));
+ n[0].layers = vec!["Floor".into()];
+ assert!(prompt(&fp, &n).contains("n1: ") && prompt(&fp, &n).contains("(pinned on Floor)"), "the reader is told the layer");
}
#[test]
diff --git a/docs/fingerprint.feature b/docs/fingerprint.feature
index 21764d5f..c5a01eb5 100644
--- a/docs/fingerprint.feature
+++ b/docs/fingerprint.feature
@@ -333,7 +333,7 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
one isn't a gate unless its check found it too
Rule: FP5. Notes become evidence
- @needs:FP2b
+ @needs:FP2b @done
Scenario: FP5a. A pinned note is read into a label
Given the plan
| crate | file | lines | job |
@@ -344,6 +344,13 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
through the layer pass (review.feature R2), when the video has one
And a defect or praise becomes an evidence row with the note's words, its id and who wrote it; a direction goes to
the brief and the agent only
+ And 11-12: `raea fingerprint read PROJECT [--by kimi|claude]` (notes.rs) has a fresh session read each person's
+ pinned note on the project's videos into a kind and one of the fingerprint's axes (an axis it hasn't, or a kind
+ it doesn't know, is dropped), kept in readings.jsonl with the note's id, words, author, its moment or span and the
+ region its marks name. On a render with a layer pass the reading keeps the layers under the pin (a pin on a
+ things red-team block reads "Box", one on the empty sky none), and the reader is told them ("pinned on Box").
+ `learn-notes` makes a defect or praise an evidence row over 1.5 s before the pin to 0.5 s after, with the note's
+ words, id and author; a direction stays with the brief. It trains only past FP5b's gate
@needs:FP5a
Scenario: FP5b. The reading is checked against the person
diff --git a/systems/fingerprint-things/src/located.rs b/systems/fingerprint-things/src/located.rs
index a6d005d4..ba8c23f6 100644
--- a/systems/fingerprint-things/src/located.rs
+++ b/systems/fingerprint-things/src/located.rs
@@ -69,7 +69,7 @@ pub fn bootstrap(enc: &mut Encoders, dir: &Path, files: &[PathBuf], per: usize,
/// The layers a box covers in a render's layer pass (NAME.layers beside it) at time t, by name, most of the box first;
/// a layer under a tenth of the box is left out
-fn layers(file: &Path, t: f64, b: [f64; 4]) -> Vec<String> {
+pub fn layers(file: &Path, t: f64, b: [f64; 4]) -> Vec<String> {
let Ok(m) = raea_sys_layers::read::read(&file.with_extension("layers")) else { return Vec::new() };
let fps = media::video(file).map(|d| d.info().fps).unwrap_or(30.0);
let f = (t * fps).round() as i64;
@@ -117,6 +117,18 @@ mod tests {
eprintln!("{}", serde_json::to_string_pretty(&said).unwrap());
}
+ /// `RAEA_LAYERS_MEDIA=FILE RAEA_LAYERS_AT=t,x,y cargo test -p raea-sys-fingerprint-things layers_under -- --ignored
+ /// --nocapture`: the layers under a pin at x,y (0-1) at t s, as FP5a's reading keeps them
+ #[test]
+ #[ignore]
+ fn layers_under_a_pin() {
+ let f = PathBuf::from(std::env::var("RAEA_LAYERS_MEDIA").expect("RAEA_LAYERS_MEDIA"));
+ let a: Vec<f64> = std::env::var("RAEA_LAYERS_AT").expect("RAEA_LAYERS_AT").split(',').filter_map(|v| v.parse().ok()).collect();
+ let l = layers(&f, a[0], [a[1] - 0.01, a[2] - 0.01, a[1] + 0.01, a[2] + 0.01]);
+ eprintln!("{l:?}");
+ assert!(!l.is_empty(), "no layer under the pin");
+ }
+
#[test]
fn a_box_covers_the_cells_it_is_mostly_over() {
// 64 px from (32, 48): cells 2..6 across (32 px is cell 2's left edge) and rows 3..7 (48 to 112)