user

+34:38

[the lead] New ask from the owner (verbatim): "ask sortie carbon to try and take one of its outlines to a level of refinement like the control one. maybe we let it take its own spin on the control mech's same outline, so 0 is closest?"

So: take block_dummy (the shared skeleton, the outline closest to the striker) and make your own design on it, refined to the striker's (S) level: plates, panel lines, joints, colour blocking, cockpit, thrusters, the works, your own spin rather than a copy. Present it: from behind in flight, the game's plumes, then a full turn, with S beside it as the yardstick. Same rules as before (your worktree and branch only, headless, nothing pushed, no Gundam lookalikes). Add it to your page as a second section (keep the first), say how it was made and how long it took, and time the steps so we can see where the hours go. End your turn with the page path and a short summary.

[the owner, 9 minutes later] just 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.

[the owner, 16 minutes later] mind telling me how you're deviating now? just so I can tell early if you're just going by the usual route

[the owner, 21 minutes later] if you need to use blender go for it, I need your absolute best

agent

+34:38
reasoning

I'm thinking through how to approach this.

Initial suspicion was a cache miss, but traces show database latency is the actual bottleneck. I'm thinking through how to approach this. It appears the task involves generating a design based on a provided outline, refining it to match a reference, and presenting the result with specified views and information. The approach involves developing a variant of the shared outline. It needs to be presented with a comparison to the reference design. The constraints are to work within a defined workspace and avoid certain visual styles.

The task demands a significant departure from the existing project trajectory, aiming for a superior result. This requires identifying and actively avoiding the project's current limitations, focusing on novel methods. A specific request for deviation is implied, necessitating documentation of the altered approach. The owner has explicitly authorized the use of additional tools, like the 3D modeling software, to achieve the best possible outcome.

The turn's completion hinges on delivering the output; premature termination is a risk if the task isn't fully addressed. The provided <USER_REQUEST> block appears to be a transcript of multiple interactions from a parallel session, not a single, immediate request. This suggests a continuous dialogue that must be considered for output generation.

