30 lines
1.8 KiB
Python
30 lines
1.8 KiB
Python
"""Audit saved props, image links, contact with the floor, and camera cuts."""
|
|
from pathlib import Path
|
|
import json
|
|
import bpy
|
|
from mathutils import Vector
|
|
|
|
ROOT=Path(__file__).resolve().parents[2]
|
|
bpy.ops.wm.open_mainfile(filepath=str(ROOT/'assets/cinematics/blender/eblan-workshop-v5.blend'))
|
|
scene=bpy.context.scene;missing=[]
|
|
for image in bpy.data.images:
|
|
if image.source in {'FILE','SEQUENCE'} and not image.packed_file:
|
|
if not Path(bpy.path.abspath(image.filepath)).is_file():missing.append(image.filepath)
|
|
assert not missing,missing
|
|
assert (scene.render.resolution_x,scene.render.resolution_y)==(1920,1080)
|
|
assert scene.frame_start==1 and scene.frame_end==576 and scene.render.fps==24
|
|
cans=[o for o in scene.objects if o.name.startswith('Energy / complete')]
|
|
assert len(cans)==40,len(cans)
|
|
assert sum(bool(o.get('floor_litter')) for o in cans)==18
|
|
assert len([o for o in cans if o.get('crushed')])==9
|
|
assert [m.frame for m in scene.timeline_markers if m.camera]==[1,121,265,409]
|
|
observed=[]
|
|
for frame in [1,120,121,264,265,408,409,576]:
|
|
scene.frame_set(frame);observed.append((frame,scene.camera.name))
|
|
assert scene.camera.name.startswith('01' if frame<=120 else '02' if frame<=264 else '03' if frame<=408 else '04')
|
|
floor_poses=[dict(name=o.name,position=list(o.location)) for o in cans if o.get('floor_litter')]
|
|
assert all(-2<o['position'][0]<2 and -2<o['position'][1]<1 and -.01<o['position'][2]<.58 for o in floor_poses),floor_poses
|
|
report=dict(resolution=[1920,1080],frames=576,fps=24,duration=24,shots=4,cans=40,crushed=9,
|
|
floor_litter=floor_poses,objects=len(scene.objects),camera_cuts=observed,missing_images=missing)
|
|
(ROOT/'build/cinematic-v5/source-audit.json').write_text(json.dumps(report,indent=2)+'\n')
|
|
print('V5_SOURCE_AUDIT_PASS / 40 cans / 9 crushed / 18 settled floor props / 4 cuts / portable images')
|