Files
animation/characters/female/lena_nude/hires_claude/dbg_gusset.py
T
jeremy 3ba86b2ea8 feat: clothing lane, character sources, and DCC bridges
Bulk import of the working lanes that were living untracked on the PC.

Content:
- characters/  Lena/male body lanes, bakes, texture work, run logs
- clothing/    garment pipeline, configs, gates, contract docs
- garments/    MD-authored garment sources (.zprj/.zpac)
- UAL-Lib/     Universal Animation Library 2 source (.blend/.fbx/.glb)
- tools/       blender_bridge, iclone_bridge, md_bridge, tailor, glm_agent
- docs/, plans/, dev/, .agents/plans/

Repo hygiene:
- .gitattributes: LFS now covers .blend, .zprj, .zpac, .obj, .npy and the
  Reallusion .iAvatar/.ccAvatar/.ccRestore containers. Without this the
  ~3.8 GB in this commit would land as raw blobs. .png/.jpg are left out
  on purpose — ~250 are already tracked raw and converting them would
  rewrite every one without shrinking history.
- .gitignore: exclude /accurig/ (~1 GB AccuRig program files, redistributable
  from Reallusion, nothing authored here) and /dev/null/ (git-lfs hook copies
  dropped by a `>/dev/null` redirect on Windows).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 15:55:43 -07:00

93 lines
3.2 KiB
Python

# Diagnose the inter-thigh residue below the crotch snap window.
# blender --background --python dbg_gusset.py -- <blend> <outdir>
import bpy, sys, math, os
import numpy as np
from mathutils import Vector, Euler
argv = sys.argv[sys.argv.index("--") + 1:]
BLEND, OUT = argv[0], argv[1]
os.makedirs(OUT, exist_ok=True)
bpy.ops.wm.open_mainfile(filepath=BLEND)
ob = max([o for o in bpy.data.objects if o.type == 'MESH'],
key=lambda o: len(o.data.vertices))
me = ob.data
n_v = len(me.vertices)
co = np.empty(n_v * 3)
me.vertices.foreach_get("co", co)
co = co.reshape(-1, 3)
# numeric: midline strip profile — for each z slice near the crotch, front-most and
# back-most y, and the x extent of geometry in the inter-thigh gap
print("== midline (|x|<0.01) y-range per z slice ==")
for z0 in np.arange(0.34, 0.50, 0.01):
m = (np.abs(co[:, 0]) < 0.01) & (co[:, 2] >= z0) & (co[:, 2] < z0 + 0.01)
if m.sum() == 0:
print(f" z {z0:.2f}: EMPTY")
continue
ys = co[m, 1]
print(f" z {z0:.2f}: n={m.sum():5d} y [{ys.min():+.4f} .. {ys.max():+.4f}]")
print("== inter-thigh occupancy: verts with |x|<0.06 per z slice ==")
for z0 in np.arange(0.30, 0.46, 0.01):
m = (np.abs(co[:, 0]) < 0.06) & (co[:, 2] >= z0) & (co[:, 2] < z0 + 0.01)
print(f" z {z0:.2f}: n={m.sum():5d}", end="")
if m.sum():
print(f" x [{co[m,0].min():+.4f}..{co[m,0].max():+.4f}]"
f" y [{co[m,1].min():+.4f}..{co[m,1].max():+.4f}]")
else:
print()
# renders: clay, shadowless, tight on the crotch — front, and from below looking up
for o in list(bpy.data.objects):
if o.type in ('LIGHT', 'CAMERA'):
bpy.data.objects.remove(o, do_unlink=True)
sc = bpy.context.scene
sc.render.engine = 'BLENDER_EEVEE'
sc.render.resolution_x = sc.render.resolution_y = 1000
sc.render.film_transparent = False
wd = bpy.data.worlds.new("w")
wd.use_nodes = True
wd.node_tree.nodes["Background"].inputs[0].default_value = (0.18, 0.18, 0.18, 1)
sc.world = wd
mat = bpy.data.materials.new("clay")
mat.use_nodes = True
b = mat.node_tree.nodes["Principled BSDF"]
b.inputs["Base Color"].default_value = (0.8, 0.8, 0.8, 1)
b.inputs["Roughness"].default_value = 0.6
ob.data.materials.clear()
ob.data.materials.append(mat)
def sun(rot, e):
ld = bpy.data.lights.new("s", 'SUN')
ld.energy = e
ld.use_shadow = False
lo = bpy.data.objects.new("s", ld)
lo.rotation_euler = rot
bpy.context.collection.objects.link(lo)
sun(Euler((math.radians(60), 0, math.radians(-30))), 3.0)
sun(Euler((math.radians(120), 0, math.radians(150))), 1.2)
cam = bpy.data.cameras.new("c")
cam.lens = 85
cob = bpy.data.objects.new("c", cam)
bpy.context.collection.objects.link(cob)
sc.camera = cob
views = [
# (name, location, rotation) — model front = -Y
("front_tight", Vector((0.0, -0.55, 0.41)), Euler((math.radians(90), 0, 0))),
("below_up", Vector((0.0, -0.30, 0.05)), Euler((math.radians(50), 0, 0))),
("side_gap", Vector((-0.45, -0.35, 0.40)), Euler((math.radians(88), 0, math.radians(-52)))),
]
for name, loc, rot in views:
cob.location = loc
cob.rotation_euler = rot
sc.render.filepath = os.path.join(OUT, f"{name}.png")
bpy.ops.render.render(write_still=True)
print(f"rendered {name}")
print("DBG_DONE")