import bpy, os, json from mathutils import Vector from bpy_extras.object_utils import world_to_camera_view OUT=os.path.dirname(os.path.abspath(__file__)) s=bpy.context.scene if not s.get('Orchard canopy clearance applied'): for ob in bpy.data.collections['09 Eucalyptus and fruit trees'].objects: if ob.type!='MESH': continue c=ob.matrix_world@(sum((Vector(v) for v in ob.bound_box),Vector())/8) if 153 for n,o in zip(names,s.objects)), 'future_pier_stubs':sum('installed concrete pier stub' in n for n in names), } assert counts['solar_panels']==30,counts assert counts['rainwater_tanks']==2,counts assert counts['raised_garden_beds']==6,counts assert counts['sliding_door_panels']==6,counts assert counts['future_pier_stubs']==8,counts s.render.resolution_x=2560; s.render.resolution_y=1440; s.render.resolution_percentage=100 s.cycles.samples=96; s.cycles.adaptive_threshold=.025; s.cycles.use_denoising=True prefs=bpy.context.preferences.addons['cycles'].preferences prefs.compute_device_type='METAL'; prefs.get_devices() for d in prefs.devices: d.use=d.type=='METAL' s.cycles.device='GPU' if any(d.type=='METAL' for d in prefs.devices) else 'CPU' s.render.filepath=os.path.join(OUT,'samford-modular-final.png') report={'render_engine':s.render.engine,'resolution':[2560,1440],'counts':counts,'objects':len(s.objects),'packed_external_textures_required':False} with open(os.path.join(OUT,'scene-checks.json'),'w') as f: json.dump(report,f,indent=2) print('SCENE_CHECKS',json.dumps(report),flush=True) bpy.ops.wm.save_as_mainfile(filepath=os.path.join(OUT,'samford-modular-home.blend')) bpy.ops.render.render(write_still=True) print('FINAL_RENDER_COMPLETE',flush=True)