import bpy,json,time,statistics,os from mathutils import Vector OUT=os.path.dirname(os.path.abspath(__file__)) s=bpy.context.scene original=list(s.objects) visible=[o for o in original if o.visible_get()] render_flags={o:o.hide_render for o in original} render_settings=(s.render.engine,s.render.resolution_percentage,s.render.filepath) def preview(tag,objects): for o in s.objects:o.hide_render=o not in objects s.render.engine='BLENDER_WORKBENCH';s.render.resolution_percentage=40 s.display.shading.light='STUDIO';s.display.shading.color_type='MATERIAL' s.display.shading.show_shadows=False;s.display.shading.show_cavity=False s.display.shading.show_specular_highlight=False times=[] for f in [1,60,2460]: s.frame_set(f);s.render.filepath=os.path.join(OUT,tag+('-garage' if f==2460 else '')+'.png') t=time.perf_counter();bpy.ops.render.render(write_still=f!=60);times.append(time.perf_counter()-t) return times base_objects={o for o in visible if o.display_type not in {'WIRE','BOUNDS'}} baseline=preview('performance-before',base_objects) for o,flag in render_flags.items():o.hide_render=flag s.render.engine=render_settings[0] s.frame_set(1) fast=bpy.data.collections.new('00 FAST TOUR - lightweight viewport');s.collection.children.link(fast) fast.hide_render=True def combined(name,objects): verts=[];faces=[];indices=[];smooth=[];materials=[];mat_map={} for o in objects: me=o.data;is_leaf='individual canopy leaves' in o.name mi=[] for mat in me.materials: if mat not in mat_map: mat_map[mat]=len(materials);materials.append(mat) mi.append(mat_map[mat]) def material_idx(i):return mi[i] if mi and i