The owner's directive emphasizes documenting the deviation from the usual design approach, adding a new section to the output page. It should detail the creation process, including time tracking of steps, and address the owner's specific question regarding the deviation. The turn's completion hinges on the full mech build, the side-by-side render, the updated HTML file, and the Git commit.

  • read_file{"Path":"~/work/sortie/kit/mech.py"}

    input

    {
      "Path": "~/work/sortie/kit/mech.py"
    }

    result, 401 lines

    Showing lines 1-400 of 400
    1: """Mech frames. A frame is a tree of joint empties with rigid armour parented to them, so the game
    2: poses it by rotating joints (no skinning). Left is +X (the model faces -Y).
    3: 
    4: Joint tree (names are the contract with src/render/mech.ts):
    5:   frame > pelvis > waist > torso > neck > head
    6:                                    torso > shoulder.L > upperarm.L > forearm.L > hand.L > grip.L
    7:                                    torso > backpack > binder.L
    8:                                    torso > cockpit
    9:           pelvis > thigh.L > shin.L > foot.L
    10: Thruster exits are empties named nozzle.* with a "dir" extra (exhaust direction, glTF axes).
    11: 
    12: Proportions follow measured Gundam 00 line art (review/out/refs/proportions.md): head about a tenth
    13: of the height, hip joint at 60%, shoulder span about half the height on shells that stand off a
    14: compact chest, a waist a ninth of the height, every limb in layered shells over a dark inner frame.
    15: """
    16: from mathutils import Matrix, Vector
    17: 
    18: from lib import (circle, clip, copy, cylinder, empty, halves, loft, merge, mirror_x, nozzle, octo, piston, prism, rot, slats, solid,
    19:                  transform, two_view)
    20: 
    21: BEVEL = 0.05
    22: 
    23: 
    24: def gltf_dir(v):
    25:     v = Vector(v).normalized()
    26:     return [round(v.x, 4), round(v.z, 4), round(-v.y, 4)]
    27: 
    28: 
    29: def place(bm, at, direction):
    30:     """Turn a part built along -Z to point along `direction`, then move it to `at`."""
    31:     q = Vector((0, 0, -1)).rotation_difference(Vector(direction).normalized())
    32:     return transform(bm, Matrix.Translation(Vector(at)) @ q.to_matrix().to_4x4())
    33: 
    34: 
    35: def pair(name, bm_left, role, jl, jr, **kw):
    36:     """Make the left part and its mirror on the right."""
    37:     bm_right = mirror_x(bm_left)
    38:     return solid(f"{name}.L", bm_left, role, jl, **kw), solid(f"{name}.R", bm_right, role, jr, **kw)
    39: 
    40: 
    41: def nozzle_pair(name, at, direction, r, length, jl, jr, shell="frame", housing=True):
    42:     ex = Vector(at)
    43:     for side, j, sx in (("L", jl, 1), ("R", jr, -1)):
    44:         p = Vector((ex.x * sx, ex.y, ex.z))
    45:         d = Vector((direction[0] * sx, direction[1], direction[2]))
    46:         bell, glow = nozzle(r, length)
    47:         solid(f"{name}.{side}", place(bell, p, d), shell, j, smooth=True)
    48:         solid(f"{name}.{side}.glow", place(glow, p, d), "glow_thruster", j, outline=False)
    49:         # an armoured housing around the throat, so the nozzle reads as mounted, not floating
    50:         if housing:
    51:             house = loft([(length * .5, octo(r * 2.5, r * 2.5, r * .6)), (-length * .3, octo(r * 2.3, r * 2.3, r * .55))])
    52:             solid(f"{name}_housing.{side}", place(house, p, d), "main", j, bevel=.02, panels=False)
    53:         empty(f"nozzle.{name}.{side}", p + d.normalized() * length, j, dir=gltf_dir(d), radius=r)
    54: 
    55: 
    56: def seam(bm, a, b, gap=.05):
    57:     """Split a solid along the line a->b of the front view (x, z): two plates with a real seam."""
    58:     a, b = Vector((a[0], 0, a[1])), Vector((b[0], 0, b[1]))
    59:     d = (b - a).normalized()
    60:     n = Vector((-d.z, 0, d.x))
    61:     return halves(bm, a, n, gap)
    62: 
    63: 
    64: def pair_pieces(name, pieces, role, jl, jr, **kw):
    65:     for i, bm in enumerate(pieces):
    66:         pair(f"{name}{i}", bm, role, jl, jr, **kw)
    67: 
    68: 
    69: def joints():
    70:     J = {"frame": empty("frame", (0, 0, 0), frame="striker", height=17.6)}
    71:     J["pelvis"] = empty("pelvis", (0, 0, 10.6), J["frame"])
    72:     J["waist"] = empty("waist", (0, 0, 11.1), J["pelvis"])
    73:     J["torso"] = empty("torso", (0, 0, 11.9), J["waist"])
    74:     J["neck"] = empty("neck", (0, 0, 15.3), J["torso"])
    75:     J["head"] = empty("head", (0, 0, 15.85), J["neck"])
    76:     J["backpack"] = empty("backpack", (0, 1.5, 13.8), J["torso"])
    77:     J["cockpit"] = empty("cockpit", (0, -0.75, 13.7), J["torso"])
    78:     for s, sx in (("L", 1), ("R", -1)):
    79:         J["shoulder", s] = empty(f"shoulder.{s}", (2.0 * sx, 0, 14.6), J["torso"])
    80:         J["upperarm", s] = empty(f"upperarm.{s}", (2.45 * sx, 0, 14.4), J["shoulder", s])
    81:         J["forearm", s] = empty(f"forearm.{s}", (2.5 * sx, 0, 11.95), J["upperarm", s])
    82:         J["hand", s] = empty(f"hand.{s}", (2.5 * sx, 0, 9.6), J["forearm", s])
    83:         J["grip", s] = empty(f"grip.{s}", (2.36 * sx, -0.02, 9.12), J["hand", s])
    84:         J["thigh", s] = empty(f"thigh.{s}", (1.15 * sx, 0, 10.55), J["pelvis"])
    85:         J["shin", s] = empty(f"shin.{s}", (1.2 * sx, 0, 6.1), J["thigh", s])
    86:         J["foot", s] = empty(f"foot.{s}", (1.2 * sx, 0.1, 1.55), J["shin", s])
    87:         J["binder", s] = empty(f"binder.{s}", (0.9 * sx, 2.25, 14.7), J["backpack"])
    88:     return J
    89: 
    90: 
    91: def lr(J, part):
    92:     return J[part, "L"], J[part, "R"]
    93: 
    94: 
    95: def build_pelvis(J):
    96:     P = J["pelvis"]
    97:     solid("pelvis_core", loft([(9.95, octo(.9, 1.3, .25)), (10.4, octo(2.2, 1.7, .4)), (11.0, octo(2.3, 1.75, .45))]),
    98:           "frame", P, BEVEL)
    99:     # the waist belt flares from the abdomen out to hip width; everything below hangs from it
    100:     solid("belt", loft([(10.55, octo(3.2, 2.05, .5)), (10.98, octo(2.1, 1.7, .42))]), "main", P, BEVEL)
    101:     solid("belt_buckle", two_view([(-.3, 10.58), (.3, 10.58), (.18, 10.96), (-.18, 10.96)],
    102:                                   [(-1.14, 10.58), (-.96, 10.58), (-.86, 10.96), (-1.02, 10.96)]), "trim", P, .02)
    103:     pair("hip_block", loft([(10.2, octo(.42, .95, .1, x=1.74)), (10.72, octo(.42, .95, .1, x=1.74))]), "frame", P, P, bevel=.02)
    104:     solid("codpiece", two_view([(-.2, 9.62), (.2, 9.62), (.32, 10.2), (.3, 10.58), (-.3, 10.58), (-.32, 10.2)],
    105:                                [(-1.14, 9.68), (-.75, 9.68), (-.8, 10.58), (-1.08, 10.58), (-1.22, 10.2)]), "trim", P, BEVEL)
    106:     # front skirt: two blades sweeping out from the centre like an arrowhead
    107:     pair("skirt_front", two_view([(.45, 10.62), (1.45, 10.62), (2.05, 10.3), (1.65, 9.6), (.65, 9.9)],
    108:                                  [(-1.34, 9.55), (-1.02, 9.55), (-.94, 10.66), (-1.24, 10.66)]), "main", P, P, bevel=BEVEL)
    109:     pair("skirt_front_edge", two_view([(.68, 9.85), (1.64, 9.55), (1.74, 9.71), (.72, 9.99)],
    110:                                       [(-1.4, 9.47), (-1.06, 9.47), (-1.02, 10.05), (-1.36, 10.05)]), "accent", P, P, bevel=0.015)
    111:     # side skirts flare out toward the bottom, tips swept back
    112:     # side skirts hinge from the hip blocks: a cap plate over a ridged main plate
    113:     pair("skirt_side", two_view([(2.0, 9.5), (2.34, 9.5), (2.12, 10.5), (1.86, 10.52)],
    114:                                 [(-.6, 9.5), (1.05, 9.5), (.95, 10.54), (-.9, 10.54)],
    115:                                 top=[(1.8, -1.0), (2.17, -1.0), (2.42, .05), (2.17, 1.15), (1.8, 1.15)]), "main", P, P, bevel=BEVEL)
    116:     pair("skirt_side_cap", two_view([(1.86, 10.28), (2.3, 10.22), (2.22, 10.74), (1.86, 10.76)],
    117:                                     [(-.72, 10.22), (.92, 10.22), (.86, 10.76), (-.78, 10.76)]), "accent", P, P, bevel=0.025)
    118:     pair("skirt_side_plate", two_view([(2.26, 9.66), (2.4, 9.69), (2.26, 10.16), (2.12, 10.14)],
    119:                                       [(-.4, 9.66), (.85, 9.66), (.78, 10.16), (-.55, 10.16)]), "frame", P, P, bevel=0.015)
    120:     # rear skirt as two overlapping scales with a gap over the hip mechanism
    121:     # rear skirt: descending chevrons, a gap at the centre
    122:     pair("skirt_rear", two_view([(.14, 10.6), (1.26, 10.66), (1.61, 10.35), (1.46, 9.92), (.64, 9.82), (.18, 10.05)],
    123:                                 [(.92, 9.75), (1.26, 9.75), (1.32, 10.7), (.94, 10.7)]), "main", P, P, bevel=BEVEL)
    124:     pair("skirt_rear_low", two_view([(.14, 10.1), (.62, 9.93), (1.3, 10.02), (1.3, 9.63), (.6, 9.4), (.14, 9.6)],
    125:                                     [(1.02, 9.36), (1.36, 9.36), (1.36, 10.14), (1.02, 10.14)]), "main", P, P, bevel=0.03)
    126: 
    127: 
    128: def build_waist(J):
    129:     W = J["waist"]
    130:     solid("abdomen", loft([(10.9, octo(1.6, 1.4, .35)), (11.95, octo(1.85, 1.55, .38))]), "joint", W, 0.03)
    131:     # three stacked plates in front, each a little wider and further forward than the one below
    132:     for i, (z0, z1, hw, y) in enumerate(((10.98, 11.34, .64, -.84), (11.28, 11.64, .72, -.88), (11.58, 11.96, .8, -.92))):
    133:         solid(f"abs{i}", two_view([(-hw, z0), (hw, z0), (hw + .06, z1), (-hw - .06, z1)],
    134:                                   [(y + .02, z0), (y + .24, z0), (y + .24, z1), (y - .02, z1)],
    135:                                   top=[(-hw - .1, y + .3), (hw + .1, y + .3), (hw + .1, y + .1), (0, y - .06), (-hw - .1, y + .1)]),
    136:               "frame", W, 0.02)
    137:     pair("abs_side", two_view([(.72, 11.0), (.96, 11.05), (1.02, 11.92), (.78, 11.92)],
    138:                               [(-.5, 11.0), (.5, 11.0), (.56, 11.92), (-.56, 11.92)]), "frame", W, W, bevel=0.02)
    139: 
    140: 
    141: def build_torso(J):
    142:     T = J["torso"]
    143:     # a dark structural core; the armour is separate plates over it
    144:     solid("chest", loft([(11.9, octo(1.9, 1.6, .4, y=.05)), (12.6, octo(2.4, 2.05, .45)), (13.9, octo(3.0, 2.45, .55, y=-.05)),
    145:                          (14.9, octo(2.8, 2.25, .5)), (15.3, octo(1.8, 1.55, .4))]), "frame", T, BEVEL)
    146:     # central hatch: a ridged block down the chest front that carries the reactor lens
    147:     solid("hatch", two_view([(-.55, 12.75), (.55, 12.75), (.6, 14.5), (.4, 14.78), (-.4, 14.78), (-.6, 14.5)],
    148:                             [(-1.62, 12.75), (-1.2, 12.75), (-1.3, 14.78), (-1.66, 14.62), (-1.8, 13.8)],
    149:                             top=[(-.7, -1.0), (.7, -1.0), (.7, -1.55), (0, -1.84), (-.7, -1.55)]), "main", T, .03)
    150:     pair("chest_plate", two_view([(.58, 14.82), (1.18, 14.88), (1.55, 14.62), (1.78, 14.28), (1.55, 13.85), (.6, 14.08)],
    151:                                  [(-1.64, 13.6), (-1.1, 13.6), (-1.26, 14.88), (-1.5, 14.88), (-1.72, 13.85)]),
    152:          "accent", T, T, bevel=BEVEL)
    153:     rib = two_view([(.6, 12.7), (.9, 12.6), (1.6, 13.2), (1.62, 13.54), (.6, 13.88)],
    154:                    [(-1.49, 12.5), (-.95, 12.5), (-1.1, 13.92), (-1.35, 13.92), (-1.57, 13.55)])
    155:     pair_pieces("rib_plate", seam(rib, (.6, 13.22), (1.62, 13.05)), "accent", T, T, bevel=0.03)
    156:     pair("chest_strip", two_view([(.6, 14.84), (1.18, 14.9), (1.57, 14.64), (1.8, 14.28), (1.64, 14.2), (1.42, 14.5), (1.1, 14.7),
    157:                                   (.6, 14.64)],
    158:                                  [(-1.72, 13.9), (-1.22, 13.9), (-1.36, 14.96), (-1.6, 14.96), (-1.8, 14.2)]), "main", T, T, bevel=0.02)
    159:     pair("side_plate", two_view([(1.42, 12.9), (1.62, 12.9), (1.68, 14.4), (1.48, 14.6)],
    160:                                 [(-.95, 12.9), (.9, 12.9), (.95, 14.4), (-1.05, 14.45)]), "main", T, T, bevel=0.03)
    161:     solid("belly", two_view([(-.95, 11.92), (.95, 11.92), (1.22, 12.62), (-1.22, 12.62)],
    162:                             [(-1.34, 11.9), (-.98, 11.9), (-1.08, 12.66), (-1.4, 12.66)]), "main", T, BEVEL)
    163:     solid("belly_vent", slats(-.6, .6, 12.02, 12.48, -1.38, 3, depth=.08), "frame", T)
    164:     # the reactor lens in the chest
    165:     solid("lens_socket", prism(circle(.44, 12, 0, 13.62), -1.92, -1.5, "xz"), "frame", T, 0.03)
    166:     solid("lens", prism(circle(.33, 12, 0, 13.62), -1.97, -1.9, "xz"), "sensor", T, smooth=True)
    167:     solid("lens_core", prism(circle(.11, 8, 0, 13.62), -1.99, -1.95, "xz"), "glow_core", T)
    168:     # collar: thin folded plates (front and side) with room around the neck
    169:     pair("collar", two_view([(.55, 14.72), (1.46, 14.76), (1.55, 15.3), (1.1, 15.55), (.62, 15.45)],
    170:                             [(-1.0, 14.7), (-.84, 14.7), (-.68, 15.55), (-.84, 15.55)]), "main", T, T, bevel=0.025)
    171:     pair("collar_side", two_view([(1.36, 14.7), (1.52, 14.7), (1.42, 15.5), (1.26, 15.5)],
    172:                                  [(-.9, 14.7), (.7, 14.7), (.6, 15.5), (-.7, 15.5)]), "main", T, T, bevel=0.025)
    173:     pair("collar_vent", slats(.72, 1.26, 14.86, 15.2, -1.0, 3, depth=.06), "frame", T, T)
    174:     solid("neck_guard", two_view([(-.55, 15.2), (.55, 15.2), (.5, 15.86), (-.5, 15.86)],
    175:                                  [(.25, 15.2), (.72, 15.2), (.64, 15.86), (.36, 15.86)]), "main", T, .02)
    176:     solid("back_plate", two_view([(-.95, 12.35), (.95, 12.35), (1.62, 14.92), (-1.62, 14.92)],
    177:                                  [(1.14, 12.35), (1.46, 12.35), (1.52, 14.92), (1.24, 14.92)]), "accent", T, BEVEL)
    178: 
    179: 
    180: def build_head(J):
    181:     N, H = J["neck"], J["head"]
    182:     solid("neck_core", cylinder(.36, 15.25, 16.0, 10), "joint", N, smooth=True)
    183:     solid("neck_ring", loft([(15.5, octo(.95, .9, .2)), (15.68, octo(.86, .82, .18))]), "frame", N, .015)
    184:     # cranium: the top plate, tapered toward the back in plan
    185:     solid("cranium", two_view([(-.62, 16.66), (.62, 16.66), (.58, 17.05), (.36, 17.28), (-.36, 17.28), (-.58, 17.05)],
    186:                               [(-.86, 16.7), (-.5, 17.2), (.25, 17.3), (.72, 17.0), (.78, 16.66)],
    187:                               top=[(-.4, -.88), (.4, -.88), (.62, -.4), (.55, .6), (0, .86), (-.55, .6), (-.62, -.4)]), "main", H, .03)
    188:     solid("skull", loft([(15.95, octo(.9, 1.15, .25, y=.05)), (16.7, octo(1.1, 1.4, .3, y=.0))]), "frame", H, .02)
    189:     # side plates frame the face and run back past the ears
    190:     pair("helmet_side", two_view([(.48, 15.98), (.7, 16.28), (.77, 16.9), (.62, 17.04), (.55, 16.5), (.42, 16.06)],
    191:                                  [(-.72, 15.98), (.62, 15.98), (.74, 16.6), (.5, 17.04), (-.56, 17.0), (-.82, 16.52)]), "main", H, H, bevel=.025)
    192:     # sensor band under a broad, slightly peaked brow hood
    193:     solid("visor", two_view([(-.6, 16.48), (.6, 16.48), (.6, 16.64), (-.6, 16.64)],
    194:                             [(-.97, 16.46), (-.62, 16.46), (-.62, 16.66), (-.95, 16.66)]), "visor", H, 0.01)
    195:     solid("sensor_band", two_view([(-.5, 16.535), (.5, 16.535), (.5, 16.585), (-.5, 16.585)],
    196:                                   [(-.99, 16.5), (-.93, 16.5), (-.93, 16.62), (-.99, 16.62)]), "glow_eye", H)
    197:     solid("brow_hood", two_view([(-.68, 16.62), (.68, 16.62), (.62, 16.8), (.18, 16.88), (-.18, 16.88), (-.62, 16.8)],
    198:                                 [(-1.07, 16.62), (-.55, 16.62), (-.55, 16.88), (-.95, 16.86)],
    199:                                 top=[(-.7, -.5), (.7, -.5), (.7, -.92), (0, -1.1), (-.7, -.92)]), "main", H, 0.02)
    200:     # lower face: a dark recessed mask with vertical vents, two faceted plates over it
    201:     solid("mask", two_view([(-.3, 15.9), (.3, 15.9), (.42, 16.45), (-.42, 16.45)],
    202:                            [(-.72, 15.9), (-.5, 15.9), (-.55, 16.46), (-.8, 16.46)]), "frame", H, 0.015)
    203:     vents = [prism([(x - .025, 15.98), (x + .025, 15.98), (x + .025, 16.3), (x - .025, 16.3)], -.8, -.7, "xz") for x in (-.1, 0, .1)]
    204:     solid("mask_vents", merge(*vents), "joint", H)
    205:     pair("mask_plate", two_view([(.12, 15.92), (.36, 16.0), (.44, 16.42), (.16, 16.42)],
    206:                                 [(-.84, 15.95), (-.6, 15.95), (-.62, 16.44), (-.88, 16.44)]), "main", H, H, bevel=0.015)
    207:     # ear sensors: blocks with a lens on the outer face
    208:     pair("ear", two_view([(.7, 16.3), (.86, 16.33), (.86, 16.66), (.7, 16.7)],
    209:                          [(-.25, 16.3), (.22, 16.3), (.28, 16.66), (-.2, 16.7)]), "accent", H, H, bevel=.02)
    210:     pair("ear_lens", cylinder(.085, .85, .9, 12, axis="x", at=(-.01, 16.48)), "sensor", H, H, smooth=True)
    211:     solid("helmet_rear", two_view([(-.55, 16.08), (.55, 16.08), (.6, 16.7), (-.6, 16.7)],
    212:                                   [(.42, 16.04), (.8, 16.2), (.82, 16.7), (.52, 16.76)]), "main", H, .02)
    213:     solid("rear_fin", prism([(.45, 16.95), (.92, 16.86), (1.0, 17.0), (.62, 17.18)], -.05, .05, "yz"), "frame", H, .01)
    214:     solid("crest", two_view([(-.1, 16.9), (.1, 16.9), (.04, 17.62), (-.04, 17.62)],
    215:                             [(-.62, 16.98), (-.34, 17.25), (.48, 17.60), (.67, 17.54), (.15, 17.12), (-.32, 16.94)]), "trim", H, 0.01)
    216: 
    217: 
    218: def build_arms(J):
    219:     pair("shoulder_block", loft([(1.45, octo(1.5, 1.4, .35, y=14.55)), (2.62, octo(1.45, 1.35, .35, y=14.55))], axis="x"),
    220:          "frame", *lr(J, "shoulder"), bevel=BEVEL)
    221:     # the shoulder shell: a folded plate (top and outer drop) standing off the block
    222:     # shoulder shell: a swept roof and a separate outer blade, tapered in plan, open underneath
    223:     plan = [(1.85, -.65), (3.25, -1.05), (4.3, .10), (4.1, .75), (3.2, 1.1), (1.85, .60)]
    224:     side = [(-1.3, 14.2), (1.3, 14.2), (1.3, 15.95), (-1.3, 15.95)]
    225:     cap = [(-.90, 15.35), (.30, 15.65), (.95, 15.20), (.70, 14.55), (-.65, 14.65)]
    226:     roof = two_view([(1.90, 15.16), (3.38, 15.87), (3.72, 15.61), (3.45, 15.15), (2.12, 14.87)],
    227:                     [(-1.25, 14.75), (.4, 15.95), (1.15, 15.4), (.9, 14.8), (-.9, 14.75)], top=plan)
    228:     pair_pieces("shell", seam(roof, (2.78, 14.6), (2.62, 16.2), gap=.05), "accent", *lr(J, "shoulder"), bevel=0.03)
    229:     pair("shell_under", two_view([(2.1, 14.74), (3.3, 15.06), (3.36, 14.86), (2.2, 14.58)], cap, top=plan),
    230:          "frame", *lr(J, "shoulder"), bevel=0.02)
    231:     pair("trunnion", cylinder(.325, 2.25, 2.95, 12, axis="x", at=(0, 14.55)), "joint", *lr(J, "shoulder"), smooth=True)
    232:     for k, y in (("f", -.45), ("r", .45)):
    233:         pair(f"fork_{k}", two_view([(2.2, 14.1), (2.9, 14.2), (2.9, 14.95), (2.2, 15.0)],
    234:                                    [(y - .08, 14.1), (y + .08, 14.1), (y + .08, 15.0), (y - .08, 15.0)]), "frame",
    235:              *lr(J, "shoulder"), bevel=0.02)
    236:     pair("shell_blade", two_view([(3.62, 15.84), (4.2, 15.65), (3.98, 14.65), (3.72, 14.5), (3.55, 15.08)], side, top=plan),
    237:          "accent", *lr(J, "shoulder"), bevel=0.04)
    238:     pair("shell_edge", two_view([(2.0, 14.86), (3.55, 15.06), (3.55, 15.18), (1.95, 14.98)], side,
    239:                                 top=[(1.85, -.74), (3.25, -1.14), (3.42, -.9), (1.9, -.52)]),
    240:          "main", *lr(J, "shoulder"), bevel=0.012)
    241:     pair("shell_fin", prism([(-.6, 15.5), (1.0, 15.55), (.8, 16.05), (.05, 15.95)], 2.9, 3.05, "yz"), "main",
    242:          *lr(J, "shoulder"), bevel=0.02)
    243:     pair("upperarm_core", loft([(12.2, octo(.85, .9, .22, x=2.5)), (14.2, octo(.9, .95, .24, x=2.48))]), "joint",
    244:          *lr(J, "upperarm"), bevel=0.03)
    245:     # front and rear shells with channels down the sides that show the core
    246:     cuff = loft([(12.5, octo(.85, .95, .22, x=2.53)), (13.6, octo(1.1, 1.13, .28, x=2.54))])
    247:     cuff_b = copy(cuff)
    248:     pair("upperarm_front", clip(cuff, y=(-1, -.08)), "main", *lr(J, "upperarm"), bevel=0.03)
    249:     pair("upperarm_rear", clip(cuff_b, y=(.08, 1)), "main", *lr(J, "upperarm"), bevel=0.03)
    250:     pair("upperarm_band", loft([(13.62, octo(1.16, 1.18, .28, x=2.54)), (13.84, octo(1.16, 1.18, .28, x=2.54))]), "accent",
    251:          *lr(J, "upperarm"), bevel=0.02)
    252:     pair("elbow", cylinder(.48, 2.0, 3.0, 12, axis="x", at=(0, 11.95)), "joint", *lr(J, "upperarm"), smooth=True)
    253:     # a longer forearm, its armour split down its length into outer and inner halves over a dark core
    254:     pair("forearm_core", loft([(9.62, octo(.6, .7, .15, x=2.5)), (11.95, octo(.8, .9, .2, x=2.5))]), "frame",
    255:          *lr(J, "forearm"), bevel=0.02)
    256:     arm_side = [(-.45, 9.65), (.45, 9.65), (.65, 11.4), (.55, 12.1), (-.55, 12.1), (-.65, 11.4)]
    257:     out = two_view([(2.56, 11.86), (2.91, 12.08), (3.22, 11.43), (3.03, 10.45), (2.80, 9.68), (2.56, 9.78)], arm_side,
    258:                    top=[(2.5, -.7), (3.0, -.7), (3.26, 0), (3.0, .7), (2.5, .7)])
    259:     pair_pieces("forearm_out", seam(out, (2.56, 11.45), (3.18, 11.22)), "main", *lr(J, "forearm"), bevel=0.03)
    260:     pair("elbow_actuator", piston((2.5, .62, 12.35), (2.5, .56, 11.55), r=.09), "joint", *lr(J, "forearm"), smooth=True)
    261:     pair("forearm_in", two_view([(2.125, 9.65), (2.44, 9.65), (2.44, 12.0), (2.0, 12.0), (1.95, 11.4)], arm_side),
    262:          "main", *lr(J, "forearm"), bevel=0.04)
    263:     pair("forearm_plate", two_view([(2.98, 10.3), (3.12, 10.3), (3.26, 11.3), (3.12, 11.3)],
    264:                                    [(-.5, 10.25), (.5, 10.25), (.6, 11.35), (-.6, 11.35)]), "accent", *lr(J, "forearm"), bevel=0.02)
    265:     pair("elbow_guard", two_view([(2.1, 11.5), (3.0, 11.5), (3.0, 12.2), (2.55, 12.45), (2.1, 12.2)],
    266:                                  [(.45, 11.45), (.8, 11.55), (1.0, 11.95), (.8, 12.35), (.45, 12.4)]), "main",
    267:          *lr(J, "forearm"), bevel=0.03)
    268:     pair("wrist_guard", loft([(9.6, octo(.98, 1.04, .22, x=2.52)), (9.8, octo(1.02, 1.08, .24, x=2.52))]), "accent",
    269:          *lr(J, "forearm"), bevel=0.02)
    270:     pair("wrist", cylinder(.28, 9.4, 9.75, 10, at=(2.5, 0)), "joint", *lr(J, "hand"), smooth=True)
    271:     pair("palm", loft([(8.9, octo(.5, .82, .1, x=2.52)), (9.5, octo(.46, .8, .1, x=2.52))]), "frame", *lr(J, "hand"), bevel=0.02)
    272:     pair("fingers", loft([(8.75, octo(.42, .82, .13, x=2.27)), (9.35, octo(.44, .82, .13, x=2.27))]), "frame",
    273:          *lr(J, "hand"), bevel=0.025)
    274:     pair("thumb", loft([(9.02, octo(.24, .24, .06, x=2.32, y=-.5)), (9.4, octo(.26, .26, .06, x=2.38, y=-.46))]), "frame",
    275:          *lr(J, "hand"), bevel=0.02)
    276:     pair("hand_guard", two_view([(2.72, 9.0), (2.86, 9.05), (2.86, 9.55), (2.72, 9.55)],
    277:                                 [(-.4, 9.0), (.4, 9.0), (.42, 9.55), (-.42, 9.55)]), "main", *lr(J, "hand"), bevel=0.015)
    278: 
    279: 
    280: def build_legs(J):
    281:     pair("hip_ball", cylinder(.5, .55, 1.6, 12, axis="x", at=(0, 10.55)), "joint", *lr(J, "thigh"), smooth=True)
    282:     pair("thigh_core", loft([(6.7, octo(.8, .95, .22, x=1.2)), (9.0, octo(1.3, 1.45, .34, x=1.18)),
    283:                              (10.25, octo(1.15, 1.3, .3, x=1.15))]), "frame", *lr(J, "thigh"), bevel=BEVEL)
    284:     # thigh shells taper to the knee, with dark channels between them
    285:     tf = two_view([(.72, 9.95), (1.62, 9.95), (1.95, 9.32), (1.72, 8.58), (1.53, 7.36), (.91, 7.36), (.63, 8.40), (.49, 9.24)],
    286:                   [(-.96, 7.3), (-.55, 7.3), (-.55, 9.95), (-.86, 9.95), (-1.02, 8.6)],
    287:                   top=[(.4, -.5), (2.0, -.5), (2.0, -.8), (1.22, -1.12), (.4, -.8)])
    288:     pair_pieces("thigh_front", seam(tf, (.64, 8.72), (1.79, 8.94)), "main", *lr(J, "thigh"), bevel=0.04)
    289:     pair("thigh_panel", two_view([(1.0, 7.72), (1.36, 7.72), (1.4, 7.8), (1.4, 8.3), (1.34, 8.37), (1.02, 8.37), (.96, 8.3), (.96, 7.8)],
    290:                                  [(-1.04, 7.65), (-.94, 7.65), (-.94, 8.42), (-1.0, 8.42)]), "frame", *lr(J, "thigh"), bevel=0.01)
    291:     pair("thigh_outer", two_view([(1.66, 7.45), (1.8, 7.5), (2.12, 9.3), (1.96, 9.75)],
    292:                                  [(-.42, 7.45), (.5, 7.45), (.62, 9.6), (-.5, 9.6)]), "main", *lr(J, "thigh"), bevel=0.03)
    293:     pair("thigh_rear", two_view([(.82, 7.45), (1.58, 7.45), (1.86, 9.4), (.56, 9.4)],
    294:                                 [(.36, 7.45), (.55, 7.45), (.84, 9.4), (.62, 9.4)]), "main", *lr(J, "thigh"), bevel=0.03)
    295: 
    296:     pair("knee_joint", cylinder(.5, .65, 1.75, 12, axis="x", at=(0, 6.1)), "joint", *lr(J, "shin"), smooth=True)
    297:     pair("knee_disc", cylinder(.48, 1.78, 1.98, 16, axis="x", at=(.1, 6.15)), "accent", *lr(J, "shin"), smooth=True)
    298:     pair("knee_lens", cylinder(.3, 1.98, 2.04, 16, axis="x", at=(.1, 6.15)), "sensor", *lr(J, "shin"), smooth=True)
    299:     pair("kneecap", two_view([(.75, 5.85), (1.65, 5.85), (1.72, 6.5), (1.2, 6.95), (.68, 6.5)],
    300:                              [(-1.15, 5.85), (-.6, 5.85), (-.55, 6.7), (-.82, 6.95), (-1.15, 6.3)],
    301:                              top=[(.6, -.4), (1.8, -.4), (1.8, -.85), (1.2, -1.2), (.6, -.85)]), "main",
    302:          *lr(J, "shin"), bevel=0.04)
    303:     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",
    304:          *lr(J, "shin"), bevel=0.03)
    305:     # one envelope (narrow ankle, calf bulge high and back) cut into front, outer, inner and rear shells
    306:     env = loft([(1.85, octo(1.1, 1.3, .3, x=1.2, y=.05)), (3.0, octo(1.35, 1.6, .38, x=1.2, y=.15)),
    307:                 (4.3, octo(1.65, 2.0, .45, x=1.2, y=.3)), (5.6, octo(1.2, 1.45, .32, x=1.2, y=.05))])
    308:     parts = {"shin_front": dict(y=(-2, -.2)), "shin_outer": dict(x=(1.5, 3), y=(-.08, .62)),
    309:              "shin_inner": dict(x=(-1, .9), y=(-.08, .62)), "shin_rear": dict(y=(.74, 3))}
    310:     for name, box in parts.items():
    311:         pair(name, clip(copy(env), **box), "main", *lr(J, "shin"), bevel=0.03)
    312:     env.free()
    313:     sp = two_view([(.80, 5.42), (1.49, 5.42), (1.70, 4.55), (1.57, 3.40), (1.43, 2.08), (.96, 2.08), (.77, 3.45), (.65, 4.52)],
    314:                   [(-.8, 2.05), (-.62, 2.05), (-.68, 5.44), (-.86, 5.44), (-.92, 4.3)],
    315:                   top=[(.6, -.5), (1.75, -.5), (1.75, -.66), (1.17, -.98), (.6, -.66)])
    316:     pair_pieces("shin_plate", seam(sp, (.75, 3.60), (1.59, 3.25), gap=.06), "main", *lr(J, "shin"), bevel=0.03)
    317:     for k, x in (("i", .86), ("o", 1.54)):
    318:         pair(f"knee_rail_{k}", loft([(6.45, octo(.18, .25, .04, x=x, y=.18)), (7.4, octo(.18, .25, .04, x=x, y=.18))]), "frame",
    319:              *lr(J, "shin"), bevel=0.015)
    320:     pair("knee_actuator", piston((1.2, .62, 7.25), (1.2, .74, 5.55), r=.1), "joint", *lr(J, "shin"), smooth=True)
    321:     pair("calf_blister", two_view([(.78, 4.25), (1.62, 4.25), (1.62, 5.05), (.78, 5.05)],
    322:                                   [(.85, 4.3), (1.58, 4.55), (1.5, 5.05), (.85, 5.05)]), "main", *lr(J, "shin"), bevel=0.04)
    323:     pair("achilles", piston((1.2, .72, 2.4), (1.2, .86, 1.75), r=.07), "joint", *lr(J, "shin"), smooth=True)
    324:     pair("shin_side", two_view([(1.9, 2.8), (2.02, 2.85), (2.1, 4.4), (1.98, 4.45)],
    325:                                [(-.3, 2.8), (.6, 2.8), (.75, 4.4), (-.2, 4.4)]), "accent", *lr(J, "shin"), bevel=0.02)
    326:     pair("calf_vent", slats(.95, 1.45, 2.4, 3.1, 1.0, 3, depth=.08), "frame", *lr(J, "shin"))
    327:     nozzle_pair("calf", (1.2, 1.38, 4.4), (0, .5, -.85), .3, .5, *lr(J, "shin"), housing=False)
    328: 
    329: 
    330:     pair("ankle", cylinder(.42, .75, 1.65, 12, axis="x", at=(.1, 1.55)), "joint", *lr(J, "foot"), smooth=True)
    331:     foot_plan = [(.95, -2.3), (1.45, -2.3), (1.7, -2.05), (1.85, -1.0), (1.80, 1.2), (.60, 1.2), (.55, -1.0), (.7, -2.05)]
    332:     # the spat: a ridged guard over the front of the ankle, riding on the foot
    333:     pair("ankle_spat", two_view([(.62, 1.05), (1.78, 1.05), (1.7, 2.02), (1.2, 2.24), (.7, 2.02)],
    334:                                 [(-.98, 1.05), (-.5, 1.05), (-.45, 2.0), (-.7, 2.24), (-1.02, 1.6)],
    335:                                 top=[(.5, -.3), (1.9, -.3), (1.9, -.8), (1.2, -1.06), (.5, -.8)]), "main", *lr(J, "foot"), bevel=.03)
    336:     pair("instep", two_view([(.55, .15), (1.85, .15), (1.8, .9), (1.5, 1.12), (.9, 1.12), (.6, .9)],
    337:                             [(-.9, .15), (.9, .15), (.85, 1.0), (.2, 1.2), (-.85, 1.1)], top=foot_plan), "main", *lr(J, "foot"), bevel=.03)
    338:     pair("toe_base", two_view([(.58, .12), (1.82, .12), (1.78, .78), (.62, .78)],
    339:                               [(-1.55, .12), (-.98, .12), (-.95, 1.0), (-1.5, .86)], top=foot_plan), "main", *lr(J, "foot"), bevel=.03)
    340:     pair("toe", two_view([(.58, .1), (1.82, .1), (1.78, .74), (.62, .74)],
    341:                          [(-2.3, .1), (-1.62, .1), (-1.6, .84), (-2.0, .7), (-2.3, .3)], top=foot_plan), "trim", *lr(J, "foot"), bevel=.04)
    342:     pair("heel", two_view([(.62, .1), (1.8, .1), (1.76, .98), (.66, .98)],
    343:                           [(.86, .1), (1.62, .1), (1.66, .5), (1.36, .98), (.86, 1.08)]), "trim", *lr(J, "foot"), bevel=.04)
    344:     pair("ankle_guard", two_view([(1.8, .35), (1.96, .4), (1.96, 1.2), (1.8, 1.26)],
    345:                                  [(-.62, .35), (.72, .35), (.62, 1.2), (-.5, 1.2)]), "accent", *lr(J, "foot"), bevel=.02)
    346:     for k, (y0, y1) in (("front", (-2.15, -.95)), ("back", (-.85, 1.1))):
    347:         pad = [(x, min(max(y, y0), y1)) for x, y in [(.84, -2.15), (1.56, -2.15), (1.84, -1.0), (1.7, 1.08), (.7, 1.08), (.56, -1.0)]]
    348:         pair(f"sole_{k}", prism(pad, 0.0, 0.14, "xy"), "joint", *lr(J, "foot"), bevel=.02)
    349: 
    350: 
    351: def build_backpack(J):
    352:     B = J["backpack"]
    353:     solid("back_mount", loft([(1.2, octo(1.8, 2.2, .4, y=13.8)), (1.95, octo(1.7, 2.1, .4, y=13.8))], axis="y"), "frame", B, BEVEL)
    354:     solid("reactor", loft([(1.9, circle(.85, 12, 0, 13.9)), (2.85, circle(.5, 12, 0, 13.9))], axis="y"), "main", B, smooth=True)
    355:     solid("reactor_ring", loft([(2.0, circle(.95, 12, 0, 13.9)), (2.2, circle(.95, 12, 0, 13.9))], axis="y"), "accent", B,
    356:           smooth=True)
    357:     solid("reactor_tip", loft([(2.82, circle(.54, 12, 0, 13.9)), (3.0, circle(.46, 12, 0, 13.9))], axis="y"), "frame", B,
    358:           smooth=True)
    359:     solid("reactor_glow", loft([(2.92, circle(.22, 12, 0, 13.9)), (2.95, circle(.22, 12, 0, 13.9))], axis="y"), "glow_core", B)
    360:     for s, sx in (("L", 1), ("R", -1)):
    361:         m = Matrix.Translation((.9 * sx, 2.25, 14.7)) @ rot("Y", 32 * sx) @ rot("X", -28)
    362:         pivot = Vector((.9 * sx, 2.25, 14.7))
    363:         solid(f"binder_hinge.{s}", cylinder(.225, pivot.x - .25, pivot.x + .25, 12, axis="x", at=(pivot.y, pivot.z)), "joint",
    364:               J["binder", s], smooth=True)
    365:         for k, dy in (("a", -.2), ("b", .2)):
    366:             solid(f"binder_fork{k}.{s}", two_view([(pivot.x - .28, 14.35), (pivot.x + .28, 14.35), (pivot.x + .28, 14.95), (pivot.x - .28, 14.95)],
    367:                                                  [(2.0 + dy - .06, 14.35), (2.0 + dy + .06, 14.35), (2.25 + dy + .06, 14.95), (2.25 + dy - .06, 14.95)]),
    368:                   "frame", B, bevel=0.015)
    369:         # a dark spar between two thin blades
    370:         spar = loft([(-.7, octo(.22, .3, .06)), (2.3, octo(.16, .24, .04))])
    371:         solid(f"binder_spar.{s}", transform(spar, m), "frame", J["binder", s], bevel=0.015)
    372:         for k, bx in (("a", .12), ("b", -.12)):
    373:             blade = prism([(-.38, -.6), (.36, -.5), (.24, 2.1), (-.16, 2.25)], bx - .06, bx + .06, "yz")
    374:             solid(f"binder_blade{k}.{s}", transform(blade, m), "main", J["binder", s], bevel=0.02)
    375:         tip = loft([(1.9, octo(.32, .44, .08)), (2.6, octo(.2, .3, .05))])
    376:         solid(f"binder_tip.{s}", transform(tip, m), "accent", J["binder", s], bevel=0.015)
    377:         bell, glow = nozzle(.3, .55)
    378:         down = m.to_3x3() @ Vector((0, 0, -1))
    379:         at = m @ Vector((0, 0, -.7))
    380:         solid(f"binder_nozzle.{s}", place(bell, at, down), "frame", J["binder", s], smooth=True)
    381:         solid(f"binder_nozzle.{s}.glow", place(glow, at, down), "glow_thruster", J["binder", s])
    382:         empty(f"nozzle.binder.{s}", at + down * .55, J["binder", s], dir=gltf_dir(down), radius=.3)
    383:         hilt = transform(cylinder(.14, 0, 1.15, 8), Matrix.Translation((.62 * sx, 2.05, 14.85)) @ rot("X", -30))
    384:         solid(f"saber_hilt.{s}", hilt, "frame", B, smooth=True)
    385:         cap = transform(cylinder(.17, 1.0, 1.2, 8), Matrix.Translation((.62 * sx, 2.05, 14.85)) @ rot("X", -30))
    386:         solid(f"saber_cap.{s}", cap, "trim", B, smooth=True)
    387:     nozzle_pair("main", (.55, 2.05, 12.65), (0, .45, -.9), .42, .8, B, B)
    388: 
    389: 
    390: def build_striker():
    391:     J = joints()
    392:     build_pelvis(J)
    393:     build_waist(J)
    394:     build_torso(J)
    395:     build_head(J)
    396:     J["neck"].location.z -= .24  # the head sits down between the collar plates
    397:     build_arms(J)
    398:     build_legs(J)
    399:     build_backpack(J)

    1 more lines not shown.

  • read_file{"Path":"~/work/sortie/kit/block.py"}

    input

    {
      "Path": "~/work/sortie/kit/block.py"
    }

    result, 113 lines

    Showing lines 1-112 of 112
    1: """Block models: plain boxes on the 22 joint rig, for judging mass and motion before any plate exists.
    2: 
    3: A block model is one file, kit/blocks/<name>.py, with a build() that takes this module's Blocks class.
    4: It builds in seconds, into a gitignored public/assets/block_<name>.glb:
    5: 
    6:     npm run kit -- block_dummy
    7:     npm run clip -- block_dummy
    8: 
    9: Geometry is authored in world rest pose coordinates in metres, models facing -Y, Z up, left is +X, as
    10: in the rest of the kit. Roles are the usual ones (main, accent, frame, joint). Nothing here is a design
    11: rule: no maker, frame or grade carries over unless a block file asks for it.
    12: """
    13: import importlib
    14: 
    15: import bpy
    16: from mathutils import Vector
    17: 
    18: from lib import loft, merge, mirror_x, octo, solid
    19: from mech import joints as striker_joints, nozzle_pair, pair
    20: 
    21: SIDED = {"shoulder", "upperarm", "forearm", "hand", "grip", "thigh", "shin", "foot", "binder"}
    22: BEVEL = .03
    23: 
    24: 
    25: class Blocks:
    26:     """The rig plus block primitives. `joints` overrides rest positions: {"thigh": (1.1, 0, 9.5)} moves
    27:     both thighs (give the left, +X, the right mirrors), {"pelvis": (0, 0, 9.8)} moves one node. Other
    28:     joints stay where the striker has them, in world coordinates, so moving one moves nothing else."""
    29: 
    30:     def __init__(self, joints=None, height=17.6):
    31:         J = striker_joints()
    32:         self.nodes = {o.name: o for o in J.values()}
    33:         self.n = 0
    34:         J["frame"]["frame"] = "block"
    35:         J["frame"]["height"] = height
    36:         place = {name: o.matrix_world.translation.copy() for name, o in self.nodes.items()}
    37:         for key, at in (joints or {}).items():
    38:             if key in SIDED:
    39:                 place[f"{key}.L"] = Vector(at)
    40:                 place[f"{key}.R"] = Vector((-at[0], at[1], at[2]))
    41:             elif key in place:
    42:                 place[key] = Vector(at)
    43:             else:
    44:                 raise KeyError(f"block: no joint {key}")
    45:         for name, o in self.nodes.items():  # striker_joints() makes parents first
    46:             if o.parent is not None:
    47:                 o.location = o.parent.matrix_world.inverted() @ place[name]
    48:             bpy.context.view_layer.update()
    49: 
    50:     def at(self, name):
    51:         return self.nodes[name].matrix_world.translation.copy()
    52: 
    53:     def _put(self, joint, bm, role, mirror):
    54:         self.n += 1
    55:         name = f"block{self.n}_{joint}"
    56:         if joint in SIDED:
    57:             pair(name, bm, role, self.nodes[f"{joint}.L"], self.nodes[f"{joint}.R"], bevel=BEVEL, panels=False)
    58:         elif mirror:
    59:             solid(name, merge(bm, mirror_x(bm)), role, self.nodes[joint], bevel=BEVEL, panels=False)
    60:         else:
    61:             solid(name, bm, role, self.nodes[joint], bevel=BEVEL, panels=False)
    62: 
    63:     def box(self, joint, x, y, z, role="main", mirror=False):
    64:         """A box from x, y, z ranges (lo, hi). A sided joint (thigh, shin, ...) takes the left's numbers
    65:         and mirrors to the right. `mirror` does the same for a box on a centre joint."""
    66:         r = [(x[0], y[0]), (x[1], y[0]), (x[1], y[1]), (x[0], y[1])]
    67:         self._put(joint, loft([(z[0], r), (z[1], r)]), role, mirror)
    68: 
    69:     def taper(self, joint, rings, role="main", mirror=False, chamfer=.15):
    70:         """A lofted block through rings (z, width, depth, x, y), bottom to top."""
    71:         self._put(joint, loft([(z, octo(w, d, chamfer, x=x, y=y)) for z, w, d, x, y in rings]), role, mirror)
    72: 
    73:     def bone(self, joint, a, b, w, d, role="main", chamfer=.1):
    74:         """A block from joint a to joint b, both named for the left side: bone("thigh", "thigh.L", "shin.L", 1, 1)."""
    75:         pa, pb = self.at(a), self.at(b)
    76:         lo, hi = (pa, pb) if pa.z < pb.z else (pb, pa)
    77:         self.taper(joint, [(lo.z, w, d, lo.x, lo.y), (hi.z, w, d, hi.x, hi.y)], role, chamfer=chamfer)
    78: 
    79:     def nozzles(self, joint, at, direction, r=.45, length=.9, kind="main"):
    80:         """A nozzle pair that fires plumes in the game. `kind`: main, binder or calf."""
    81:         if joint in SIDED:
    82:             jl, jr = self.nodes[f"{joint}.L"], self.nodes[f"{joint}.R"]
    83:         else:
    84:             jl = jr = self.nodes[joint]
    85:         nozzle_pair(kind, at, direction, r, length, jl, jr, housing=False)
    86: 
    87:     def mannequin(self):
    88:         """A neutral box on every bone, sized from the joints alone. For testing tools, not a design."""
    89:         for joint, a, b, w, d in (("thigh", "thigh.L", "shin.L", 1.0, 1.0), ("shin", "shin.L", "foot.L", 1.0, 1.0),
    90:                                   ("upperarm", "upperarm.L", "forearm.L", .7, .7), ("forearm", "forearm.L", "hand.L", .7, .7)):
    91:             self.bone(joint, a, b, w, d)
    92:         foot = self.at("foot.L")
    93:         self.box("foot", (foot.x - .5, foot.x + .5), (foot.y - 1.2, foot.y + .6), (0, foot.z))
    94:         hand = self.at("hand.L")
    95:         self.box("hand", (hand.x - .3, hand.x + .3), (hand.y - .3, hand.y + .3), (hand.z - .8, hand.z))
    96:         pelvis, torso, neck, head = self.at("pelvis"), self.at("torso"), self.at("neck"), self.at("head")
    97:         self.box("pelvis", (-1.3, 1.3), (-.8, .8), (pelvis.z - .8, pelvis.z + .4))
    98:         self.box("waist", (-.8, .8), (-.6, .6), (pelvis.z + .4, torso.z))
    99:         shoulder = self.at("shoulder.L")
    100:         self.box("torso", (-shoulder.x, shoulder.x), (-1, 1), (torso.z, neck.z))
    101:         self.box("shoulder", (shoulder.x, shoulder.x + .9), (-.6, .6), (shoulder.z - .6, shoulder.z + .4))
    102:         self.box("neck", (-.3, .3), (-.3, .3), (neck.z, head.z))
    103:         self.box("head", (-.5, .5), (-.6, .6), (head.z, head.z + 1.1))
    104:         pack = self.at("backpack")
    105:         self.box("backpack", (-.9, .9), (pack.y - .5, pack.y + .5), (pack.z - 1, pack.z + 1))
    106: 
    107: 
    108: def build_block(name):
    109:     """block_<name> from kit/blocks/<name>.py."""
    110:     module = importlib.import_module(f"blocks.{name.removeprefix('block_')}")
    111:     importlib.reload(module)
    112:     module.build(Blocks)
  • read_file{"Path":"~/work/sortie/kit/blocks/dummy.py"}

    input

    {
      "Path": "~/work/sortie/kit/blocks/dummy.py"
    }

    result, 10 lines

    Showing lines 1-9 of 9
    1: """Test fixture for the block tools: an automatic box on every bone, sized from the default joints.
    2: Not a design. Delete nothing here, copy it to start a real block file."""
    3: 
    4: 
    5: def build(Blocks):
    6:     b = Blocks()
    7:     b.mannequin()
    8:     pack = b.at("backpack")
    9:     b.nozzles("backpack", (.5, pack.y + .4, pack.z - .9), (0, .45, -.9))
  • read_file{"Path":"~/work/sortie/tools/fixtures/outlines-test.json"}

    input

    {
      "Path": "~/work/sortie/tools/fixtures/outlines-test.json"
    }

    result, 376 lines

    Showing lines 1-374 of 374
    1: {
    2:  "title": "Outline sheet test fixture: plain posts, not a design",
    3:  "outlines": [
    4:   {
    5:    "parts": [
    6:     {
    7:      "pts": [
    8:       [
    9:        0,
    10:        0
    11:       ],
    12:       [
    13:        1.0,
    14:        0
    15:       ],
    16:       [
    17:        1.0,
    18:        10
    19:       ],
    20:       [
    21:        0,
    22:        10
    23:       ]
    24:      ],
    25:      "mirror": true
    26:     }
    27:    ],
    28:    "note": "test post"
    29:   },
    30:   {
    31:    "parts": [
    32:     {
    33:      "pts": [
    34:       [
    35:        0,
    36:        0
    37:       ],
    38:       [
    39:        1.3,
    40:        0
    41:       ],
    42:       [
    43:        1.3,
    44:        11
    45:       ],
    46:       [
    47:        0,
    48:        11
    49:       ]
    50:      ],
    51:      "mirror": true
    52:     },
    53:     {
    54:      "circle": [
    55:       0,
    56:       12.2,
    57:       1.2
    58:      ]
    59:     }
    60:    ],
    61:    "note": "test post"
    62:   },
    63:   {
    64:    "parts": [
    65:     {
    66:      "pts": [
    67:       [
    68:        0,
    69:        0
    70:       ],
    71:       [
    72:        1.6,
    73:        0
    74:       ],
    75:       [
    76:        1.6,
    77:        12
    78:       ],
    79:       [
    80:        0,
    81:        12
    82:       ]
    83:      ],
    84:      "mirror": true
    85:     }
    86:    ],
    87:    "note": "test post"
    88:   },
    89:   {
    90:    "parts": [
    91:     {
    92:      "pts": [
    93:       [
    94:        0,
    95:        0
    96:       ],
    97:       [
    98:        1.9,
    99:        0
    100:       ],
    101:       [
    102:        1.9,
    103:        13
    104:       ],
    105:       [
    106:        0,
    107:        13
    108:       ]
    109:      ],
    110:      "mirror": true
    111:     },
    112:     {
    113:      "circle": [
    114:       0,
    115:       14.2,
    116:       1.2
    117:      ]
    118:     }
    119:    ],
    120:    "note": "test post"
    121:   },
    122:   {
    123:    "parts": [
    124:     {
    125:      "pts": [
    126:       [
    127:        0,
    128:        0
    129:       ],
    130:       [
    131:        2.2,
    132:        0
    133:       ],
    134:       [
    135:        2.2,
    136:        14
    137:       ],
    138:       [
    139:        0,
    140:        14
    141:       ]
    142:      ],
    143:      "mirror": true
    144:     }
    145:    ],
    146:    "note": "test post"
    147:   },
    148:   {
    149:    "parts": [
    150:     {
    151:      "pts": [
    152:       [
    153:        0,
    154:        0
    155:       ],
    156:       [
    157:        2.5,
    158:        0
    159:       ],
    160:       [
    161:        2.5,
    162:        15
    163:       ],
    164:       [
    165:        0,
    166:        15
    167:       ]
    168:      ],
    169:      "mirror": true
    170:     },
    171:     {
    172:      "circle": [
    173:       0,
    174:       16.2,
    175:       1.2
    176:      ]
    177:     }
    178:    ],
    179:    "note": "test post"
    180:   },
    181:   {
    182:    "parts": [
    183:     {
    184:      "pts": [
    185:       [
    186:        0,
    187:        0
    188:       ],
    189:       [
    190:        2.8,
    191:        0
    192:       ],
    193:       [
    194:        2.8,
    195:        16
    196:       ],
    197:       [
    198:        0,
    199:        16
    200:       ]
    201:      ],
    202:      "mirror": true
    203:     }
    204:    ],
    205:    "note": "test post"
    206:   },
    207:   {
    208:    "parts": [
    209:     {
    210:      "pts": [
    211:       [
    212:        0,
    213:        0
    214:       ],
    215:       [
    216:        3.1,
    217:        0
    218:       ],
    219:       [
    220:        3.1,
    221:        17
    222:       ],
    223:       [
    224:        0,
    225:        17
    226:       ]
    227:      ],
    228:      "mirror": true
    229:     },
    230:     {
    231:      "circle": [
    232:       0,
    233:       18.2,
    234:       1.2
    235:      ]
    236:     }
    237:    ],
    238:    "note": "test post"
    239:   },
    240:   {
    241:    "parts": [
    242:     {
    243:      "pts": [
    244:       [
    245:        0,
    246:        0
    247:       ],
    248:       [
    249:        3.4,
    250:        0
    251:       ],
    252:       [
    253:        3.4,
    254:        18
    255:       ],
    256:       [
    257:        0,
    258:        18
    259:       ]
    260:      ],
    261:      "mirror": true
    262:     }
    263:    ],
    264:    "note": "test post"
    265:   },
    266:   {
    267:    "parts": [
    268:     {
    269:      "pts": [
    270:       [
    271:        0,
    272:        0
    273:       ],
    274:       [
    275:        3.6999999999999997,
    276:        0
    277:       ],
    278:       [
    279:        3.6999999999999997,
    280:        19
    281:       ],
    282:       [
    283:        0,
    284:        19
    285:       ]
    286:      ],
    287:      "mirror": true
    288:     },
    289:     {
    290:      "circle": [
    291:       0,
    292:       20.2,
    293:       1.2
    294:      ]
    295:     }
    296:    ],
    297:    "note": "test post"
    298:   },
    299:   {
    300:    "parts": [
    301:     {
    302:      "pts": [
    303:       [
    304:        0,
    305:        0
    306:       ],
    307:       [
    308:        4.0,
    309:        0
    310:       ],
    311:       [
    312:        4.0,
    313:        20
    314:       ],
    315:       [
    316:        0,
    317:        20
    318:       ]
    319:      ],
    320:      "mirror": true
    321:     }
    322:    ],
    323:    "note": "test post"
    324:   },
    325:   {
    326:    "parts": [
    327:     {
    328:      "pts": [
    329:       [
    330:        0,
    331:        0
    332:       ],
    333:       [
    334:        2,
    335:        0
    336:       ],
    337:       [
    338:        2,
    339:        14
    340:       ],
    341:       [
    342:        0,
    343:        14
    344:       ]
    345:      ],
    346:      "mirror": true
    347:     }
    348:    ],
    349:    "side": [
    350:     {
    351:      "pts": [
    352:       [
    353:        -1,
    354:        0
    355:       ],
    356:       [
    357:        1,
    358:        0
    359:       ],
    360:       [
    361:        1,
    362:        14
    363:       ],
    364:       [
    365:        -1,
    366:        14
    367:       ]
    368:      ]
    369:     }
    370:    ],
    371:    "note": "with side"
    372:   }
    373:  ]
    374: }
    (no newline at end of file)