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.

PV4d: a 3D part asked by id answers its own props; docs/preview.feature's scenarios are done

shinyobjectz4c990e1b756a
diff --git a/docs/preview.feature b/docs/preview.feature
index 838dd710..b257e10d 100644
--- a/docs/preview.feature
+++ b/docs/preview.feature
@@ -51,6 +51,7 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
# shapes.tsx:28:11#2 with its position and quaternion; the floor; the div where there is no mesh) and
# `--view 1.2,0.9,9,0,0.5,0` (drawn from above, the same part under the same point). raea-sys-frame: 3 tests.
+ @done
Scenario: PV1a. A part under the pointer
Given a composition with 3D meshes playing on the stage
When stage.pick is asked a point over a mesh
@@ -59,9 +60,11 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
frame was drawn (skinned meshes as posed)
And a page element in front of the 3D is answered instead, and the 3D where the page over it is see-through
+ @done
Scenario: PV1b. The stage's compositions are stamped
Then a composition the stage opens is bundled with its source stamps, so every part and element has its key
+ @done
Scenario: PV1c. A free camera
When stage.view is given an orbit (yaw, pitch, distance, target) and the scene is 3D
Then the frame is drawn from there until stage.view null puts the composition's own camera back
@@ -72,6 +75,7 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
# its glb's JSON chunk alone (triangles, nodes, clips, its box). Checked on a scratch project: a component (3D,
# timed, its four props), a composition (both, 3 s), a model (27,420 triangles), a video, a sound. 5 tests.
+ @done
Scenario: PV2a. One description of any file
When the host is asked what a project's file is
Then it answers kind, timed (seconds, fps), plays, space (2d, 3d, both), input, props, includes and weight, and
@@ -85,17 +89,24 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
# leaves the file). A render's light copy (editing.feature E4) is the same store's now. Checked: body.glb 27,420
# triangles -> 6,854 at level 2, rendered and looked at; a 1280x720 take's still in 0.28 s and light copy in
# 0.9 s; a sound's peaks in 0.15 s; Settings said "318 KB used: 3 stills, 1 videos, 1 sounds". 8 + 2 tests.
- # Not built: a model's level chosen by its size on screen while it plays (it opens light and goes to full once).
+ # 11-09 later: the level follows the model's size on screen (light under a third of the frame's height, full from
+ # just over). An FBX, OBJ, USD or .blend gets a glb copy (raea blender run blender/convert.py, from a scratch
+ # folder of links with the script's licence note written there); a font a full still of its specimen. Checked:
+ # crate.obj converted and drawn in 2.8 s. The store, bundled as raea.app bundles its host (esbuild, run outside
+ # the repo), answered describe, view, proxy (thumb, still, peaks, the obj), jsx and file-notes.
+ @done
Scenario: PV3a. Every medium has its light copies
Then an image has a thumbnail, a video a poster and a 540-line copy, a sound its peaks, a model a poster and
lower levels of detail, a composition and a component a poster, each made once and found again by its source's
path, size and time
+ @done
Scenario: PV3b. The store is managed in one place
Then Settings lists the store by project and kind with sizes, and offers Clear and Rebuild; copies whose source
is gone are dropped; the store keeps under its limit by dropping the least recently used
+ @done
Scenario: PV3c. A model's levels of detail
Then a heavy model gets lower levels (triangles halved per level, textures at most 1024 px), and its preview
opens on one and draws the full model once the view has stood a moment
@@ -107,20 +118,31 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
# `lift` raised the shapes as it moved, Orbit turned the scene. A composition never rendered played on opening,
# and a click on its title answered the div at shapes.tsx:8. A model, a video, a still and a sound each opened on
# their page from Assets, whose cards are the store's stills. In Chrome there is no stage: the still stays.
- # Not built: props changed in the selection's card written back to the code from a preview (the editor's
- # stage.tweak does that for a game); the composition editor's own Select tool still reads the render's layers.
-
+ # 11-09 later: the selection's card changes the code (raea-feed host/preview jsx.ts, POST /host/jsx): the picked
+ # element's own attributes as written, a literal a control written where it stands with Undo, a computed one
+ # shown as code; on a component's page, a composition never rendered (the first change starts NAME-vN.tsx) and
+ # the editor's Live view. Checked: the floor's name set from its card changed row.tsx line 21 and Undo put it
+ # back, the stage live through both. Every kind opens: a font's specimen, a document's or code's text, a splat on
+ # the stage (turned upright when it has no placement beside it, with Flip), a converted model, and anything
+ # else in its Mac app. Composition and component rows have their still. 3 tests (jsx).
+ # In a browser there is no stage, so a preview there is the still; the composition editor's own Select tool
+ # (the move, scale and fade of a part) still reads a render's layers, and Live's pointing is the card's.
+
+ @done
Scenario: PV4a. It opens at once
When I open a component, a composition or an asset
Then its poster shows in the first frame the page draws, and the live stage takes over when it is ready
+ @done
Scenario: PV4b. Props change the picture as they move
When I drag a component's number prop
Then the stage shows each value without reopening the composition and without a render
+ @done
Scenario: PV4c. Time only where there is time
Then a still component or an image has no time bar; a timed one plays, loops and scrubs
+ @done
Scenario: PV4d. Pointing and selecting
When I hover and click a 3D part or an element in the preview
Then it is outlined, selected, shown in the outline tree, and its props are the panel's
@@ -128,8 +150,10 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
Rule: PV5. Notes on anything (app)
# Status 11-09: built (raea-feed host/preview notes.ts, POST /host/file-notes; kept in the project's
# .raea/notes/). Checked: a click on body.glb's chest and a note wrote pin.point [0.00, 1.23, 0.13], and its pin
- # stayed on the chest through an orbit (stage.locate). 1 test. Not built: the note sent to an agent as a task.
+ # stayed on the chest through an orbit (stage.locate). 1 test. A note's Ask an agent starts a task in the
+ # project's feed with the note, where it is pinned and where the notes are kept (not run against a live agent).
+ @done
Scenario: PV5a. A note on a model
When I click a point on a model in its preview and write a note
Then the note is kept with the asset, pinned to that point on that part, and shown there from any camera
diff --git a/runtime/live/src/lib.rs b/runtime/live/src/lib.rs
index 5993fb09..a35b5f61 100644
--- a/runtime/live/src/lib.rs
+++ b/runtime/live/src/lib.rs
@@ -166,9 +166,17 @@ impl Live {
let (_, kind, props, kids) = q.iter(w).find(|(n, ..)| n.0 == id)?;
let mut props = props.map(|p| p.0.clone()).unwrap_or_default();
let owner = props.remove("data-raea-owner").and_then(|v| v.as_str().map(str::to_string)).unwrap_or_default();
+ // a 3D part's element holds its own props as the SDK's JSON (data-props) and its kind as data-3d: answered as
+ // those, so an inspector that asks again by id shows the part's props, not the holder's
+ let mut kind = kind.0.clone();
+ if let (Some(k), Some(own)) = (props.get("data-3d").and_then(Value::as_str).map(str::to_string), props.get("data-props").and_then(Value::as_str).and_then(|t| serde_json::from_str::<serde_json::Map<String, Value>>(t).ok())) {
+ kind = k;
+ props = own;
+ props.retain(|k, _| !k.starts_with("data-raea-"));
+ }
props.retain(|k, v| k != "children" && !(k.starts_with("on") && k[2..].starts_with(|c: char| c.is_ascii_uppercase())) && !v.is_null());
let text: String = kids.map(|ks| ks.iter().filter_map(|e| w.get::<raea_runtime_react::ReactText>(e).map(|t| t.0.clone())).collect()).unwrap_or_default();
- Some(json!({"id": id, "kind": kind.0, "owner": owner, "rect": rect, "props": props, "text": text}))
+ Some(json!({"id": id, "kind": kind, "owner": owner, "rect": rect, "props": props, "text": text}))
}
pub fn step(&mut self, f: i64, keys: &[String], pointer: Option<(f64, f64, bool)>) -> R<()> {