An AI agent skill that turns any subject into a 3D film or app
build-house-from-plan: per-item fit zones and film script hook
Nguyen Xuan An8f2ec0b4c687
diff --git a/plugins/build-house-from-plan/.claude-plugin/plugin.json b/plugins/build-house-from-plan/.claude-plugin/plugin.jsonindex 6e17987..8624b1b 100644--- a/plugins/build-house-from-plan/.claude-plugin/plugin.json+++ b/plugins/build-house-from-plan/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "build-house-from-plan",- "version": "0.2.0",+ "version": "0.2.1","description": "Turn a 2D house plan into a photoreal 3D house in Blender Cycles, checked by overlaying the build on the drawing, with stills, a build-up film and whole streets. Fit-outs too: reconciles sheets in metres and feet, checks equipment with its clearances and shows clashes in 3D with a coordination table.","author": {"name": "CodePawl",diff --git a/plugins/build-house-from-plan/skills/build-house-from-plan/references/fit-out.md b/plugins/build-house-from-plan/skills/build-house-from-plan/references/fit-out.mdindex be52565..4dc2f3c 100644--- a/plugins/build-house-from-plan/skills/build-house-from-plan/references/fit-out.md+++ b/plugins/build-house-from-plan/skills/build-house-from-plan/references/fit-out.md@@ -65,7 +65,7 @@ as a card with shape-coded marks: circle fits, triangle tight, square clash) andunit fault or clash. Fix the plan and rerun before modelling further, unless the clash is the point of the piece.`build_house.py` reads `fitout_report.json`: it builds the equipment into `furnish` and each service zone into a-`fitout` collection, a floor patch in green or amber, and a red volume up to the clear height where a zone clashes (a cut trims it 2 cm above the wall poché, so it reads as+`fitout` collection, one object per item named `fit_zone_<id>`: a floor patch in green or amber, and a red volume up to the clear height where a zone clashes (a cut trims it 2 cm above the wall poché, so it reads asred across the wall it runs into). Shots and filmsshow them unless they set `fit_zones: false`. A `build_up` film brings the zones in after the equipment lands. Rerun`fitout_check.py` before every build, since the builder trusts the report as it is.diff --git a/plugins/build-house-from-plan/skills/build-house-from-plan/references/plan-format.md b/plugins/build-house-from-plan/skills/build-house-from-plan/references/plan-format.mdindex 01d3b81..ada0b5a 100644--- a/plugins/build-house-from-plan/skills/build-house-from-plan/references/plan-format.md+++ b/plugins/build-house-from-plan/skills/build-house-from-plan/references/plan-format.md@@ -98,7 +98,10 @@ poché and hides the roof and ceilings. `films[]`: `{name, frames, path: [{pos,`build_up: {walls: [start, end], roof: [start, end], furnish: [start, end]}` (fractions of the film) lays the source sheeton the floor, aligned by the calibration pairs, grows the walls off its lines from the centre out, lands the roof andbrings in the furniture. `studio: true` gives a film the same studio floor without the sheet, for a shot cut-right after a build-up.+right after a build-up. `script: "story.py"` names a Python file beside the plan whose `setup(plan, film, scale)`+returns `frame(index, count)`. It runs before each frame, moves its own objects (a wall that slides, an item that backs+off, a zone that turns red) and may return `{pos, look}` to drive the camera. Tell the finding with that motion, not+with text over the film.## Streetsdiff --git a/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/build_house.py b/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/build_house.pyindex 7c23cbd..51ce03f 100644--- a/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/build_house.py+++ b/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/build_house.py@@ -405,8 +405,9 @@ def build_equipment(plan, collections, report):fit = json.loads(report_path.read_text(encoding="utf-8"))floor = plan["levels"].get("floor", 0.0)plain = MeshBatch("equipment_plain", 61)- zones = MeshBatch("fit_zones", 62)for row in fit.get("equipment", []):+ # One zone object per item (fit_zone_<id>), so a film script can move or recolour one item's zones.+ zones = MeshBatch(f"fit_zone_{row['id']}", 62)footprint = row["footprint_m"]width, depth, height = row["size_m"]bottom = floor + row["z0_m"]@@ -430,11 +431,11 @@ def build_equipment(plan, collections, report):# A clash stands to the clear height, so a cut shows it crossing the wall it runs into.top = floor + plan["levels"].get("ceiling", bottom + height) if status == "clash" else floor + FIT_FLOOR_PATCH_METRESzones.add_prism(zone, floor + 0.002, top, f"fit_{status}")+ if zones.faces:+ zones.finish(collections["fitout"])report.setdefault("fit", []).append({"id": row["id"], "status": row["status"], "margin_m": row["margin_m"]})if plain.faces:plain.finish(collections["furnish"], bevel=0.004)- if zones.faces:- zones.finish(collections["fitout"])def treeline_items(plan):diff --git a/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/render_house.py b/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/render_house.pyindex 3276397..c544fd1 100644--- a/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/render_house.py+++ b/plugins/build-house-from-plan/skills/build-house-from-plan/scripts/render_house.py@@ -602,6 +602,20 @@ class BuildUp:self.apply_roof(value)+def load_film_script(plan, film, scale):+ """A film's `script` is a Python file beside the plan with setup(plan, film, scale) returning frame(index, count).++ It animates what a camera path cannot: a wall that rises, an item that slides, a zone that changes colour."""+ if not film.get("script"):+ return None+ import importlib.util+ path = pathlib.Path(options_plan_folder) / film["script"]+ spec = importlib.util.spec_from_file_location(path.stem, path)+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module.setup(plan, film, scale)++def render_film(plan, film, scale, out_folder, frame_limit):frames = int(frame_limit or film["frames"])folder = out_folder / film["name"]@@ -630,6 +644,7 @@ def render_film(plan, film, scale, out_folder, frame_limit):bpy.data.objects["plan_sheet"].hide_render = Truebpy.context.view_layer.layer_collection.children["site"].exclude = Truemelt_studio_horizon(measure_floor_colour(camera))+ story = load_film_script(plan, film, scale)for frame in range(frames):target_path = folder / f"f{frame:04d}.png"if target_path.exists():@@ -638,6 +653,11 @@ def render_film(plan, film, scale, out_folder, frame_limit):build_up.apply(frame / max(1, frames - 1))fraction = eased(frame / max(1, frames - 1))now = {"pos": list(catmull(positions, fraction)), "look": list(catmull(targets, fraction)), "level": film.get("level", True)}+ if story is not None:+ # The script moves its own objects for this frame and may return {"pos", "look"} to drive the camera.+ camera_override = story(frame, frames)+ if camera_override:+ now.update(camera_override)aim_camera(camera, now, scale)bpy.context.view_layer.update()if stops_at_points: