Files
animation/characters/female/lena_nude/hires_work/verify_shape.py
T

50 lines
1.8 KiB
Python
Raw Normal View History

import bpy
import sys
import os
import numpy as np
import bmesh
sys.path.append(os.getcwd())
bpy.ops.wm.open_mainfile(filepath='characters/female/lena_nude/hires_work/07_final.blend')
obj = bpy.context.active_object
mesh = obj.data
verts = np.empty(len(mesh.vertices) * 3, dtype=np.float32)
mesh.vertices.foreach_get('co', verts)
verts = verts.reshape(-1, 3)
z = verts[:, 2]
y = verts[:, 1]
x = verts[:, 0]
print('--- Breast Shape Check ---')
apex_z_target = 0.688
apex_mask = (z > apex_z_target - 0.01) & (z < apex_z_target + 0.01)
if np.any(apex_mask):
apex_y = y[apex_mask]
apex_x = x[apex_mask]
min_y = np.min(apex_y)
print(f'Apex Z range: {np.min(z[apex_mask]):.3f} - {np.max(z[apex_mask]):.3f}')
print(f'Apex Y (front-most): {min_y:.4f} (Target: < -0.1205)')
print(f'Apex X range: {np.min(apex_x):.3f} to {np.max(apex_x):.3f}')
else:
print('No vertices found at apex Z.')
print('--- Cleavage Check ---')
sternum_mask = (np.abs(x) < 0.005) & (z > 0.65) & (z < 0.72)
if np.any(sternum_mask):
sternum_y = y[sternum_mask]
sternum_z = z[sternum_mask]
min_idx = np.argmin(sternum_y)
print(f'Sternum at apex Z ({apex_z_target}): Y={sternum_y[min_idx]:.4f}')
print(f'Gap to Apex: {min_y - sternum_y[min_idx]:.4f} (Target > 0.015)')
else:
print('No sternum vertices found.')
print('--- Boundary Check ---')
bm = bmesh.new()
bm.from_mesh(mesh)
bm.edges.ensure_lookup_table()
boundary_edges = [e for e in bm.edges if e.is_boundary]
print(f'Open boundary edges: {len(boundary_edges)}')
print('--- Hems Z-band Check ---')
bands = [(0.485, 0.495), (0.583, 0.593), (0.632, 0.642), (0.680, 0.690), (0.729, 0.739)]
for low, high in bands:
mask = (z >= low) & (z <= high)
count = np.sum(mask)
print(f'Z {low:.3f}-{high:.3f}: {count} verts')