Files
..
BL36, BL37, BL38, BL39, GD11, GD12, GD13: Blender and Godot in a raea project: shots drawn by them, the scene sent to them and its changes read back. raea scene export EDIT.tsx -o DIR [--frame N | --at A-B] writes the composition's 3D as scene.json (each part's id, kind, name, TSX line from the bundle's source stamps, placement, material, primitive sizes; other meshes as .glb, models copied with their sidecars; lights, camera, ambient, background; what doesn't cross listed in left) (new crate apps/interchange). raea blender open builds it in Blender through raea/blender (sdk/blender scene.ts: Blender's own meshes, Principled BSDFs, lights and camera keyed on --at, raea_id on each object) and opens the .blend; raea blender back and raea godot back read the file back and say each move, colour, light, camera and deletion as an edit at its TSX line, and write objects made there as media/NAME.glb. raea godot export writes a Godot project that runs (native meshes, StandardMaterial3D, an AnimationPlayer for --at, still channels left out, nodes named for their parts); raea godot run takes --scene with no script (host/none.ts). <BlenderShot> and <GodotShot> (raea/blender/shot, raea/godot/shot) render their frames once per bundle, file, props, size, fps and length, sized from their Sequence's end, kept in the asset store (native calls blender.shot, godot.shot; raea blender shot, raea godot shot). register_natives() gathers every native call a composition's thread answers, so raea types lists them all. Tests: apps/interchange (9), apps/engines
2026-11-11 09:35:16 -08:00
BL36, BL37, BL38, BL39, GD11, GD12, GD13: Blender and Godot in a raea project: shots drawn by them, the scene sent to them and its changes read back. raea scene export EDIT.tsx -o DIR [--frame N | --at A-B] writes the composition's 3D as scene.json (each part's id, kind, name, TSX line from the bundle's source stamps, placement, material, primitive sizes; other meshes as .glb, models copied with their sidecars; lights, camera, ambient, background; what doesn't cross listed in left) (new crate apps/interchange). raea blender open builds it in Blender through raea/blender (sdk/blender scene.ts: Blender's own meshes, Principled BSDFs, lights and camera keyed on --at, raea_id on each object) and opens the .blend; raea blender back and raea godot back read the file back and say each move, colour, light, camera and deletion as an edit at its TSX line, and write objects made there as media/NAME.glb. raea godot export writes a Godot project that runs (native meshes, StandardMaterial3D, an AnimationPlayer for --at, still channels left out, nodes named for their parts); raea godot run takes --scene with no script (host/none.ts). <BlenderShot> and <GodotShot> (raea/blender/shot, raea/godot/shot) render their frames once per bundle, file, props, size, fps and length, sized from their Sequence's end, kept in the asset store (native calls blender.shot, godot.shot; raea blender shot, raea godot shot). register_natives() gathers every native call a composition's thread answers, so raea types lists them all. Tests: apps/interchange (9), apps/engines
2026-11-11 09:35:16 -08:00

raea/godot

Godot's whole API from TypeScript, through GodotJS (MIT): every class, singleton, enum and builtin of Godot 4.6.1, typed, run in Godot on its own JavaScript engine (JavaScriptCore on the Mac, QuickJS-ng on Windows and Linux).

raea setup godot                 # GodotJS's Godot 4.6.1, pinned by sha256, into ~/.raea/tools/godot
raea godot run drop.ts           # the script's default export gets the SceneTree; Godot quits when it returns
raea godot run drop.ts --window  # with a window (headless otherwise)
raea godot types game/           # a project's own typings: its scenes, resources and input actions
raea godot open game/            # the Godot editor on the project
import { BoxMesh, MeshInstance3D, Vector3, frames, type SceneTree } from "raea/godot";

export default async function (tree: SceneTree, args: string[]) {
  const box = new MeshInstance3D();
  box.mesh = new BoxMesh();
  box.position = new Vector3(0, 1, 0);
  tree.root!.add_child(box);
  await frames(tree, 2);
  console.log(box.global_position.y);
}

A script imports from raea/godot (which also brings the types in) or from godot, as GodotJS's own scripts do. Godot's names are Godot's: get_child_count(), global_position, snake_case as in GDScript.

The script runs in Godot, not on raea's engine: raea godot run bundles it with raea's bundler, GodotJS's modules standing in (src/shim), and Godot loads it beside src/host/main.js, its main loop. The project is --project DIR, else the nearest project.godot above the script, else an empty one.

Things to know:

  • Paths. Godot runs inside the project's folder, so "media/a.glb" is a file in the project. resolve("media/a.glb") is that path where raea ran; cwd() is that folder.
  • An own main loop. A default export that is a SceneTree (or MainLoop) subclass is Godot's main loop as it is: _initialize(), then _process(delta) each frame, before Godot draws it; it quits itself. Code that must run on frame N (a recording) belongs there, not after an await frame(tree).
  • A callback that throws (_process, a signal) stops the run with exit 1: Godot itself would log it and carry on.
  • Movies. --movie out/f.png is Godot's Movie Maker: each frame drawn in a window kept on top (macOS stops drawing a covered window, and Movie Maker would write its last frame again) and written at --fps. It records the project's window size: --size WxH sets it for a run with no project; a project sets display/window/size/viewport_width and _height in its project.godot (raea refuses a --size that differs).

Files

  • src/index.ts: raea/godot, the godot module re-exported, Main, frame, frames, cwd and resolve.
  • src/types/: generated by tools/gen.sh from GodotJS's codegen (--generate-types); resources.d.ts is raea's. LICENSE there credits GodotJS and Godot (both MIT).
  • src/shim/: the bundle's stand-ins for GodotJS's modules; names.gen.js is generated (tools/names.ts).
  • src/host/main.js: the main loop raea godot run gives Godot.
  • test/typing.ts (tsc), test/run.test.ts (bun test, against the installed Godot).

The spec is docs/godot.feature; the pin and the verbs are apps/engines/src/godot.rs and godot_run.rs.