Files

31 lines
2.8 KiB
Python

import bpy,json,os
from mathutils import Vector,Matrix
O=os.path.dirname(__file__);s=bpy.context.scene
chapters=json.load(open(O+'/tour-chapters-garden-flow.json'));fonts=[o for o in bpy.data.collections['22 PLAY - guided camera tour'].objects if o.type=='FONT'];issues=[]
for c in chapters:
s.frame_set(c['start']+30);shown=[o.data.body for o in fonts if o.scale.length>.5]
if shown!=[c['title']]:issues.append([c['title'],shown])
def ctr(n):
o=bpy.data.objects[n];return Matrix.LocRotScale(o.location,o.rotation_euler.to_quaternion(),o.scale)@(sum((Vector(v) for v in o.bound_box),Vector())/8)
names=[o.name for o in s.objects];garage=ctr('GARAGE - 8m x 7m concrete floor');med=ctr('Meditation | timber insulated floor')
report={'no_table_tennis':not any('table tennis' in n.lower() or n.startswith('PLAY DECK') for n in names),'garage_center':[round(garage.x,2),round(garage.y,2)],'meditation_center':[round(med.x,2),round(med.y,2)],'caption_issues':issues,'tour_chapters':len(chapters),'rainwater_tanks':sum(n.startswith('2000 mm') for n in names),'kitchen_preserved':all(n in names for n in ['ISLAND - honed marble countertop','OVEN - insulated glass door','INDUCTION - four zone glass cooktop']),'flower_beds':sum(n.endswith(' mulched soil') for n in names),'render_size':[s.render.resolution_x,s.render.resolution_y,s.render.resolution_percentage],'fast_excluded_from_render':bpy.data.collections['00 FAST TOUR - lightweight viewport'].hide_render}
assert report['no_table_tennis'] and not issues and report['rainwater_tanks']==2 and report['kitchen_preserved'] and report['flower_beds']==13
assert report['garage_center']==[0,-19] and report['meditation_center']==[-11.8,12]
assert s.frame_end==3600 and report['fast_excluded_from_render']
layout=json.load(open(O+'/garden-flow-layout.json'))
# Sample the shared paths against the occupied meditation and reserved east pavilion.
collisions=[]
for path in layout['paths']:
if path['kind']!='gravel' or 'future threshold' in path['name']:continue
for x,y in path['points']:
for name,cx in [('meditation',-11.8),('future east',11.8)]:
if abs(x-cx)<2.25 and abs(y-12)<2.4:collisions.append([path['name'],name])
assert not collisions,collisions
report['pavilion_path_intersections']=collisions
for name in ['Eucalyptus pale trunk.006','Eucalyptus pale trunk.007']:
p=ctr(name);assert not (5.75<p.x<13.05 and -21.6<p.y<-16.4),name
report['solar_tree_clearance']=True
s['Daily life additions']='Covered exercise area, outdoor table for ten and tea counter, garden court and flowering beds, curved walking routes and quiet bench, breakfast counter, pantry/freezer and harvest bench. Table-tennis deck removed in version 004.'
s.frame_set(1);bpy.ops.wm.save_as_mainfile(filepath=O+'/samford-solarpunk-garden-flow-tour.blend')
json.dump(report,open(O+'/garden-flow-verification.json','w'),indent=2);print('VERIFIED '+json.dumps(report),flush=True)