3d8825f5a9
REGISTRY rewritten around the central rule: a character folder is born only when a body ships to ariki-game (<character>_base_v<NN> = ship ordinal). lena_nude dissolves accordingly: - characters/female/lena_base_v01/ — SHIPPED 2026-08-10: AccuRig GLB carrier, T-pose/rig FBX + JSON, previews, frozen README - characters/work/lena/ — the live lane: recipes 01-47 (incl. new 36-47: refill/sheets/clay/despeckle/musculature/spin/AccuRig export/graft/pose QC), masters (athletic_v04 blend + textures, accurig blend), lane-history README - hires_claude/hires_work intermediates (blends, logs, probes) pruned Supporting docs: AGENTS.md, working-files rule, rig-graft plan addendum, originals README, prune_lane.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
90 lines
2.8 KiB
Python
90 lines
2.8 KiB
Python
# Stage 6d: self-locating spot melt of remaining flaps in the thigh gap.
|
|
# Finds high-roughness verts inside the gap box (an open-slit flap the membrane pulled),
|
|
# grows a 2-ring collar, melts. Prints the cluster it found so the fix is auditable.
|
|
# blender --background --python 06d_spot_melt.py -- <in.blend> <out.blend>
|
|
import bpy, sys, time
|
|
import numpy as np
|
|
|
|
argv = sys.argv[sys.argv.index("--") + 1:]
|
|
BLEND, OUT = argv[0], argv[1]
|
|
t0 = time.time()
|
|
|
|
BOX = lambda co: (np.abs(co[:, 0]) < 0.075) & (co[:, 2] > 0.345) & (co[:, 2] < 0.475)
|
|
ROUGH_THR = 0.0012
|
|
MELT_ITERS = 80
|
|
|
|
|
|
def log(m):
|
|
print(f"[spot {time.time()-t0:6.1f}s] {m}", flush=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)
|
|
|
|
n_e = len(me.edges)
|
|
ev = np.empty(n_e * 2, dtype=np.int32)
|
|
me.edges.foreach_get("vertices", ev)
|
|
ev = ev.reshape(-1, 2)
|
|
order = np.concatenate([ev[:, 0], ev[:, 1]])
|
|
nbr = np.concatenate([ev[:, 1], ev[:, 0]])
|
|
srt = np.argsort(order, kind="stable")
|
|
o_s = order[srt]
|
|
n_s = nbr[srt]
|
|
ptr = np.searchsorted(o_s, np.arange(n_v + 1))
|
|
cnt = np.maximum(ptr[1:] - ptr[:-1], 1)
|
|
|
|
|
|
def smooth_field(Q, iters):
|
|
X = Q.copy()
|
|
for _ in range(iters):
|
|
acc = np.zeros_like(X)
|
|
np.add.at(acc, o_s, X[n_s])
|
|
X = acc / cnt[:, None]
|
|
return X
|
|
|
|
|
|
sm = smooth_field(co, 8)
|
|
rough = np.linalg.norm(co - sm, axis=1)
|
|
box = BOX(co)
|
|
hot = box & (rough > ROUGH_THR)
|
|
log(f"box {box.sum()} verts, hot {hot.sum()} (rough>{ROUGH_THR})")
|
|
if hot.sum():
|
|
hc = co[hot]
|
|
log(f"hot cluster: x [{hc[:,0].min():+.4f}..{hc[:,0].max():+.4f}] "
|
|
f"y [{hc[:,1].min():+.4f}..{hc[:,1].max():+.4f}] "
|
|
f"z [{hc[:,2].min():+.4f}..{hc[:,2].max():+.4f}]")
|
|
m = hot.copy()
|
|
for _ in range(2):
|
|
h = m[ev[:, 0]] | m[ev[:, 1]]
|
|
m2 = m.copy()
|
|
m2[ev[:, 0]] |= h
|
|
m2[ev[:, 1]] |= h
|
|
m = m2
|
|
sidx = np.nonzero(m)[0]
|
|
Q = co.copy()
|
|
for _ in range(MELT_ITERS):
|
|
acc = np.zeros_like(Q)
|
|
np.add.at(acc, o_s, Q[n_s])
|
|
mean = acc / cnt[:, None]
|
|
Q[sidx] = 0.5 * Q[sidx] + 0.5 * mean[sidx]
|
|
d = np.linalg.norm(Q - co, axis=1)
|
|
log(f"melted {len(sidx)} verts, max move {d.max():.4f}")
|
|
me.vertices.foreach_set("co", Q.reshape(-1))
|
|
me.update()
|
|
if me.has_custom_normals:
|
|
vn = np.empty(n_v * 3, dtype=np.float32)
|
|
me.vertices.foreach_get("normal", vn)
|
|
me.normals_split_custom_set_from_vertices(vn.reshape(-1, 3))
|
|
else:
|
|
log("nothing hot — no melt applied")
|
|
bpy.context.preferences.filepaths.save_version = 0 # no .blend1 autosave
|
|
bpy.ops.wm.save_as_mainfile(filepath=OUT)
|
|
log(f"WROTE {OUT}")
|
|
print("SPOT_DONE")
|