"""Reopen a saved v010 scene and validate the pattern-language revision.""" import bpy import json from pathlib import Path from mathutils import Vector s = bpy.context.scene detail = bpy.data.collections['DETAIL - full geometry for renders'] detail.hide_viewport = False bpy.context.view_layer.update() def bounds(name): ob = bpy.data.objects[name] pts = [ob.matrix_world @ Vector(c) for c in ob.bound_box] return [min(p[i] for p in pts) for i in range(3)], [max(p[i] for p in pts) for i in range(3)] new = {'40 PATTERN - children realm': 'CHILDREN\'S REALM', '41 PATTERN - common room height and alcoves': 'ALCOVE', '42 PATTERN - elder cottage': 'ELDER COTTAGE', '43 PATTERN - entrance transition arbour': 'ENTRANCE ARBOUR'} counts = {} for cname, prefix in new.items(): objs = list(bpy.data.collections[cname].objects) assert objs and all(o.name.startswith(prefix) for o in objs), cname proxy = bpy.data.objects['FAST | ' + cname] assert proxy.hide_render and len(proxy.data.vertices) > 0 counts[cname] = len(objs) # Common room is 0.6 m higher; corridor and breezeway are not. assert abs(bounds('Bamboo ceiling lining board')[0][2] - (3.83 + .6)) < .02 assert abs(bounds('Exposed roof rafter.010')[1][2] - (4.52 + .6)) < .02 assert abs(bounds('Short corridor insulated roof')[1][2] - 3.69) < .02 assert abs(bounds('Curved breezeway pale roof')[1][2] - 3.72) < .02 assert abs(bounds('Insulated concrete floor slab')[1][2] - 1.12) < .01 # Alcove openings: the south wall and west wall are split around clear openings. for stem in ('South insulated timber wall', 'Living west wall | clear corridor opening.001'): for tag in ('A', 'B', 'head'): assert stem + ' | alcove ' + tag in bpy.data.objects, (stem, tag) assert stem not in bpy.data.objects head = bounds('South insulated timber wall | alcove head') assert abs(head[0][2] - 3.22) < .01 and abs(head[1][2] - 4.42) < .02 assert 'Small homelab work desk' not in bpy.data.objects assert 'ALCOVE study nook | built-in hardwood desk' in bpy.data.objects for name in ('Desk display', 'Desk timber stool'): mn, mx = bounds(name) assert mn[0] > 2.5 and mx[0] < 4.3 and mn[1] > -4.35, name # New modules sit where the plan says. k = bounds("CHILDREN'S REALM | insulated floor slab") assert abs(k[0][0] + 16.8) < .01 and abs(k[1][0] + 8.4) < .01 and abs(k[1][1] - 4.8) < .01 e = bounds('ELDER COTTAGE | insulated floor slab') assert abs(e[0][0] - 9.6) < .01 and abs(e[1][0] - 16.8) < .01 and abs(e[0][1] - 9.4) < .01 # Future shadows: east space now built, north and north-east remain. later = [o.name for o in bpy.data.collections['24 LATER - Shadow spaces only'].objects] assert not any(n.startswith('Future space 1') for n in later) assert any(n.startswith('Future space 2') for n in later) and any(n.startswith('Future space 3') for n in later) required = ['ISLAND - honed marble countertop', 'FAST | Garden Buddha statue', 'CONTAINER WATER - steel base frame', 'Living woven jute rug', 'WIND - tapered freestanding mast', 'Fuller garden borders - curved lanceolate leaves'] assert all(n in bpy.data.objects for n in required) assert not any('table tennis' in o.name.lower() for o in s.objects) assert all(m in bpy.data.materials.values() for o in s.objects if o.type == 'MESH' for m in o.data.materials if m) fonts = [o for o in bpy.data.collections['22 PLAY - guided camera tour'].objects if o.type == 'FONT'] captions = [] for frame in range(1, 4321, 120): s.frame_set(frame + 20) visible = [o.data.body for o in fonts if o.scale.length > .5] assert len(visible) == 1, (frame, visible) captions.append(visible[0]) assert captions[32].startswith('33 /') and captions[-1].startswith('36 /') assert s.frame_end == 4320 and s.camera.name == 'PLAY TOUR camera' report = dict(status='PASS', model=Path(bpy.data.filepath).name, tour_chapters=36, tour_seconds=180, common_room_ceiling_raise_m=.6, common_room_clear_height_m={'south': 3.3, 'north': 4.0}, alcoves=['south study nook', 'west window seat'], alcove_clear_height_m=2.1, new_collections=counts, future_shadows=sorted({n.split(' |')[0] for n in later if n.startswith('Future space')}), captions=captions, preserved_features=required, material_references_valid=True, dimensions_status='Concept geometry on unsurveyed terrain; not engineered') target = Path(bpy.data.filepath).with_suffix('.verification.json') target.write_text(json.dumps(report, indent=2) + '\n') print('PATTERN_VERIFIED', target, flush=True)