Files
shinyobjectz 8a9236fffa BL28: raea setup blender installs raea's add-on, and a script drives the person's own Blender live
- raea setup blender copies sdk/blender/python/raea_blender into that Blender's add-ons folder (replacing an older
  copy) and enables it, beside the MCP add-on; --check says whether it is current and on. Started with its window,
  that Blender serves raea/blender on 127.0.0.1 behind a token (~/.raea/blender/live.json).
- The add-on serves only a Blender with a window: a background one (a command-line render, setup's own checks) would
  hide the person's open Blender behind its own live.json.
- Fixed: Blender 5.2 gives a timer the window but no area, so the bridge's ui_context left view3d operators with no 3D
  view; it now fills in the area whenever there is none.
- Fixed, headless too: a slot freed by garbage collection was freed at the head of the next batch, before the read an
  await had queued for it ("reference N was released or never set"). Frees now go last, and are sent again after a
  batch that fails before them. test/bridge.test.ts forces the race: it failed before the fix and passes after.
- test/live.ts, run by hand (it opens a window): setup in a scratch BLENDER_USER_RESOURCES, Blender started with its
  window, a cube made, moved and put in edit mode and view3d.snap_cursor_to_center run, on the main thread in the 3D
  view; once Blender quits, connect({ live: true }) refuses its live.json.
- The CLI reference (docs/manual/reference/cli: setup, blender, index) follows the help.

Proven: cargo test -p raea-app-tools; sdk/blender's tsc and its 14 bun tests against Blender 5.2.1; test/live.ts 5 of 5
runs; the race test 5 of 5; bun tools/manual-ref/cli.ts check.
2026-11-10 21:42:49 -08:00

28 lines
1.0 KiB
Python

# raea's bridge for Blender: lets TypeScript (raea/blender) script this Blender through the same Python API a script
# would use. As an add-on it serves the running Blender (writing ~/.raea/blender/live.json for connect()); headless,
# python/headless.py runs it as the whole of a background Blender's run (raea/blender's launch(), raea blender run).
bl_info = {
"name": "raea bridge",
"author": "raea",
"version": (0, 1, 1),
"blender": (4, 2, 0),
"location": "Starts with Blender",
"description": "Lets raea/blender scripts in TypeScript drive this Blender",
"category": "Development",
}
def register():
import bpy
if bpy.app.background:
# a windowless Blender (a render from the command line, `raea setup blender`'s own checks) serves nobody, and
# its live.json would hide the Blender the person has open; headless runs serve through python/headless.py
return
from . import server
server.start_gui()
def unregister():
from . import server
server.stop_gui()