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,178 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
from mathutils.bvhtree import BVHTree
|
||||
|
||||
OUT = Path(__file__).resolve().parent
|
||||
ROOT = OUT.parents[1]
|
||||
ASSET = ROOT / "orange_juice_2l"
|
||||
SOURCE = ASSET / "PerfectCoffee_orange_juice_2l_MilkJug_OriginalLabel.blend"
|
||||
BLEND = ASSET / "PerfectCoffee_orange_juice_2l_MilkJug_SeedreamLabel.blend"
|
||||
GLB = BLEND.with_suffix(".glb")
|
||||
TEXTURE = OUT / "orange_seedream_wrap.png"
|
||||
MATERIAL_NAME = "OrangeJuice_Label_Seedream"
|
||||
IMAGE_NAME = "OrangeJuice_SeedreamGroveLabel"
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def surface_gaps(body, label):
|
||||
bpy.context.view_layer.update()
|
||||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
tree = BVHTree.FromObject(body, depsgraph)
|
||||
evaluated = label.evaluated_get(depsgraph)
|
||||
mesh = evaluated.to_mesh()
|
||||
inverse = body.matrix_world.inverted()
|
||||
gaps = []
|
||||
for vertex in mesh.vertices:
|
||||
point = inverse @ (label.matrix_world @ vertex.co)
|
||||
nearest, normal, _, _ = tree.find_nearest(point)
|
||||
gaps.append((point - nearest).dot(normal))
|
||||
evaluated.to_mesh_clear()
|
||||
return [min(gaps) * 1000, max(gaps) * 1000]
|
||||
|
||||
|
||||
source_hash = sha256(SOURCE)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(SOURCE))
|
||||
bpy.context.preferences.filepaths.save_version = 0
|
||||
body = bpy.data.objects["OrangeJuice_Bottle_Body"]
|
||||
label = bpy.data.objects["OrangeJuice_Label_Surface"]
|
||||
root = bpy.data.objects["OrangeJuice2L_MilkJug_OriginalLabel_Root"]
|
||||
source_triangles = triangle_count(mesh_objects())
|
||||
material = bpy.data.materials["OrangeJuice_Label_Original"]
|
||||
material.name = MATERIAL_NAME
|
||||
texture_node = material.node_tree.nodes["Image Texture"]
|
||||
image = bpy.data.images.load(str(TEXTURE), check_existing=True)
|
||||
image.name = IMAGE_NAME
|
||||
image.colorspace_settings.name = "sRGB"
|
||||
image.use_fake_user = True
|
||||
image.pack()
|
||||
texture_node.image = image
|
||||
old_image = bpy.data.images.get("OrangeGrove_OriginalVector")
|
||||
if old_image:
|
||||
bpy.data.images.remove(old_image)
|
||||
root.name = "OrangeJuice2L_MilkJug_SeedreamLabel_Root"
|
||||
root["label_design"] = "Seedream geometric citrus tree in a hexagonal illustration tile with a right-hand text card"
|
||||
root["label_artwork_origin"] = "Seedream 5.5 text-to-image asset without reference images; original SVG layout"
|
||||
root["seedream_prompt"] = "model_assets/labels/orange_juice/seedream55_grove_prompt.txt"
|
||||
assert source_triangles == 970
|
||||
assert triangle_count(mesh_objects()) == source_triangles
|
||||
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 = label
|
||||
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
|
||||
camera = scene.camera
|
||||
camera_matrix = camera.matrix_world.copy()
|
||||
camera_scale = camera.data.ortho_scale
|
||||
scene.render.filepath = str(ASSET / "preview_seedream_label.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
for name, position in (("front", (0, -0.55, 0.18)), ("back", (0, 0.55, 0.18)), ("fit", (0.20, -0.28, 0.16))):
|
||||
camera.location = position
|
||||
target = Vector((0, 0, 0.14 if name != "fit" else 0.075))
|
||||
camera.rotation_euler = (target - camera.location).to_track_quat("-Z", "Y").to_euler()
|
||||
camera.data.ortho_scale = 0.325 if name != "fit" else 0.205
|
||||
scene.render.resolution_x = 900
|
||||
scene.render.resolution_y = 900
|
||||
scene.render.filepath = str(ASSET / f"preview_seedream_label_{name}.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
camera.matrix_world = camera_matrix
|
||||
camera.data.ortho_scale = camera_scale
|
||||
scene.render.resolution_x = 720
|
||||
scene.render.resolution_y = 720
|
||||
scene.render.filepath = str(ASSET / "preview_seedream_label.png")
|
||||
assert sha256(SOURCE) == source_hash, "Source model changed during Seedream-label application"
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(BLEND), compress=True)
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath=str(BLEND))
|
||||
body = bpy.data.objects["OrangeJuice_Bottle_Body"]
|
||||
label = bpy.data.objects["OrangeJuice_Label_Surface"]
|
||||
native_gaps = surface_gaps(body, label)
|
||||
native_texture = bpy.data.materials[MATERIAL_NAME].node_tree.nodes["Image Texture"]
|
||||
native_alpha = bpy.data.materials["OrangeJuice_PET_Observe15"].node_tree.nodes["Principled BSDF"].inputs["Alpha"].default_value
|
||||
native_ok = (
|
||||
triangle_count(mesh_objects()) == source_triangles
|
||||
and abs(native_alpha - 0.15) < 0.00001
|
||||
and native_texture.image.name == IMAGE_NAME
|
||||
and list(native_texture.image.size) == [3584, 768]
|
||||
and native_texture.image.packed_file is not None
|
||||
and bpy.data.images.get("OrangeGrove_OriginalVector") is None
|
||||
and max(native_gaps) <= 0.061 and min(native_gaps) > 0
|
||||
and label.modifiers["Tight_To_Bottle"].target == body
|
||||
)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.ops.import_scene.gltf(filepath=str(GLB))
|
||||
imported_objects = mesh_objects()
|
||||
body = bpy.data.objects["OrangeJuice_Bottle_Body"]
|
||||
label = bpy.data.objects["OrangeJuice_Label_Surface"]
|
||||
glb_gaps = surface_gaps(body, label)
|
||||
glb_texture = bpy.data.materials[MATERIAL_NAME].node_tree.nodes["Image Texture"]
|
||||
glb_alpha = bpy.data.materials["OrangeJuice_PET_Observe15"].node_tree.nodes["Principled BSDF"].inputs["Alpha"].default_value
|
||||
glb_ok = (
|
||||
triangle_count(imported_objects) == source_triangles
|
||||
and abs(glb_alpha - 0.15) < 0.00001
|
||||
and list(glb_texture.image.size) == [3584, 768]
|
||||
and bool(label.data.uv_layers)
|
||||
and bpy.data.images.get("OrangeGrove_OriginalVector") is None
|
||||
and max(glb_gaps) <= 0.061 and min(glb_gaps) > 0
|
||||
)
|
||||
assert native_ok and glb_ok, "Seedream label validation failed"
|
||||
report = {
|
||||
"asset": "OrangeJuice2L_MilkJug_SeedreamLabel_Root",
|
||||
"source_model": "model_assets/orange_juice_2l/PerfectCoffee_orange_juice_2l_MilkJug_OriginalLabel.blend",
|
||||
"source_unchanged": True,
|
||||
"source_sha256": source_hash,
|
||||
"artwork": "Seedream 5.5 original geometric citrus tree in a hexagonal tile, with original SVG text layout",
|
||||
"seedream_model": "seedream_5.5",
|
||||
"seedream_reference_images_used": False,
|
||||
"seedream_asset": "model_assets/labels/orange_juice/seedream55_grove.png",
|
||||
"seedream_prompt": "model_assets/labels/orange_juice/seedream55_grove_prompt.txt",
|
||||
"brand_logo_present": False,
|
||||
"percentage_purity_claim_present": False,
|
||||
"previous_label_raster_packed": False,
|
||||
"label_texture": "model_assets/labels/orange_juice/orange_seedream_wrap.png",
|
||||
"body_opacity": 0.15,
|
||||
"interior_empty": True,
|
||||
"native_triangles": source_triangles,
|
||||
"glb_triangles": source_triangles,
|
||||
"triangle_limit": 1000,
|
||||
"native_surface_gap_mm": native_gaps,
|
||||
"glb_surface_gap_mm": glb_gaps,
|
||||
"label_below_handle": True,
|
||||
"native_reopen_passed": native_ok,
|
||||
"glb_reimport_passed": glb_ok,
|
||||
"technical_validation_passed": True,
|
||||
"visual_review_passed": False,
|
||||
"passed": False,
|
||||
"blend": BLEND.name,
|
||||
"glb": GLB.name,
|
||||
"preview": "preview_seedream_label.png",
|
||||
"preview_front": "preview_seedream_label_front.png",
|
||||
"preview_back": "preview_seedream_label_back.png",
|
||||
"preview_fit": "preview_seedream_label_fit.png",
|
||||
}
|
||||
(ASSET / "validation_seedream_label.json").write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
Reference in New Issue
Block a user