feat: track remaining production assets, playtest scenes and references
Close the gaps left open after the LFS migration: 177 files that were sitting untracked now enter version control, with every binary going through Git LFS. - labels: milk and orange-juice wrap artwork (SVG/PNG), Seedream sources, prompts and Dreamina job records - orange juice 2L: bottle, cap, empty state and three label variants (blend + glb each) - cup contents: desktop and mobile-optimised variants plus 3 textures - milk 2L: empty and packaged variants with their glb exports - milk frother: low-poly assembly and split base/jug parts - tamper: model, glb and fit test - juicer: seven assembly-part review scenes and their export scripts - playtests: extraction animation scene and grinding/tamping whitebox - reference: Minex page candidates, user review screenshots, sequence analysis frames and tamper STLs - docs: item design draft, bean research notes, region reference and the model-asset audit report Re-renderable preview/check frames stay untracked on purpose.
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
import bpy
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from mathutils.bvhtree import BVHTree
|
||||
|
||||
ROOT = Path('/Users/yanchenyu/Documents/WebApps/PerfetCoffee')
|
||||
OUT = ROOT / 'playtests' / 'grinding_tamping'
|
||||
SOURCES = {
|
||||
'grinder': ROOT / 'model_assets' / 'bean_grinder' / 'ElectricCoffeeGrinder_LowPoly.blend',
|
||||
'portafilter': ROOT / 'model_assets' / 'coffee_machine' / 'PerfectCoffee_Portafilter.blend',
|
||||
'tamper': ROOT / 'model_assets' / 'tamper' / 'PerfectCoffee_Tamper.blend',
|
||||
}
|
||||
bpy.ops.wm.open_mainfile(filepath=str(OUT / 'Grinding_Tamping_Whitebox.blend'))
|
||||
scene = bpy.context.scene
|
||||
assert scene.frame_end == 168 and scene.render.fps == 24
|
||||
assert len(scene.timeline_markers) == 12
|
||||
assert len(bpy.data.libraries) == 0
|
||||
assert bpy.data.objects['CM_Portafilter_Bowl'].parent.name == 'CM_Portafilter'
|
||||
assert not any(obj.name.startswith('CM_Portafilter.') for obj in bpy.data.objects)
|
||||
assert not bpy.data.objects['CM_Portafilter_Bowl'].hide_render
|
||||
|
||||
|
||||
def evaluated_mesh(obj, depsgraph):
|
||||
evaluated = obj.evaluated_get(depsgraph)
|
||||
mesh = evaluated.to_mesh()
|
||||
points = [evaluated.matrix_world @ vertex.co for vertex in mesh.vertices]
|
||||
polygons = [tuple(polygon.vertices) for polygon in mesh.polygons]
|
||||
evaluated.to_mesh_clear()
|
||||
return points, polygons
|
||||
|
||||
|
||||
def bvh(obj, depsgraph):
|
||||
points, polygons = evaluated_mesh(obj, depsgraph)
|
||||
return BVHTree.FromPolygons(points, polygons, all_triangles=False, epsilon=0.0)
|
||||
|
||||
|
||||
def overlap(a, b, depsgraph):
|
||||
return len(bvh(a, depsgraph).overlap(bvh(b, depsgraph)))
|
||||
|
||||
|
||||
portafilter = [obj for obj in bpy.data.objects if obj.type == 'MESH' and obj.name.startswith('CM_Portafilter_')]
|
||||
tamper = [bpy.data.objects['TAM_Metal_Base'], bpy.data.objects['TAM_Wood_Handle']]
|
||||
grinder = [bpy.data.objects['Low | Grinder body'], bpy.data.objects['Low | Removable support']]
|
||||
powder = bpy.data.objects['WB_Powder_Fill_And_Tamp']
|
||||
bowl = bpy.data.objects['CM_Portafilter_Bowl']
|
||||
collisions = []
|
||||
checked = []
|
||||
|
||||
|
||||
def check_frame(frame, pf_grinder=False, tamper_pf=False, powder_bowl=False):
|
||||
scene.frame_set(frame)
|
||||
bpy.context.view_layer.update()
|
||||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
checked.append(frame)
|
||||
if pf_grinder:
|
||||
for a in portafilter:
|
||||
for b in grinder:
|
||||
pairs = overlap(a, b, depsgraph)
|
||||
if pairs:
|
||||
collisions.append({'frame': frame, 'a': a.name, 'b': b.name, 'pairs': pairs})
|
||||
if tamper_pf:
|
||||
for a in tamper:
|
||||
for b in portafilter:
|
||||
pairs = overlap(a, b, depsgraph)
|
||||
if pairs:
|
||||
collisions.append({'frame': frame, 'a': a.name, 'b': b.name, 'pairs': pairs})
|
||||
if powder_bowl:
|
||||
pairs = overlap(powder, bowl, depsgraph)
|
||||
if pairs:
|
||||
collisions.append({'frame': frame, 'a': powder.name, 'b': bowl.name, 'pairs': pairs})
|
||||
|
||||
|
||||
for frame in list(range(1, 15)) + list(range(84, 109)):
|
||||
check_frame(frame, pf_grinder=True, powder_bowl=frame >= 14)
|
||||
for frame in range(109, 157):
|
||||
check_frame(frame, tamper_pf=True, powder_bowl=frame <= 126)
|
||||
for frame in (122, 123, 124, 125, 126, 132):
|
||||
scene.frame_set(frame)
|
||||
bpy.context.view_layer.update()
|
||||
powder_peak = max(point.z for point in evaluated_mesh(powder, bpy.context.evaluated_depsgraph_get())[0])
|
||||
tamper_bottom = bpy.data.objects['TAM_Tamper_Assembly'].location.z
|
||||
assert powder_peak <= tamper_bottom + 0.00001, (frame, powder_peak - tamper_bottom)
|
||||
|
||||
scene.frame_set(1)
|
||||
report = {
|
||||
'frame_count_checked': len(checked),
|
||||
'frames_checked': checked,
|
||||
'collisions': collisions,
|
||||
'continuous_contact_sync_passed': True,
|
||||
'reopen_checks': {
|
||||
'frame_end': scene.frame_end,
|
||||
'fps': scene.render.fps,
|
||||
'timeline_markers': len(scene.timeline_markers),
|
||||
'independent_append_no_linked_libraries': len(bpy.data.libraries) == 0,
|
||||
'correct_portafilter_parent': True,
|
||||
'bowl_visible_on_open': not bowl.hide_render,
|
||||
'default_camera': scene.camera.name,
|
||||
'opens_at_frame': scene.frame_current,
|
||||
},
|
||||
'source_hashes_after': {name: hashlib.sha256(path.read_bytes()).hexdigest() for name, path in SOURCES.items()},
|
||||
'passed': not collisions,
|
||||
}
|
||||
(OUT / 'motion_validation.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf-8')
|
||||
print('WHITEBOX_MOTION_VALIDATION=' + json.dumps(report, ensure_ascii=False), flush=True)
|
||||
assert report['passed'], 'Motion sweep found collisions; inspect motion_validation.json'
|
||||
print('WHITEBOX_REOPEN_AND_MOTION_PASSED', flush=True)
|
||||
Reference in New Issue
Block a user