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,169 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
OUT = Path(__file__).resolve().parent
|
||||
ROOT = OUT.parents[1]
|
||||
ASSET = ROOT / "orange_juice_2l"
|
||||
BLEND = ASSET / "PerfectCoffee_orange_juice_2l.blend"
|
||||
GLB = ASSET / "PerfectCoffee_orange_juice_2l.glb"
|
||||
REPORT = ASSET / "validation.json"
|
||||
STATE = OUT / "application_validation.json"
|
||||
BODY = "OrangeJuice_Bottle_Body"
|
||||
LABEL_MATERIAL = "OrangeJuice_Label"
|
||||
|
||||
|
||||
def sha256(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def mesh_objects():
|
||||
return [obj for obj in bpy.context.scene.objects if obj.type == "MESH" and not obj.name.startswith("Studio_")]
|
||||
|
||||
|
||||
def triangle_count(objects):
|
||||
total = 0
|
||||
for obj in objects:
|
||||
obj.data.calc_loop_triangles()
|
||||
total += len(obj.data.loop_triangles)
|
||||
return total
|
||||
|
||||
|
||||
source_hash = sha256(BLEND)
|
||||
cap_hashes = {
|
||||
name: sha256(ASSET / name)
|
||||
for name in ("PerfectCoffee_orange_juice_2l_Cap.blend", "PerfectCoffee_orange_juice_2l_Cap.glb")
|
||||
}
|
||||
bpy.ops.wm.open_mainfile(filepath=str(BLEND))
|
||||
bpy.context.preferences.filepaths.save_version = 0
|
||||
body = bpy.data.objects[BODY]
|
||||
original_triangles = triangle_count(mesh_objects())
|
||||
original_vertices = len(body.data.vertices)
|
||||
original_polygons = len(body.data.polygons)
|
||||
pet = bpy.data.materials["OrangeJuice_ClearPET"]
|
||||
body.data.materials.clear()
|
||||
body.data.materials.append(pet)
|
||||
for polygon in body.data.polygons:
|
||||
polygon.material_index = 0
|
||||
uv = body.data.uv_layers.get("UVMap_Label")
|
||||
if uv:
|
||||
body.data.uv_layers.remove(uv)
|
||||
for key in ("label_scope", "label_z_range_m", "label_seam"):
|
||||
if key in body:
|
||||
del body[key]
|
||||
label_material = bpy.data.materials.get(LABEL_MATERIAL)
|
||||
if label_material and label_material.users == 0:
|
||||
bpy.data.materials.remove(label_material)
|
||||
label_image = bpy.data.images.get("OrangeJuice_Wrap_NoPercentage")
|
||||
if label_image:
|
||||
bpy.data.images.remove(label_image)
|
||||
assert triangle_count(mesh_objects()) == original_triangles
|
||||
assert len(body.data.vertices) == original_vertices
|
||||
assert len(body.data.polygons) == original_polygons
|
||||
collection = bpy.data.collections["Model"]
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
for obj in collection.all_objects:
|
||||
obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = body
|
||||
bpy.ops.export_scene.gltf(
|
||||
filepath=str(GLB), export_format="GLB", use_selection=True,
|
||||
export_yup=True, export_apply=True, export_texcoords=True,
|
||||
export_cameras=False, export_lights=False,
|
||||
)
|
||||
scene = bpy.context.scene
|
||||
scene.render.filepath = str(ASSET / "preview.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
pivot = bpy.data.objects["OrangeJuice_Cap_Pivot"]
|
||||
location = pivot.location.copy()
|
||||
pivot.location += Vector((0.045, 0, 0.055))
|
||||
scene.render.filepath = str(ASSET / "preview_cap_removed.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
pivot.location = location
|
||||
scene.render.filepath = str(ASSET / "preview.png")
|
||||
assert sha256(BLEND) == source_hash, "Bottle changed on disk during label removal; not saving"
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(BLEND), compress=True)
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath=str(BLEND))
|
||||
native_ok = (
|
||||
triangle_count(mesh_objects()) == original_triangles
|
||||
and bpy.data.objects[BODY].data.uv_layers.get("UVMap_Label") is None
|
||||
and bpy.data.materials.get(LABEL_MATERIAL) is None
|
||||
and len(bpy.data.objects[BODY].data.materials) == 1
|
||||
and bpy.data.objects[BODY].data.materials[0].name == "OrangeJuice_ClearPET"
|
||||
)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.ops.import_scene.gltf(filepath=str(GLB))
|
||||
imported_objects = mesh_objects()
|
||||
image_texture_nodes = [
|
||||
node for obj in imported_objects for material in obj.data.materials
|
||||
if material and material.use_nodes for node in material.node_tree.nodes if node.type == "TEX_IMAGE"
|
||||
]
|
||||
glb_ok = (
|
||||
triangle_count(imported_objects) == original_triangles
|
||||
and bpy.data.materials.get(LABEL_MATERIAL) is None
|
||||
and not image_texture_nodes
|
||||
)
|
||||
for name, old_hash in cap_hashes.items():
|
||||
assert sha256(ASSET / name) == old_hash
|
||||
technical_passed = native_ok and glb_ok
|
||||
assert technical_passed, "Label removal validation failed"
|
||||
report = json.loads(REPORT.read_text())
|
||||
report.update({
|
||||
"native_reopen_passed": native_ok,
|
||||
"glb_reimport_passed": glb_ok,
|
||||
"native_triangles": original_triangles,
|
||||
"glb_triangles": original_triangles,
|
||||
"technical_validation_passed": True,
|
||||
"generic_label_applied": False,
|
||||
"no_image_textures_or_labels": True,
|
||||
"brand_graphics": False,
|
||||
"percentage_purity_claims_present": False,
|
||||
"label_removed_reason": "Packaging fit did not follow the bottle body well enough",
|
||||
"label_texture_retained_at": "model_assets/labels/orange_juice/orange_juice_wrap.png",
|
||||
"cap_files_untouched_by_label_removal": True,
|
||||
"visual_review_passed": False,
|
||||
"passed": False,
|
||||
})
|
||||
for key in (
|
||||
"label_texture", "label_uv_faces", "label_uv_loops", "label_triangle_increase",
|
||||
"label_texture_packed", "glb_label_texture_verified", "cap_files_untouched_by_label_application",
|
||||
):
|
||||
report.pop(key, None)
|
||||
REPORT.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
|
||||
state = json.loads(STATE.read_text()) if STATE.exists() else {}
|
||||
state.update({
|
||||
"label_applied": False,
|
||||
"label_removed_reason": "Poor visual fit to the bottle body",
|
||||
"label_texture_files_retained": True,
|
||||
"native_reopen_passed": native_ok,
|
||||
"glb_reimport_passed": glb_ok,
|
||||
"native_triangles": original_triangles,
|
||||
"glb_triangles": original_triangles,
|
||||
"cap_files_untouched": True,
|
||||
"technical_validation_passed": True,
|
||||
"visual_review_passed": False,
|
||||
"passed": False,
|
||||
})
|
||||
for key in (
|
||||
"label_faces", "label_triangle_increase", "label_png_dimensions",
|
||||
"glb_label_faces", "glb_label_triangles", "glb_label_uv_verified", "glb_texture_dimensions",
|
||||
):
|
||||
state.pop(key, None)
|
||||
STATE.write_text(json.dumps(state, ensure_ascii=False, indent=2) + "\n")
|
||||
summary_path = ROOT / "low_poly_consumables_validation.json"
|
||||
summary = json.loads(summary_path.read_text())
|
||||
for asset in summary["assets"]:
|
||||
if asset["directory"] == "orange_juice_2l":
|
||||
asset.update({
|
||||
"native_triangles": original_triangles,
|
||||
"glb_triangles": original_triangles,
|
||||
"technical_validation_passed": True,
|
||||
"visual_review_passed": False,
|
||||
"passed": False,
|
||||
})
|
||||
summary["all_visual_reviews_passed"] = all(asset["visual_review_passed"] for asset in summary["assets"])
|
||||
summary_path.write_text(json.dumps(summary, ensure_ascii=False, indent=2) + "\n")
|
||||
print(json.dumps(state, ensure_ascii=False, indent=2))
|
||||
Reference in New Issue
Block a user