Preserve homestead context and garden-centred Blender design
This commit is contained in:
38
source/samford-modular/render_final.py
Normal file
38
source/samford-modular/render_final.py
Normal file
@@ -0,0 +1,38 @@
|
||||
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 15<c.x<28 and 5<c.y<15:
|
||||
ob.location.y-=23; ob.location.z+=.55
|
||||
s['Orchard canopy clearance applied']=True
|
||||
names=[o.name for o in s.objects]
|
||||
counts={
|
||||
'solar_panels':sum(n.startswith('PV panel glass and cells') for n in names),
|
||||
'rainwater_tanks':sum(n.startswith('2000 mm dark green poly rainwater tank') for n in names),
|
||||
'raised_garden_beds':sum(n.startswith('Raised vegetable bed soil') for n in names),
|
||||
'sliding_door_panels':sum(n.startswith('Sliding glass pane') and o.location.y>3 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)
|
||||
Reference in New Issue
Block a user