# Luw.ai for Blender

> Take your Luw.ai Studio projects into Blender: one press of Send to Blender in the Studio, or a project's link in Blender. A collection per floor, objects named as in the Studio, materials kept, and a sun and sky for the Studio's time of day.

## What it does

**Luw.ai for Blender** takes your Luw.ai Studio projects into Blender. Press **Send to Blender** in the Studio (Settings › Export, or the Export window) and the project arrives in the Blender you have open; or, without the Studio, paste a project's link in Blender and it reads the project with your Luw.ai API key.

- **A collection per floor, and per kind.** The project is one collection named after it, holding one collection per level (top floor first, as the Studio lists them) and **Site** for what stands outside the building. Inside a level, one collection per kind, named with its level (“Walls · Ground floor”, as Blender wants each name once): Walls, Doors, Windows, Items, Rooms, Slabs, Ceilings, Roofs, Stairs, Columns…
- **Your names.** Every object is named as in the Studio (Kitchen, Kitchen window, Sofa) and keeps its Studio id, kind and name as custom properties (`luw_id`, `luw_kind`, `luw_label`). Rooms carry their floor area (`luw_area_m2`), doors and windows their width, height and sill (`luw_width_m`, `luw_height_m`, `luw_sill_m`) and the wall they are in.
- **Rooms you can see.** Each room is drawn as a see-through floor in its Studio colour, from its outline (holes included), in the viewport only: renders leave it out.
- **Doors and windows that open.** Each door and window that opens in the Studio brings its one-second opening as an NLA track named **Open** on the part that moves (windows with shutters also **Shutters**): play it, or push it into your own animation.
- **Materials kept, and polished.** Blender's own glTF importer reads the model, colours and textures included. Then (on by default) a plain see-through surface becomes real glass, a picture whose alpha cuts shapes out (leaves, slats) gets that alpha, and the site's own ground a calmer colour.
- **Light.** On by default: a sun and a physical sky, a wide ground under the site, and a camera framing the building (press **Numpad 0** to look through it), in a **Luw.ai light** collection. Pick **Like the Studio** (the time of day you set in the Studio, at the project's address, its north included), **Daylight**, **Golden hour**, **Overcast** or **Night** in the Luw.ai tab, and press the refresh button beside it to light again. **Night** adds a warm light in every room and one at the front door, in their own collection that the other lights take away. EEVEE gets shadows and ray tracing, Cycles denoising; the add-on's preferences can switch the render engine on import.
- **Metres.** The scene is set to metric units, 1 unit = 1 m.
- **Send again.** A new send of the same project replaces the one in Blender, with no `.001` copies left behind. Tick **Keep the earlier one** (in the Studio, or in the Luw.ai tab) to keep it instead, unticked in the Outliner and named “(earlier)”.

> AI-generated concept, not for construction or renovation. Get a licensed architect or engineer's review and permits first.

## Install

1. Download [Luw.ai for Blender (zip)](https://studio.luw.ai/developers/blender/luw_ai.zip). It needs Blender 4.2 or later.
2. In Blender: **Edit › Preferences › Get Extensions**, the menu at the top right (⌄), **Install from Disk…**, and pick the zip. Or drag the zip into Blender’s window.
3. Open the 3D view’s sidebar (press **N**) and its **Luw.ai** tab: it says **Listening on 127.0.0.1:47811** and shows a **pairing code**.

The add-on listens as soon as Blender opens; turn that off, or change the port, in its preferences (Edit › Preferences › Add-ons › Luw.ai for Blender). When its port is taken it takes one of the next four, and the Studio looks there too. The listener is a small process of its own, run with Blender’s own Python: Blender opens no network connection itself and never waits on one, the scenes come to it through a temporary folder, and the listener stops with Blender (or by itself a little after Blender is gone).

## Send from the Studio

1. In the Studio, open **Settings › Export** and press **Send to Blender** under 3D model (or **Blender** in the Export window’s 3D model row).
2. The first time, the Studio asks for the code Blender shows. Type it once: this browser is then paired with this Blender, and the code changes for the next one.
3. The Studio makes the model (its own GLB export, with the concept notice), sends it with the project's levels, rooms, doors and windows, and says what Blender imported: “Sent to Blender. Imported 2 levels, 214 objects, 9 rooms, 14 doors and windows into “House”, with a sun 38° up and a sky.”

**Add sun and sky** and **Keep the earlier one** beside the button are remembered in your browser. The model holds what the 3D view shows: hidden objects stay out.

### When the Studio does not find Blender

- Blender is open and the add-on is turned on: its Luw.ai tab says **Listening**. If it says the port is taken, pick another port in the add-on’s preferences and type the same port in the Studio (“Blender uses another port”, under the code).
- Chrome and Edge may ask whether studio.luw.ai may reach devices on your network: allow it. Firefox needs nothing.
- Safari may keep a website from reaching programs on your computer; use Chrome, Edge or Firefox to send.
- A Studio on another address than studio.luw.ai (your own copy for development, say): add that address in the add-on’s preferences under **Other sites allowed to send**, or press **Allow this site** in the Luw.ai tab after it tried once.

## Import a project by link

Without the Studio open: **File › Import › Luw.ai Studio project (link)**, or **Import a project by link…** in the Luw.ai tab. Paste the project's address from the Studio (`https://studio.luw.ai/editor?project=1301391`) or its id (`luw-1301391`), choose whether to add a sun and sky and for which day and sun time, and press OK. The add-on reads the project from the [Studio API](https://studio.luw.ai/developers/api#scenes) (`https://studio.luw.ai/api/v1`) with your key: `GET /v1/scenes/{id}` for its levels, rooms and openings and `GET /v1/scenes/{id}/glb` for the model. It only reads; it never changes the project.

- Make a key on app.luw.ai's [API & MCP page](https://app.luw.ai/dashboard/api) and paste it in the add-on's preferences (**Luw.ai API key**). It is sent to the Studio API only, never to the address the model is downloaded from.
- Blender must be allowed online (Preferences › System › Network › Allow Online Access).
- A share link (`/s/…`) shows a project but does not name it: open the project and copy its address instead. The sun time is the sun's own clock at the site: 12 is about when it stands highest.

## Privacy and safety

- The listener answers on **127.0.0.1** only, so nothing on your network or the internet reaches it; it refuses a request whose address is not 127.0.0.1 or localhost (a site that points its own name at your computer gets nothing).
- It talks only to the sites it allows: studio.luw.ai and any you add. Any other site gets no answer it can read, so it cannot even tell Blender is there.
- A site it allows still needs the **pairing code**, typed by you once per browser. Five wrong codes change the code and wait 30 seconds. Blender keeps a fingerprint (a hash) of each browser’s pass, never the pass itself; **Forget paired browsers** in the Luw.ai tab or the preferences ends them all.
- Models wait in a temporary folder only while they are imported, and are removed after.

## What the model file holds

The model is plain glTF 2.0 (the Studio's own Export GLB, with its concept notice in `asset.extras.notice`). Every Studio object is a glTF node named by its id, with these `extras`, which Blender's importer keeps as custom properties:

| Extra | What it is |
| --- | --- |
| `luwId` | The object’s id in the Studio, also the node’s name. |
| `kind` | `site`, `building`, `level`, `wall`, `door`, `window`, `item`, `zone` (a room), `slab`, `ceiling`, `roof`, `stair`, `column`, `spawn`… and a plugin’s own kinds. |
| `label` | The name the Studio shows. |
| `openable`, `clips` | A door or window that opens: its clips, `"<luwId>: open"` (1 second) and, with shutters, `"<luwId>: shutters"`, glTF animations on the part that moves. |
| `polygon`, `holes`, `color` | A room: its outline as `[x, z]` points in its level (glTF is y-up), its holes, its colour. The Studio leaves the room’s fill out of the model. |

A send also carries the project’s scene (`GET /v1/scenes/{id}` gives the same for a link): the add-on reads the levels, the rooms’ areas and ceilings, the doors’ and windows’ sizes and which walls face outside from it.

## The protocol

For your own tools: JSON over HTTP on `http://127.0.0.1:47811`, every answer `no-store`. A browser page needs its site allowed (the answer carries CORS and Private Network Access headers only for those); every request but `hello` and `pair` carries `Authorization: Bearer <token>`.

| Request | Answer |
| --- | --- |
| `GET /luw/v1/hello` | `{app, version, blender, port, paired}`; `paired` says whether the token sent is still this Blender’s. |
| `POST /luw/v1/pair` | Body `{code, name}`: `{token}`, or `{error}` with `code` `wrong_code` (and `attempts_left`) or `locked` (and `retry_after`). |
| `POST /luw/v1/sends` | Body `{project: {id, name, url}, sky: {azimuth, elevation, north_rotation, instant, lat, lng} \| null, scene, options: {lighting, preset?, keep_earlier?, polish?}}`, `scene` being the Studio scene (as the Studio API’s `GET /v1/scenes/{id}` gives it): `201 {id, model}`. |
| `PUT /luw/v1/sends/{id}/model` | The GLB (`model/gltf-binary`, up to 1 GB): `202 {id, state: "queued"}`. |
| `GET /luw/v1/sends/{id}` | `{id, state, summary?, error?}`, `state` one of `waiting-model`, `queued`, `importing`, `done`, `failed`. |
| `POST /luw/v1/unpair` | Forgets the token sent. |

## Licence and source

Blender asks that add-ons using its Python API be GPL-compatible, so Luw.ai for Blender is free software under the **GNU General Public License, version 3 or later**; its source and the licence text are in the zip. It is a separate program from Luw.ai Studio, which talks to it only through the protocol above and the public Studio API, and which stays under Luvi Technologies’ own terms.
