A mech game prototype, pushed by Fable 5.2
agent
+32:40[redacted: image of existing project work]
Bashcd ~/Projects/sortie-wt/fable52 && tools/log.sh "r2 yardstick studied (striker stills, kit/mech.py read), design chosen: swept plates and feather blades, a fanned wing pack"
command
cd ~/Projects/sortie-wt/fable52 && tools/log.sh "r2 yardstick studied (striker stills, kit/mech.py read), design chosen: swept plates and feather blades, a fanned wing pack"
result, 1 line
19:11:24 r2 yardstick studied (striker stills, kit/mech.py read), design chosen: swept plates and feather blades, a fanned wing pack
Write~/Projects/sortie-wt/fable52/kit/blocks/zero.py
input
~/Projects/sortie-wt/fable52/kit/blocks/zero.py """Zero: a second mech on the striker's skeleton, joints unchanged. A study, not a design decision. One idea: swept plates and feather blades. Every big plate rakes back, and one motif repeats in three sizes: a long tapered blade (the wing fan on the pack, the calf spurs, forearm, hip and ear blades). Paint logic: plates are main, every feather is accent, trim only on sensors and hubs. Thin shells stand off a dark core, so the frame shows in the channels and nowhere else. """ from mathutils import Matrix, Vector from lib import clip, copy, cylinder, empty, halves, loft, merge, mirror_x, nozzle, octo, piston, prism, rot, slats, solid, transform, two_view from mech import gltf_dir, nozzle_pair, pair, pair_pieces, place, seam BEVEL = .04 def both(bm): """A left half and its mirror as one part.""" return merge(bm, mirror_x(bm)) def build(Blocks): b = Blocks() N = b.nodes N["frame"]["frame"] = "zero" def lr(j): return N[f"{j}.L"], N[f"{j}.R"] P, W, T, NK, H, B = (N[k] for k in ("pelvis", "waist", "torso", "neck", "head", "backpack")) pelvis(P, lr) waist(W) torso(T) head(NK, H) N["neck"].location.z -= .22 # the head sits down between the collar plates arms(lr) legs(lr) pack(B, N) def pelvis(P, lr): solid("pelvis_core", loft([(9.85, octo(.9, 1.2, .25)), (10.4, octo(2.1, 1.6, .4)), (11.0, octo(2.2, 1.65, .45))]), "frame", P, BEVEL) solid("belt", loft([(10.66, octo(2.95, 2.0, .55)), (10.98, octo(2.45, 1.8, .45))]), "main", P, .03) solid("keel_tail", two_view([(-.3, 10.72), (.3, 10.72), (.16, 9.5), (-.16, 9.5)], [(-1.3, 10.72), (-.85, 10.72), (-.78, 9.75), (-.98, 9.45), (-1.4, 10.1)]), "main", P, .03) pair("skirt_front", two_view([(.4, 10.68), (1.72, 10.6), (1.98, 10.05), (1.45, 8.95), (.62, 9.5)], [(-1.36, 8.9), (-1.06, 8.9), (-.9, 10.7), (-1.2, 10.7)]), "main", P, P, bevel=BEVEL) pair("skirt_front_edge", two_view([(.62, 9.5), (1.45, 8.95), (1.6, 9.25), (.66, 9.72)], [(-1.42, 8.85), (-1.1, 8.85), (-1.04, 9.8), (-1.36, 9.8)]), "accent", P, P, bevel=.015) # hip feathers: a blade on each hip, swept back and down pair("hip_feather", two_view([(1.86, 8.2), (2.22, 8.2), (2.34, 10.3), (2.14, 10.82), (1.82, 10.82)], [(-.75, 10.82), (.85, 10.82), (1.95, 8.9), (1.55, 8.2), (-.45, 9.7)]), "accent", P, P, bevel=.03) pair("hip_cap", two_view([(1.8, 10.2), (2.42, 10.3), (2.36, 10.9), (1.8, 10.9)], [(-.85, 10.25), (1.0, 10.25), (.9, 10.9), (-.9, 10.9)]), "main", P, P, bevel=.03) pair("skirt_rear", two_view([(.16, 10.68), (1.5, 10.68), (1.75, 10.0), (1.25, 8.9), (.16, 9.55)], [(.98, 8.85), (1.26, 8.85), (1.36, 10.7), (1.02, 10.7)]), "main", P, P, bevel=BEVEL) solid("tail_block", two_view([(-.14, 9.4), (.14, 9.4), (.2, 10.7), (-.2, 10.7)], [(.9, 9.4), (1.3, 9.6), (1.45, 10.7), (.95, 10.7)]), "frame", P, .02) def waist(W): solid("abdomen", loft([(10.9, octo(1.55, 1.35, .35)), (11.95, octo(1.75, 1.5, .38))]), "joint", W, .03) # three chevron lames, each wider and further forward than the one below for i, (z0, hw, y) in enumerate(((10.98, .6, -.82), (11.3, .68, -.87), (11.62, .76, -.92))): lame = two_view([(0, z0), (hw, z0 + .14), (hw + .05, z0 + .46), (0, z0 + .34)], [(y, z0 - .02), (y + .22, z0 - .02), (y + .22, z0 + .5), (y - .03, z0 + .5)]) solid(f"lame{i}", both(lame), "main" if i == 2 else "frame", W, .02) pair("flank", two_view([(.74, 11.0), (.98, 11.06), (1.06, 11.94), (.8, 11.94)], [(-.5, 11.0), (.55, 11.0), (.62, 11.94), (-.58, 11.94)]), "frame", W, W, bevel=.02) pair("flank_strut", piston((.55, .8, 10.98), (.62, .86, 11.9), r=.07), "joint", W, W, smooth=True) def torso(T): solid("chest", loft([(11.9, octo(1.85, 1.55, .4, y=.05)), (12.6, octo(2.35, 2.0, .45)), (13.9, octo(2.95, 2.4, .55, y=-.05)), (14.9, octo(2.75, 2.2, .5)), (15.3, octo(1.75, 1.5, .4))]), "frame", T, BEVEL) # the prow: one keel plate down the chest, V in plan, split at the cockpit hatch line keel = two_view([(-.48, 12.45), (.48, 12.45), (.74, 14.25), (.5, 14.98), (-.5, 14.98), (-.74, 14.25)], [(-1.5, 12.45), (-1.12, 12.45), (-1.18, 14.98), (-1.5, 14.98), (-2.02, 14.1), (-1.92, 13.3)], top=[(-.8, -1.0), (.8, -1.0), (.8, -1.5), (0, -2.08), (-.8, -1.5)]) low, hatch = halves(keel, (0, -1.5, 13.45), (0, .3, 1), gap=.06) solid("keel", low, "main", T, .03) solid("hatch", hatch, "main", T, .03) solid("hatch_sensor", prism([(-.22, 14.42), (.22, 14.42), (.16, 14.68), (-.16, 14.68)], -1.98, -1.6, "xz"), "trim", T, .02) solid("hatch_eye", prism([(-.13, 14.5), (.13, 14.5), (.1, 14.6), (-.1, 14.6)], -2.01, -1.96, "xz"), "glow_core", T) # cheeks: swept plates either side of the keel, an intake under each pair("cheek", two_view([(.8, 14.92), (1.5, 14.8), (1.92, 14.25), (1.78, 13.35), (.84, 13.0)], [(-1.72, 13.0), (-1.02, 13.0), (-1.1, 14.92), (-1.4, 14.92), (-1.8, 14.1)], top=[(.7, -1.9), (1.25, -1.84), (2.0, -1.25), (2.0, -.9), (.7, -.9)]), "accent", T, T, bevel=BEVEL) pair("intake", slats(.86, 1.62, 12.52, 12.98, -1.36, 3, depth=.1), "frame", T, T) pair("rib", two_view([(.84, 11.98), (1.3, 11.98), (1.62, 12.5), (.84, 12.5)], [(-1.42, 11.98), (-.95, 11.98), (-1.0, 12.52), (-1.48, 12.52)]), "main", T, T, bevel=.03) solid("belly", two_view([(-.8, 11.92), (.8, 11.92), (.5, 12.42), (-.5, 12.42)], [(-1.38, 11.9), (-1.0, 11.9), (-1.1, 12.44), (-1.46, 12.44)]), "main", T, .03) # collar: raked plates with room round the neck pair("collar", two_view([(.52, 14.9), (1.5, 14.8), (1.62, 15.25), (1.15, 15.62), (.6, 15.5)], [(-1.05, 14.8), (-.86, 14.8), (-.62, 15.62), (-.8, 15.62)]), "main", T, T, bevel=.025) pair("collar_side", two_view([(1.38, 14.75), (1.56, 14.75), (1.46, 15.55), (1.28, 15.55)], [(-.92, 14.75), (.9, 14.75), (1.1, 15.7), (-.7, 15.55)]), "main", T, T, bevel=.025) solid("nape", two_view([(-.6, 15.1), (.6, 15.1), (.5, 15.95), (-.5, 15.95)], [(.3, 15.1), (.8, 15.1), (.72, 15.95), (.4, 15.95)]), "main", T, .02) pair("side_plate", two_view([(1.42, 12.75), (1.64, 12.75), (1.72, 14.35), (1.5, 14.6)], [(-.9, 12.75), (.95, 12.75), (1.0, 14.4), (-1.0, 14.45)]), "main", T, T, bevel=.03) pair("blade_plate", two_view([(.92, 12.5), (1.2, 12.4), (1.66, 14.9), (.92, 14.9)], [(1.12, 12.4), (1.42, 12.4), (1.5, 14.9), (1.2, 14.9)]), "main", T, T, bevel=BEVEL) def head(NK, H): solid("neck_core", cylinder(.36, 15.25, 16.0, 10), "joint", NK, smooth=True) solid("neck_ring", loft([(15.5, octo(.95, .9, .2)), (15.68, octo(.86, .82, .18))]), "frame", NK, .015) solid("skull", loft([(15.95, octo(.86, 1.1, .25, y=.05)), (16.62, octo(1.02, 1.36, .3))]), "frame", H, .02) # a long low helmet, swept back to a point past the nape solid("cranium", two_view([(-.6, 16.56), (.6, 16.56), (.54, 16.98), (.22, 17.22), (-.22, 17.22), (-.54, 16.98)], [(-1.02, 16.6), (-.8, 16.98), (-.1, 17.24), (1.0, 17.14), (1.6, 16.86), (.95, 16.56)], top=[(-.32, -1.06), (.32, -1.06), (.62, -.4), (.5, .8), (.14, 1.62), (-.14, 1.62), (-.5, .8), (-.62, -.4)]), "main", H, .03) solid("visor", two_view([(-.58, 16.3), (.58, 16.3), (.6, 16.6), (-.6, 16.6)], [(-.95, 16.3), (-.6, 16.3), (-.6, 16.6), (-.98, 16.6)]), "visor", H, .01) solid("eye", two_view([(-.44, 16.4), (.44, 16.4), (.48, 16.5), (-.48, 16.5)], [(-1.0, 16.4), (-.94, 16.4), (-.94, 16.5), (-1.0, 16.5)]), "glow_eye", H) solid("brow", two_view([(-.66, 16.56), (.66, 16.56), (.58, 16.74), (0, 16.84), (-.58, 16.74)], [(-1.12, 16.56), (-.6, 16.56), (-.6, 16.84), (-.98, 16.8)], top=[(-.7, -.5), (.7, -.5), (.7, -.9), (0, -1.14), (-.7, -.9)]), "main", H, .02) solid("mask", two_view([(-.32, 15.9), (.32, 15.9), (.44, 16.32), (-.44, 16.32)], [(-.76, 15.9), (-.5, 15.9), (-.55, 16.34), (-.84, 16.34)]), "frame", H, .015) pair("jaw", two_view([(.06, 15.9), (.4, 16.0), (.52, 16.3), (.1, 16.26)], [(-.98, 15.86), (-.6, 15.94), (-.62, 16.32), (-.9, 16.32)]), "main", H, H, bevel=.015) pair("helm_side", two_view([(.48, 15.98), (.7, 16.2), (.76, 16.72), (.62, 16.94), (.5, 16.6)], [(-.82, 16.0), (.55, 16.0), (.8, 16.5), (.5, 16.96), (-.6, 16.92), (-.92, 16.5)]), "main", H, H, bevel=.025) pair("ear_hub", cylinder(.2, .72, .9, 12, axis="x", at=(.05, 16.45)), "frame", H, H, smooth=True) pair("ear_lens", cylinder(.1, .9, .94, 12, axis="x", at=(.05, 16.45)), "sensor", H, H, smooth=True) pair("ear_blade", prism([(-.15, 16.5), (.3, 16.32), (2.0, 17.2), (1.85, 17.34), (.35, 16.74), (-.1, 16.72)], .8, .9, "yz"), "accent", H, H, bevel=.02) solid("helm_rear", two_view([(-.55, 16.06), (.55, 16.06), (.6, 16.6), (-.6, 16.6)], [(.42, 16.02), (.82, 16.18), (.86, 16.6), (.52, 16.66)]), "main", H, .02) def arms(lr): S, U, F, HD = lr("shoulder"), lr("upperarm"), lr("forearm"), lr("hand") pair("shoulder_block", loft([(1.45, octo(1.4, 1.3, .35, y=14.55)), (2.6, octo(1.35, 1.25, .35, y=14.55))], axis="x"), "frame", *S, bevel=BEVEL) pair("trunnion", cylinder(.33, 2.25, 3.0, 12, axis="x", at=(0, 14.5)), "joint", *S, smooth=True) # the pauldron: a roof that rises outward and sweeps back to a point, a feather hanging off its edge plan = [(1.8, -.95), (3.3, -1.2), (4.25, -.3), (4.05, 1.2), (3.0, 2.15), (1.8, .8)] roof = two_view([(1.85, 15.08), (3.3, 15.8), (4.2, 15.55), (4.05, 15.15), (2.1, 14.84)], [(-1.25, 14.8), (-.7, 15.85), (1.7, 15.8), (2.2, 15.3), (1.0, 14.8)], top=plan) pair_pieces("pauldron", seam(roof, (2.9, 14.6), (2.7, 16.2), gap=.05), "main", *S, bevel=.03) pair("pauldron_under", two_view([(2.1, 14.7), (3.5, 15.1), (3.56, 14.9), (2.2, 14.54)], [(-.9, 14.5), (.9, 14.5), (.9, 15.2), (-.9, 15.2)]), "frame", *S, bevel=.02) pair("pauldron_feather", two_view([(3.72, 15.42), (4.3, 15.25), (4.16, 14.0), (3.9, 13.3), (3.62, 14.5)], [(-.9, 15.5), (1.6, 15.5), (2.1, 14.4), (1.5, 13.3), (-.6, 14.3)]), "accent", *S, bevel=.035) pair("upperarm_core", loft([(12.2, octo(.8, .85, .22, x=2.5)), (14.2, octo(.85, .9, .24, x=2.48))]), "joint", *U, bevel=.03) cuff = loft([(12.45, octo(.9, 1.0, .24, x=2.53)), (13.75, octo(1.12, 1.16, .28, x=2.54))]) pair("upperarm_front", clip(copy(cuff), y=(-1, -.1)), "main", *U, bevel=.03) pair("upperarm_rear", clip(cuff, y=(.1, 1)), "main", *U, bevel=.03) pair("upperarm_tab", two_view([(3.02, 12.6), (3.18, 12.65), (3.22, 13.7), (3.06, 13.75)], [(-.35, 12.6), (.35, 12.6), (.45, 13.75), (-.45, 13.75)]), "accent", *U, bevel=.02) pair("elbow", cylinder(.46, 2.02, 2.98, 12, axis="x", at=(0, 11.95)), "joint", *U, smooth=True) pair("forearm_core", loft([(9.62, octo(.6, .7, .15, x=2.5)), (11.9, octo(.78, .88, .2, x=2.5))]), "frame", *F, bevel=.02) side = [(-.48, 9.7), (.48, 9.7), (.68, 11.3), (.56, 12.05), (-.56, 12.05), (-.68, 11.3)] outer = two_view([(2.56, 11.9), (2.95, 12.1), (3.24, 11.4), (3.05, 10.4), (2.82, 9.7), (2.56, 9.8)], side, top=[(2.5, -.72), (3.0, -.72), (3.28, 0), (3.0, .72), (2.5, .72)]) pair_pieces("forearm_out", seam(outer, (2.56, 10.6), (3.2, 10.85)), "main", *F, bevel=.03) pair("forearm_in", two_view([(2.12, 9.7), (2.44, 9.7), (2.44, 12.0), (2.0, 12.0), (1.96, 11.4)], side), "main", *F, bevel=.04) pair("forearm_feather", prism([(-.5, 10.0), (.35, 9.95), (1.75, 12.75), (1.5, 12.9), (.45, 11.75), (-.5, 11.6)], 3.16, 3.3, "yz"), "accent", *F, bevel=.03) pair("elbow_cap", two_view([(2.1, 11.55), (3.0, 11.55), (3.0, 12.2), (2.55, 12.42), (2.1, 12.2)], [(.42, 11.5), (.8, 11.6), (.98, 11.95), (.8, 12.32), (.42, 12.38)]), "main", *F, bevel=.03) pair("wrist_band", loft([(9.6, octo(.98, 1.04, .22, x=2.52)), (9.82, octo(1.02, 1.08, .24, x=2.52))]), "frame", *F, bevel=.02) pair("wrist", cylinder(.27, 9.4, 9.74, 10, at=(2.5, 0)), "joint", *HD, smooth=True) pair("palm", loft([(8.92, octo(.48, .8, .1, x=2.52)), (9.48, octo(.46, .78, .1, x=2.52))]), "frame", *HD, bevel=.02) pair("fingers", loft([(8.72, octo(.4, .8, .13, x=2.28)), (9.3, octo(.42, .8, .13, x=2.28))]), "frame", *HD, bevel=.025) pair("thumb", loft([(9.0, octo(.24, .24, .06, x=2.32, y=-.5)), (9.38, octo(.26, .26, .06, x=2.38, y=-.46))]), "frame", *HD, bevel=.02) pair("knuckle", two_view([(2.7, 8.95), (2.86, 9.0), (2.86, 9.55), (2.7, 9.55)], [(-.42, 8.95), (.42, 8.95), (.44, 9.55), (-.44, 9.55)]), "main", *HD, bevel=.015) def legs(lr): TH, SH, FT = lr("thigh"), lr("shin"), lr("foot") pair("hip_ball", cylinder(.5, .55, 1.6, 12, axis="x", at=(0, 10.55)), "joint", *TH, smooth=True) pair("thigh_core", loft([(6.7, octo(.8, .95, .22, x=1.2)), (9.0, octo(1.25, 1.4, .34, x=1.18)), (10.2, octo(1.1, 1.25, .3, x=1.15))]), "frame", *TH, bevel=BEVEL) # front shell: a long shield with a ridge down it, split in two tf = two_view([(.7, 9.9), (1.6, 9.9), (1.92, 9.3), (1.66, 7.9), (1.4, 7.2), (.98, 7.2), (.62, 8.4), (.5, 9.2)], [(-1.0, 7.15), (-.58, 7.15), (-.58, 9.9), (-.88, 9.9), (-1.08, 8.7)], top=[(.4, -.5), (2.0, -.5), (2.0, -.8), (1.2, -1.16), (.4, -.8)]) pair_pieces("thigh_front", seam(tf, (.5, 8.3), (1.9, 8.75)), "main", *TH, bevel=BEVEL) pair("thigh_outer", two_view([(1.66, 7.4), (1.82, 7.45), (2.14, 9.3), (1.98, 9.8)], [(-.45, 7.4), (.55, 7.4), (.7, 9.65), (-.5, 9.65)]), "main", *TH, bevel=.03) pair("thigh_stripe", two_view([(1.9, 8.2), (2.02, 8.22), (2.2, 9.25), (2.08, 9.3)], [(-.3, 8.2), (.4, 8.2), (.52, 9.3), (-.34, 9.3)]), "accent", *TH, bevel=.015) pair("thigh_rear", two_view([(.8, 7.4), (1.6, 7.4), (1.88, 9.45), (.55, 9.45)], [(.38, 7.4), (.58, 7.4), (.88, 9.45), (.64, 9.45)]), "main", *TH, bevel=.03) pair("knee_joint", cylinder(.5, .65, 1.75, 12, axis="x", at=(0, 6.1)), "joint", *SH, smooth=True) pair("knee_disc", cylinder(.46, 1.78, 1.96, 16, axis="x", at=(.05, 6.1)), "main", *SH, smooth=True) pair("knee_hub", cylinder(.2, 1.96, 2.03, 12, axis="x", at=(.05, 6.1)), "trim", *SH, smooth=True) # the knee guard rises to a point above the knee pair("knee_guard", two_view([(.72, 5.7), (1.68, 5.7), (1.76, 6.5), (1.3, 7.45), (1.1, 7.45), (.64, 6.5)], [(-1.22, 5.7), (-.62, 5.7), (-.56, 6.9), (-.72, 7.45), (-.95, 7.45), (-1.25, 6.4)], top=[(.55, -.4), (1.85, -.4), (1.85, -.9), (1.2, -1.28), (.55, -.9)]), "main", *SH, bevel=BEVEL) pair("shin_core", loft([(1.75, octo(.85, 1.0, .22, x=1.2, y=.1)), (5.8, octo(1.0, 1.15, .26, x=1.2))]), "frame", *SH, bevel=.03) env = loft([(1.9, octo(1.15, 1.35, .3, x=1.2, y=.05)), (3.2, octo(1.4, 1.7, .38, x=1.2, y=.2)), (4.5, octo(1.6, 2.0, .45, x=1.2, y=.32)), (5.55, octo(1.2, 1.45, .32, x=1.2, y=.05))]) for name, box in {"shin_outer": dict(x=(1.52, 3), y=(-.1, .7)), "shin_inner": dict(x=(-1, .88), y=(-.1, .7)), "shin_rear": dict(y=(.82, 3))}.items(): pair(name, clip(copy(env), **box), "main", *SH, bevel=.03) env.free() gr = two_view([(.78, 5.5), (1.62, 5.5), (1.74, 4.6), (1.58, 3.3), (1.44, 2.0), (.96, 2.0), (.8, 3.3), (.66, 4.6)], [(-.84, 2.0), (-.6, 2.0), (-.66, 5.5), (-.9, 5.5), (-1.0, 4.4)], top=[(.55, -.45), (1.85, -.45), (1.85, -.68), (1.2, -1.05), (.55, -.68)]) pair_pieces("greave", seam(gr, (.6, 3.05), (1.8, 3.4), gap=.06), "main", *SH, bevel=.03) pair("shin_stripe", two_view([(1.9, 2.9), (2.02, 2.95), (2.12, 4.5), (2.0, 4.55)], [(-.25, 2.9), (.55, 2.9), (.72, 4.5), (-.2, 4.5)]), "accent", *SH, bevel=.02) # calf spur: a blade over the calf, swept up and back, the calf jet under it pair("calf_spur", two_view([(.84, 3.0), (1.56, 3.0), (1.5, 5.75), (.9, 5.75)], [(.75, 3.5), (1.3, 3.0), (2.3, 5.25), (2.08, 5.6), (1.15, 5.1), (.75, 5.3)]), "accent", *SH, bevel=.035) pair("calf_vent", slats(.95, 1.45, 2.2, 2.75, 1.0, 3, depth=.08), "frame", *SH) nozzle_pair("calf", (1.2, 1.2, 2.95), (0, .7, -.7), .28, .45, *SH, housing=False) pair("ankle", cylinder(.42, .75, 1.65, 12, axis="x", at=(.1, 1.55)), "joint", *FT, smooth=True) plan = [(.9, -2.55), (1.5, -2.55), (1.78, -2.0), (1.88, -.9), (1.8, 1.15), (.6, 1.15), (.52, -.9), (.62, -2.0)] pair("spat", two_view([(.62, 1.0), (1.78, 1.0), (1.7, 2.0), (1.2, 2.3), (.7, 2.0)], [(-1.0, 1.0), (-.5, 1.0), (-.45, 2.0), (-.72, 2.3), (-1.06, 1.6)], top=[(.5, -.3), (1.9, -.3), (1.9, -.8), (1.2, -1.1), (.5, -.8)]), "main", *FT, bevel=.03) pair("instep", two_view([(.55, .16), (1.85, .16), (1.8, .9), (1.5, 1.14), (.9, 1.14), (.6, .9)], [(-.95, .16), (.9, .16), (.85, 1.0), (.2, 1.2), (-.9, 1.12)], top=plan), "main", *FT, bevel=.03) pair("toe", two_view([(.55, .12), (1.85, .12), (1.7, .7), (1.2, .92), (.7, .7)], [(-2.55, .12), (-1.0, .12), (-.98, 1.0), (-1.6, .92), (-2.4, .42)], top=plan), "main", *FT, bevel=BEVEL) pair("toe_cap", two_view([(.86, .1), (1.54, .1), (1.5, .5), (.9, .5)], [(-2.64, .1), (-2.25, .1), (-2.22, .56), (-2.5, .5), (-2.66, .3)]), "accent", *FT, bevel=.02) pair("heel", two_view([(.66, .1), (1.76, .1), (1.7, 1.0), (.72, 1.0)], [(.9, .1), (1.7, .1), (1.95, .45), (1.4, 1.0), (.9, 1.1)]), "main", *FT, bevel=BEVEL) pair("heel_spur", prism([(1.5, .1), (2.3, .1), (2.45, .3), (1.6, .95)], 1.0, 1.4, "yz"), "frame", *FT, bevel=.03) pair("ankle_guard", two_view([(1.8, .35), (1.98, .4), (1.98, 1.25), (1.8, 1.3)], [(-.65, .35), (.75, .35), (.65, 1.25), (-.5, 1.25)]), "accent", *FT, bevel=.02) pair("sole_front", prism([(.7, -2.3), (1.7, -2.3), (1.8, -1.1), (.6, -1.1)], 0, .14, "xy"), "joint", *FT, bevel=.02) pair("sole_back", prism([(.62, -.8), (1.78, -.8), (1.7, 1.05), (.7, 1.05)], 0, .14, "xy"), "joint", *FT, bevel=.02) def pack(B, N): # a tall narrow pack, scaled down the spine, the main drives low on either side solid("pack", loft([(12.2, octo(1.5, .95, .25, y=1.65)), (13.4, octo(1.9, 1.05, .3, y=1.7)), (15.1, octo(1.5, .95, .25, y=1.65))]), "frame", B, BEVEL) for i, z in enumerate((14.25, 13.35, 12.45)): solid(f"vertebra{i}", two_view([(-.4, z), (.4, z), (.5, z + 1.0), (-.5, z + 1.0)], [(2.0, z + .12), (2.5, z - .1), (2.32, z + 1.0), (2.0, z + 1.0)]), "main", B, .03) solid("spine_ridge", prism([(2.3, 14.5), (2.62, 14.3), (2.5, 15.2), (2.3, 15.2)], -.08, .08, "yz"), "trim", B, .015) pair("drive_shroud", two_view([(.5, 12.35), (1.6, 12.35), (1.72, 13.5), (.6, 13.62)], [(1.25, 12.55), (2.3, 12.25), (2.5, 13.2), (1.35, 13.62)]), "main", B, B, bevel=BEVEL) nozzle_pair("main", (1.08, 2.2, 12.42), (0, .45, -.9), .5, .9, B, B, housing=False) # the wing fan: three feathers a side on the binder joints, long to short, fanned out and back for s, sx in (("L", 1), ("R", -1)): piv = Vector((.9 * sx, 2.25, 14.7)) Bn = N[f"binder.{s}"] solid(f"wing_hinge.{s}", cylinder(.26, piv.x - .32, piv.x + .32, 12, axis="x", at=(piv.y, piv.z)), "joint", Bn, smooth=True) root = two_view([(.45, 14.25), (1.4, 14.2), (1.55, 15.1), (.5, 15.15)], [(1.9, 14.3), (2.62, 14.1), (2.78, 15.0), (2.0, 15.15)]) solid(f"wing_root.{s}", root if sx > 0 else mirror_x(root), "main", Bn, .03) for k, (splay, tilt, length, w, role, dy) in enumerate(((10, 20, 6.4, 1.25, "main", 0), (24, 24, 5.0, 1.1, "main", .16), (38, 28, 3.4, .95, "accent", .32))): blade = prism([(-.4 * w, .3), (.45 * w, .35), (.62 * w, -length * .2), (.42 * w, -length * .8), (.05 * w, -length), (-.3 * w, -length * .72), (-.5 * w, -length * .15)], -.07, .07, "xz") if sx < 0: blade = mirror_x(blade) m = Matrix.Translation(piv + Vector((0, .25 + dy, 0))) @ rot("Y", -splay * sx) @ rot("X", tilt) solid(f"wing{k}.{s}", transform(blade, m), role, Bn, .025) bell, glow = nozzle(.3, .55) d = Vector((.8 * sx, .5, -.25)) at = piv + Vector((.62 * sx, .1, .05)) solid(f"wing_nozzle.{s}", place(bell, at, d), "frame", Bn, smooth=True) solid(f"wing_nozzle.{s}.glow", place(glow, at, d), "glow_thruster", Bn) empty(f"nozzle.binder.{s}", at + d.normalized() * .55, Bn, dir=gltf_dir(d), radius=.3)result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/zero.py (file state is current in your context — no need to Read it back)
Bashcd ~/Projects/sortie-wt/fable52 && time (npm run -s kit -- block_zero 2>&1 | grep -E "^kit:|Error|Traceback|error|line [0-9]" | head -20) && tools/log.sh "r2 first full build of zero.py (270 lines written in one pass)"
command
cd ~/Projects/sortie-wt/fable52 && time (npm run -s kit -- block_zero 2>&1 | grep -E "^kit:|Error|Traceback|error|line [0-9]" | head -20) && tools/log.sh "r2 first full build of zero.py (270 lines written in one pass)"
result, 6 lines
kit: block_zero -> ~/Projects/sortie-wt/fable52/public/assets/block_zero.glb (868 KB, 4.1s) real 0m5.296s user 0m6.271s sys 0m5.523s 19:11:29 r2 first full build of zero.py (270 lines written in one pass)
agent
+38:32First full build of the refined mech is done (5 s). Shooting stills from four angles to look at it.
BashS=[redacted: private path]/scratchpad && cat > $S/look.sh <<'EOF'
command
S=[redacted: private path]/scratchpad && cat > $S/look.sh <<'EOF' #!/usr/bin/env bash # look.sh <tag> [model] : four stills of a model in the game's renderer, stacked into one jpg set -euo pipefail cd ~/Projects/sortie-wt/fable52 tag=$1 m=${2:-block_zero} d=review/out/fable52/r2/$1 q="view=$m&dist=${DIST:-31}${EXTRA:-}" SORTIE_URL=http://127.0.0.1:5261 W=640 H=900 SHOOT_TIMEOUT=120000 node tools/shoot.mjs $d \ "a=/?$q&yaw=205&pitch=10" "b=/?$q&yaw=150&pitch=4" "c=/?$q&yaw=30&pitch=6" "d=/?$q&yaw=90&pitch=2" 2>&1 | grep -v "403\|ms$" || true ffmpeg -loglevel error -y -i $d/a.png -i $d/b.png -i $d/c.png -i $d/d.png -filter_complex hstack=inputs=4 -q:v 3 $d/look.jpg echo $d/look.jpg EOF chmod +x $S/look.sh && time $S/look.sh p1result, 5 lines
review/out/fable52/r2/p1/look.jpg real 2m26.746s user 0m3.221s sys 0m1.303s
user
+40:13just providing more steering information here. you're here as an adversarial agent intending to prove that you can do much, much better than the prior model who was working on this project. pull all the stops out and do whatever's necessary to break free of what plagues the current project, show me your best work. not just using the tools and following that project's footsteps, the point is a radical improvement that only you could do, compared to where this project has already tread.
agent
+41:32agent
+43:12reasoning
I'm dropping my first pass, which was too slab-bound, and switching to continuous lofted surfaces cut into real panels; I'm building that surfacing tool now and testing it on one leg first.
Bashtools/log.sh "r2 pass 1 looked at: slab vocabulary, same ceiling. owner steer: radical improvement. switching to lofted skins cut into panels" && grep -n "flatShading\|vertexColors\|normal" src/render/materials.ts | head -20 && sed -n 1,40p src/render/materials.ts && uptime
command
tools/log.sh "r2 pass 1 looked at: slab vocabulary, same ceiling. owner steer: radical improvement. switching to lofted skins cut into panels" && grep -n "flatShading\|vertexColors\|normal" src/render/materials.ts | head -20 && sed -n 1,40p src/render/materials.ts && uptime
result, 42 lines
19:16:15 r2 pass 1 looked at: slab vocabulary, same ceiling. owner steer: radical improvement. switching to lofted skins cut into panels import * as THREE from 'three'; import type { Palette, Role } from './palette'; import { addPaintVariation, look } from './look'; /** Painted armour roles: their finish follows the look (matte field paint or gloss kit paint). */ const PAINT = new Set<Role>(['main', 'accent', 'trim', 'hull', 'suit', 'donor_a', 'donor_b', 'donor_c', 'primer', 'handpaint', 'warpaint']); /** Unpainted roles: no wear, grime or ink lines from the detail pass (alien crystal). */ export const BARE = new Set<Role>(['crystal', 'crystal_lit']); // Physically based materials by role: painted armour, bare and dark metal, glass, and unlit glows // that feed the bloom. /** Diagonal hazard stripes from world position, so no UVs are needed. */ function addStripes(m: THREE.MeshStandardMaterial) { m.onBeforeCompile = (shader) => { shader.vertexShader = shader.vertexShader .replace('#include <common>', '#include <common>\nvarying vec3 vStripePos;') .replace('#include <worldpos_vertex>', '#include <worldpos_vertex>\nvStripePos = (modelMatrix * vec4(transformed, 1.0)).xyz;'); shader.fragmentShader = shader.fragmentShader .replace('#include <common>', '#include <common>\nvarying vec3 vStripePos;') .replace( '#include <color_fragment>', `#include <color_fragment> float stripe = step(0.5, fract((vStripePos.x + vStripePos.y + vStripePos.z) * 0.6)); diffuseColor.rgb = mix(vec3(0.03, 0.03, 0.035), diffuseColor.rgb, stripe);`, ); }; m.customProgramCacheKey = () => 'stripes'; } const cache = new Map<string, THREE.Material>(); let bands: THREE.DataTexture | null = null; /** Three lighting bands for the sketch look: shade, half-tone, lit. */ function toonBands() { if (bands) return bands; const d = new Uint8Array([60, 60, 60, 140, 255, 255]); bands = new THREE.DataTexture(d, d.length, 1, THREE.RedFormat); bands.minFilter = bands.magFilter = THREE.NearestFilter; 19:16:15 up 1 day, 7:24, 2 users, load average: 10.63, 9.72, 12.76Write~/Projects/sortie-wt/fable52/kit/blocks/skin.py
input
~/Projects/sortie-wt/fable52/kit/blocks/skin.py """Skins: armour as one designed surface, cut into panels. The old kit builds a plate at a time from flat outlines, so a limb is a stack of slabs. A skin is the other way round: describe the whole limb once as a smooth surface through a few stations, then cut that surface into panels along its own lines. Each panel becomes a thin shell with a rounded rim, so neighbours meet in a shut line, and cells left uncut show the dark core underneath. A station is a cross-section: half width a, depth to the front bf and to the back bb, and an exponent for each half. Exponent 2 is round, 4 is boxy, near 1 comes to a ridge. Stations are joined by a smooth curve, so five numbers a station draw a whole fairing. Angles run in degrees round the section, seen from above: 0 is +X (a left limb's outer side), 90 the back, 180 the inner side, 270 the front. Seams along the limb are the `zs` list, and panels name seams by index. `rake` tilts every ring (and so every cross seam) as a function of the angle. """ import math import bmesh import bpy from mathutils import Matrix, Vector from lib import attach, bake, link, material, mirror_x KEYS = ("a", "bf", "bb", "pf", "pb", "x", "y") def _pw(c, p): return math.copysign(abs(c) ** (2.0 / p), c) def sweep(k): """Rings tilt so the back sits k higher than the front.""" return lambda c, s: k * s def chevron(k, back=0.0): """Rings dip to a V at the front (and rise by `back` toward the rear).""" return lambda c, s: k * abs(c) + back * max(0.0, s) class Skin: def __init__(self, stations, zs, m=48, sub=3, rake=None, frame=None): """stations: dicts with z and any of a, bf, bb, pf, pb, x, y (missing keys carry on from the station below). zs: seam heights, bottom to top. sub: extra rings between seams.""" self.st = [] last = dict(a=1, bf=1, bb=1, pf=2, pb=2, x=0, y=0) for s in stations: last = {**last, **s} self.st.append(last) self.zs = list(zs) self.m = m self.sub = sub self.rake = rake or (lambda c, s: 0.0) self.frame = frame self.rings_z = [] for a, b in zip(self.zs, self.zs[1:]): for k in range(sub + 1): self.rings_z.append(a + (b - a) * k / (sub + 1)) self.rings_z.append(self.zs[-1]) def at(self, z): """The section parameters at a height, by a smooth curve through the stations.""" st = self.st if z <= st[0]["z"]: return st[0] if z >= st[-1]["z"]: return st[-1] k = max(i for i in range(len(st) - 1) if st[i]["z"] <= z) p0, p1 = st[k], st[k + 1] pa, pb = st[max(k - 1, 0)], st[min(k + 2, len(st) - 1)] h = p1["z"] - p0["z"] t = (z - p0["z"]) / h out = {} for key in KEYS: m0 = (p1[key] - pa[key]) / (p1["z"] - pa["z"]) * h m1 = (pb[key] - p0[key]) / (pb["z"] - p0["z"]) * h t2, t3 = t * t, t * t * t out[key] = (2 * t3 - 3 * t2 + 1) * p0[key] + (t3 - 2 * t2 + t) * m0 + (-2 * t3 + 3 * t2) * p1[key] + (t3 - t2) * m1 return out def point(self, z, i, grow=0.0): p = self.at(z) t = 2 * math.pi * i / self.m c, s = math.cos(t), math.sin(t) b, e = (p["bb"], p["pb"]) if s >= 0 else (p["bf"], p["pf"]) e = max(e, 1.0) v = Vector((p["x"] + (p["a"] + grow) * _pw(c, e), p["y"] + (b + grow) * _pw(s, e), z + self.rake(c, s))) return self.frame @ v if self.frame is not None else v def patch(self, u0, u1, v0, v1, grow=0.0): """The cells from angle u0 round to u1 (degrees, may wrap) between seams v0 and v1, as a bmesh.""" i0, i1 = round(u0 / 360 * self.m), round(u1 / 360 * self.m) if i1 <= i0: i1 += self.m j0, j1 = v0 * (self.sub + 1), v1 * (self.sub + 1) closed = i1 - i0 == self.m bm = bmesh.new() rows = [] for j in range(j0, j1 + 1): z = self.rings_z[j] rows.append([bm.verts.new(self.point(z, i, grow)) for i in range(i0, i1 + (0 if closed else 1))]) n = len(rows[0]) for a, b in zip(rows, rows[1:]): for i in range(n if closed else n - 1): k = (i + 1) % n bm.faces.new((a[i], a[k], b[k], b[i])) return bm def core(self, shrink=.1, v0=0, v1=None): """The whole surface drawn in by `shrink`, capped: the dark body the panels stand off.""" v1 = len(self.zs) - 1 if v1 is None else v1 bm = self.patch(0, 360, v0, v1, -shrink) edges = [e for e in bm.edges if len(e.link_faces) == 1] bmesh.ops.holes_fill(bm, edges=edges, sides=0) bmesh.ops.recalc_face_normals(bm, faces=bm.faces) return bm def thicken(bm, t): """Give an open patch a thickness t inward, with a rim, so it is a closed shell.""" bm.normal_update() bm.verts.ensure_lookup_table() outer = bm.faces[:] inner = {v: bm.verts.new(v.co - v.normal * t) for v in bm.verts[:]} border = [(l.vert, l.link_loop_next.vert) for f in outer for l in f.loops if len(l.edge.link_faces) == 1] for f in outer: bm.faces.new([inner[v] for v in reversed(f.verts)]) for a, b in border: bm.faces.new((a, inner[a], inner[b], b)) bmesh.ops.recalc_face_normals(bm, faces=bm.faces) return bm def join(*bms): out = bmesh.new() for b in bms: me = bpy.data.meshes.new("_j") b.to_mesh(me) out.from_mesh(me) bpy.data.meshes.remove(me) b.free() return out def finish(name, bm, role, parent, bevel=.022, segs=2, sharp=36, weighted=True): """A shell with rounded rims and clean highlights: smooth shading, sharp only where the form turns hard, a small round bevel on those edges, and face-weighted normals.""" me = bpy.data.meshes.new(name) bm.to_mesh(me) bm.free() me.materials.append(material(role)) o = link(bpy.data.objects.new(name, me)) me.shade_smooth() me.set_sharp_from_angle(angle=math.radians(sharp)) if bevel > 0: mod = o.modifiers.new("bevel", "BEVEL") mod.width = bevel mod.segments = segs mod.limit_method = "ANGLE" mod.angle_limit = math.radians(sharp) mod.use_clamp_overlap = True mod.miter_outer = "MITER_ARC" if weighted: wn = o.modifiers.new("wn", "WEIGHTED_NORMAL") wn.keep_sharp = True wn.weight = 60 if o.modifiers: bake(o) if parent is not None: attach(o, parent) return o def put(name, bm, role, joint, **kw): """Finish a part on a joint, or on a (left, right) pair of joints with the right side mirrored.""" if isinstance(joint, tuple): right = mirror_x(bm) finish(f"{name}.L", bm, role, joint[0], **kw) finish(f"{name}.R", right, role, joint[1], **kw) else: finish(name, bm, role, joint, **kw) def panels(name, skin, specs, joint, t=.08, **kw): """Cut a skin into shells. specs: (role, u0, u1, v0, v1) or with a sixth value, how far the panel stands proud of the surface. Panels of one role become one part.""" by_role = {} for spec in specs: role, u0, u1, v0, v1 = spec[:5] grow = spec[5] if len(spec) > 5 else 0.0 by_role.setdefault(role, []).append(thicken(skin.patch(u0, u1, v0, v1, grow), t)) for role, bms in by_role.items(): put(f"{name}_{role}", join(*bms), role, joint, **kw)result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/skin.py (file state is current in your context — no need to Read it back)
Bashpython3 - <<'EOF'
command
python3 - <<'EOF' p='src/view/clip.ts'; s=open(p).read() a=" const shots = (q.get('shots')?.split(',') ?? SHOT_NAMES) as ShotName[];\n" assert a in s s=s.replace(a, a+" // ?zoom=1.4 brings the orbit, turn, bend and scale cameras closer, for reading detail\n const zoom = Number(q.get('zoom') ?? 1);\n") b=".multiplyScalar(v.dist * height).add(centre);" assert b in s s=s.replace(b,".multiplyScalar(v.dist * height / zoom).add(centre);") open(p,'w').write(s) EOF cat > tools/look.mjs <<'EOF' // Stills for the builder to read: one model on the review clip page, a full turn and a flight orbit, // tiled into one sheet. Uses a dev server that is already running (clips start their own, this is for // the fast loop). Headless only. // node tools/look.mjs <model> [--url http://127.0.0.1:5261] [--size 520x760] [--zoom 1.3] [--shots turn,orbit] [--out dir] [--look kit] import { spawnSync } from 'node:child_process'; import { mkdirSync, writeFileSync } from 'node:fs'; import { resolve } from 'node:path'; import { chromium } from 'playwright'; const args = process.argv.slice(2); const flag = (name, fallback) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : fallback; }; const name = args[0]; const [w, h] = flag('size', '520x760').split('x').map(Number); const out = resolve(flag('out', `review/out/look/${name}`)); const fps = Number(flag('fps', 2.25)); const params = new URLSearchParams({ view: 'clip', model: name, w, h, fps, shots: flag('shots', 'turn,orbit'), zoom: flag('zoom', '1.3'), palette: flag('palette', 'merc') }); if (flag('look')) params.set('look', flag('look')); mkdirSync(out, { recursive: true }); const started = Date.now(); const browser = await chromium.launch({ args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'] }); try { const page = await browser.newPage({ viewport: { width: w, height: h } }); page.setDefaultTimeout(300000); page.on('pageerror', (e) => console.error('[pageerror]', e.message)); await page.goto(`${flag('url', 'http://127.0.0.1:5261')}/?${params}`); await page.waitForFunction(() => window.__ready === true); const frames = await page.evaluate(() => window.__clip.frames); for (let i = 0; i < frames; i++) { const url = await page.evaluate((n) => window.__clip.render(n), i); writeFileSync(`${out}/f${String(i).padStart(2, '0')}.jpg`, Buffer.from(url.slice(url.indexOf(',') + 1), 'base64')); } const cols = Number(flag('cols', 8)); spawnSync('ffmpeg', ['-loglevel', 'error', '-y', '-framerate', '1', '-i', `${out}/f%02d.jpg`, '-vf', `tile=${cols}x${Math.ceil(frames / cols)}`, '-frames:v', '1', '-q:v', '3', `${out}/sheet.jpg`], { stdio: 'inherit' }); console.log(`look: ${out}/sheet.jpg, ${frames} frames, ${((Date.now() - started) / 1000).toFixed(0)} s`); } finally { await browser.close(); } EOF cat > kit/blocks/legtest.py <<'EOF' """Surface test: one shin as a skin, on the dummy's boxes, to compare against the slab shin.""" from blocks.skin import Skin, panels, put, sweep def build(Blocks): b = Blocks() b.mannequin() SH = (b.nodes["shin.L"], b.nodes["shin.R"]) shin = Skin([dict(z=1.85, a=.55, bf=.66, bb=.6, pf=1.35, pb=2.6, x=1.2, y=.08), dict(z=2.6, a=.62, bf=.74, bb=.76, y=.1), dict(z=4.0, a=.76, bf=.84, bb=1.18, y=.15), dict(z=5.0, a=.72, bf=.86, bb=1.05, y=.1), dict(z=5.85, a=.6, bf=.8, bb=.6, y=0)], zs=[1.85, 2.5, 3.3, 4.6, 5.3, 5.85], rake=sweep(.35)) put("shin_core", shin.core(.1), "frame", SH, bevel=0) panels("shin", shin, [("main", 225, 315, 1, 5), ("accent", 225, 315, 0, 1), ("main", 315, 45, 0, 4), ("main", 45, 135, 1, 5), ("main", 135, 225, 0, 4), ("main", 240, 300, 2, 5, .07), ("accent", 345, 15, 2, 3, .05)], SH) EOF (npm run -s kit -- block_legtest 2>&1 | grep -E "^kit:|Error|Traceback|error|File|line" | head -20); time node tools/look.mjs block_legtest --shots turn --out review/out/fable52/r2/legtest --zoom 1.3result, 6 lines
kit: block_legtest -> ~/Projects/sortie-wt/fable52/public/assets/block_legtest.glb (501 KB, 0.5s) look: ~/Projects/sortie-wt/fable52/review/out/fable52/r2/legtest/sheet.jpg, 9 frames, 15 s real 0m16.220s user 0m1.294s sys 0m0.972s
Bashcd ~/Projects/sortie-wt/fable52/review/out/fable52/r2/legtest && ffmpeg -loglevel error -y -i f01.jpg -i f03.jpg -i f05.jpg -i f07.jpg -filter_complex "[0]crop=260:380:130:380[a];[1]crop=260:380:130:380[b];[2]crop=260:380:130:380[c];[3]crop=260:380:130:380[d];[a][b][c][d]hstack=inputs=4,scale=iw*1.5:-1" -q:v 2 crop.jpg
command
cd ~/Projects/sortie-wt/fable52/review/out/fable52/r2/legtest && ffmpeg -loglevel error -y -i f01.jpg -i f03.jpg -i f05.jpg -i f07.jpg -filter_complex "[0]crop=260:380:130:380[a];[1]crop=260:380:130:380[b];[2]crop=260:380:130:380[c];[3]crop=260:380:130:380[d];[a][b][c][d]hstack=inputs=4,scale=iw*1.5:-1" -q:v 2 crop.jpg
result, 1 line
(Bash completed with no output)
Read~/Projects/sortie-wt/fable52/review/out/fable52/r2/legtest/crop.jpg
input
{ "file_path": "~/Projects/sortie-wt/fable52/review/out/fable52/r2/legtest/crop.jpg" }result
no output
agent
+49:22The surface test worked: a curved shin fairing with real shut lines, 16 s per look. Now writing the whole mech with that method.
Bashcd ~/Projects/sortie-wt/fable52 && tools/log.sh "r2 skin tool written and tested on one shin: curved panels work, look loop is 16 s for 9 angles" && git mv -k kit/blocks/zero.py kit/blocks/zero_slab.py 2>/dev/null || mv kit/blocks/zero.py kit/blocks/zero_slab.py && python3 - <<'EOF'
command
cd ~/Projects/sortie-wt/fable52 && tools/log.sh "r2 skin tool written and tested on one shin: curved panels work, look loop is 16 s for 9 angles" && git mv -k kit/blocks/zero.py kit/blocks/zero_slab.py 2>/dev/null || mv kit/blocks/zero.py kit/blocks/zero_slab.py && python3 - <<'EOF' p='kit/blocks/skin.py'; s=open(p).read() # spin, gap inset, float columns s=s.replace(''' def __init__(self, stations, zs, m=48, sub=3, rake=None, frame=None):''',''' def __init__(self, stations, zs, m=48, sub=3, rake=None, frame=None, spin=0.0, gap=.025):''') s=s.replace(''' self.frame = frame self.rings_z = []''',''' self.frame = frame self.spin = math.radians(spin) self.gap = gap self.rings_z = []''') s=s.replace(''' v = Vector((p["x"] + (p["a"] + grow) * _pw(c, e), p["y"] + (b + grow) * _pw(s, e), z + self.rake(c, s))) return self.frame @ v if self.frame is not None else v''',''' ox, oy = (p["a"] + grow) * _pw(c, e), (b + grow) * _pw(s, e) if self.spin: cs, sn = math.cos(self.spin), math.sin(self.spin) ox, oy = ox * cs - oy * sn, ox * sn + oy * cs v = Vector((p["x"] + ox, p["y"] + oy, z + self.rake(c, s))) return self.frame @ v if self.frame is not None else v''') a=s.index(' def patch(self'); b=s.index(' def core(self') s=s[:a]+''' def patch(self, u0, u1, v0, v1, grow=0.0, gap=None): """The cells from angle u0 round to u1 (degrees, may wrap) between seams v0 and v1, as a bmesh. The patch stops `gap` short of its own border, so neighbours leave a shut line between them.""" gap = self.gap if gap is None else gap i0, i1 = round(u0 / 360 * self.m), round(u1 / 360 * self.m) if i1 <= i0: i1 += self.m j0, j1 = v0 * (self.sub + 1), v1 * (self.sub + 1) closed = i1 - i0 == self.m zs = self.rings_z[j0:j1 + 1] mid = self.at((zs[0] + zs[-1]) / 2) cell = 2 * math.pi * (mid["a"] + (mid["bf"] + mid["bb"]) / 2) / 2 / self.m di = 0.0 if closed else min(.42, gap / max(cell, 1e-4)) dz = min(gap, abs(zs[1] - zs[0]) * .42) zs = [zs[0] + dz] + zs[1:-1] + [zs[-1] - dz] cols = list(range(i0, i1 + (0 if closed else 1))) if not closed: cols[0], cols[-1] = i0 + di, i1 - di bm = bmesh.new() rows = [[bm.verts.new(self.point(z, i, grow)) for i in cols] for z in zs] n = len(cols) for a, b in zip(rows, rows[1:]): for i in range(n if closed else n - 1): k = (i + 1) % n bm.faces.new((a[i], a[k], b[k], b[i])) return bm '''+s[b:] s=s.replace(''' bm = self.patch(0, 360, v0, v1, -shrink)''',''' bm = self.patch(0, 360, v0, v1, -shrink, gap=0)''') s+=''' def sym(role, u0, u1, v0, v1, *grow): """A panel and its mirror across the centre line, for a skin on the centre line.""" return [(role, u0 % 360, u1 % 360, v0, v1, *grow), (role, (180 - u1) % 360, (180 - u0) % 360, v0, v1, *grow)] def blade(length, chord, thick, at, turns=(), lean=0.0, belly=.22, m=16): """A feather: a blade with a lens section and a ridge down each face, built along +Z from `at`, then turned by (axis, degrees) in order. `lean` carries the tip sideways along the chord.""" c, h = chord / 2, thick / 2 st = [dict(z=0, a=c * .7, bf=h * .8, bb=h * .8, pf=1.15, pb=1.15, x=0), dict(z=length * belly, a=c, bf=h, bb=h, x=lean * .2), dict(z=length * .76, a=c * .6, bf=h * .7, bb=h * .7, x=lean * .78), dict(z=length, a=.035, bf=.02, bb=.02, x=lean)] frame = Matrix.Translation(Vector(at)) for axis, deg in turns: frame = frame @ Matrix.Rotation(math.radians(deg), 4, axis) return Skin(st, [0, length * belly, length * .76, length], m=m, sub=3, frame=frame).core(0) ''' open(p,'w').write(s) EOF echo okresult, 2 lines
19:22:40 r2 skin tool written and tested on one shin: curved panels work, look loop is 16 s for 9 angles ok

