agent

+13:11
reasoning

Initial hypothesis: visual artifact caused by an external factor. However, examination of the image thruster_heavy_C.png reveals a specific configuration of thrusters and plumes. This suggests a direct causal link between the heavy_C pose in POSES.flight and the observed visual effect during the thruster firing.

The visual artifact's source is now linked to a specific thruster configuration within the pose data. The earlier issue with the oversized bounding box of light_lancer.png warrants investigation. The Box3().setFromObject(root) call in the viewer suggests the origin or mesh positioning in light_lancer.glb might be the cause, potentially due to the build_light("lancer") function's handling of the model's structure within the Blender context. A step-by-step debug will be needed.

The trajectory data requires careful comparison with the rendered output and codebase to confirm the observed visual effects. The simulation, thruster implementation, and rigid body hierarchy are functioning effectively, creating a realistic flight experience with shared skeletons. The geometry idioms in kit/ also warrant close examination.

Section 2)

  1. What is not working (and needs work):
    • The 6-DoF flight simulation, thruster bench, and raymarched plume shader, when the heavy mech is in the flight pose: When heavy_C is running, the artifacts appear. But when we swap to light_lancer, it does not. This points to an interaction specific to the "heavy" rig, or a shader parameter, or mesh data.
    • The 22-joint rigid hierarchy in terms of how heavy and light are related, but also how the heavy_C pose is defined relative to the root: If the root is in the wrong place, it could be mis-calculating the matrix transforms.
    • The Box3 bounding box from the glb file: specifically how it is used to center light_lancer: It could be that the problem is not a "bug" but a consequence of the mech's size relative to the scene. The "centering" logic might be a kludge.
    • The procedural decal/eye/palette pipeline when it is applied to one particular mech relative to a particular pose: The problem, at least in the visual, seems specific to the flight pose.

It appears the problem is specific to the "heavy" mech's flight pose, particularly heavy_C. The rigid hierarchy and the bounding box usage are areas for targeted investigation, as they could impact the visual outcome. Also, the decal pipeline could be involved.

The "heavy" mech's visual characteristics are shaped by hard-surface mecha armor elements due to the use of subdivision and paneling techniques, creating compound curvatures and physical gaps. This distinct design choice appears in the heavy_C pose. The three geometry engines in the kit are conflicting. The makers/shell.py approach might be too flat.

The visual issues stem from how geometry is generated and rendered, specifically within the "heavy" mech's context. The knightkit.Sheet's uniform smoothing introduces an undesirable "bloated" appearance to the armor. Additionally, a previously-held dogma for exposed inner frames creates visual artifacts at joints, observed across several image samples.

The "heavy" mech's visual flaws are due to exposed, untextured internal frame elements which contradict the exterior armor. The rendering pipeline, particularly the default look and viewer configurations, exacerbate these issues by desaturating colors, reducing specular highlights, and applying a grime effect that hides detail. The viewer's conditional logic further hinders model presentation.

The viewer.ts's CPU-intensive rendering loop (post-processing every frame) is likely interfering with Playwright's capture operations, specifically the page.screenshot calls, causing a "headless capture bug". The current approach in viewer.ts consumes too many resources. This might also be why the startup image is black or blank. The suggested starting points in the reflection page (2D silhouettes and box mannequins) are not adequate tests for the compound curvature issues.

The visual flaws originate from the abandonment of earlier, more effective procedural primitives, specifically the shift away from subdivided cages with sharp edge angles and overlapping joint shrouds in favor of 2D boolean slabs and unweighted smooth normals. This shift directly impacts the "heavy" mech's appearance. The existing models (heavy_C, light_lancer, Estoc/Harness) are capable of demonstrating the desired visual style.

The focus should be on preserving the existing flight simulation, procedural elements, and subdivision techniques. The knightkit.Sheet needs adjustments for sharp edge normals to correct the undesirable "bloated" appearance. The 2D silhouette tools are not useful for evaluating the 3D surface issues. The kit elements can generate the right visuals, but are presently poorly used.

The current visual shortcomings stem from the rendering pipeline's default settings and the geometry generation process. Modifying the review look to a cleaner aesthetic and re-enabling posing/decals will improve clarity. The "field" look currently masks the true nature of the mecha. Also, the 2D slab workflow creates undesirable flat armor.

The rendering pipeline's default look and viewer configurations must be adjusted, specifically removing the desaturation, grime effect, and reduced highlights, to address the "field" look that currently obscures visual details. The geometry generation process requires refinement; specifically, the 2D slab workflow must be replaced.

Fixing the infinite requestAnimationFrame loop in the viewer, that stalls headless captures, is necessary. The kit's geometry rules must be enforced with auto-smooth/angle-split normals or creased subdivision for sharp edges and to close inner-frame gaps with overlapping armor elements. Finally, the foot silhouette needs reconstruction.

The goal is to generate a single visual artifact using existing resources, specifically a posed hero mecha. The instructions specify a dynamic pose ("flight" or "guard"), a 1.75m pilot for scale, and live thruster plumes. The process is a tight feedback loop on one frame, then propagation.

Considering a single, high-resolution diagnostic image. This image could be a 2x2 comparison, showcasing the mecha frame before and after applying the fix, or a complete hero mecha rendered in the pipeline. This approach would directly demonstrate the effectiveness of the proposed changes. The goal is to generate a visual artifact, showing the effect of the fix in a single visual. The estoc asset will be the hero frame.

The "atelier_b_houses.png" image reveals several issues, starting with a static, unrigged scene lacking a hero mech pose. The mechs exhibit "puffy pillow" shading, caused by uniform smoothing across sharp edges. The default shader and viewer configurations exacerbate these issues, obscuring the mecha's details. These problems prevent the image from showcasing a single visual effect.

  • read_file{"EndLine":140,"Path":"~/work/sortie/kit/lab/knightkit.py","StartLine":1}

    input

    {
      "EndLine": 140,
      "Path": "~/work/sortie/kit/lab/knightkit.py",
      "StartLine": 1
    }

    result, 141 lines

    Showing lines 1-140 of 535
    1: """Sheets with compound curvature for the atelier direction board (kit/lab/atelier_board.py).
    2: 
    3: Round 1's plates are cones and cylinders of even thickness: shell() intersects two flat outlines, so
    4: it can only make flat and single curved faces. Knightly armour reads through domes, a curved profile
    5: down every plate, raised ridges, flutes and rolled rims. These helpers make them:
    6: 
    7:   Sheet     a plate t thick over a surface f(u, v): the outer face, the inner face set back along the
    8:             normals, closed round its edges. `disp` pushes the outer face out (ridges, flutes).
    9:   revolve   a surface of revolution round a vertical axis, elliptical in plan, through a profile of
    10:             (radius, z) points: the profile curves, so the plate is domed, not a cone
    11:   bead      a tube along a line of points: a rolled rim on a plate's edge, roped with `rope`
    12:   ridge, flutes   displacement profiles across u
    13: 
    14: Angles are degrees in plan, 0 is +X (outboard on the left), -90 the front (-Y), 90 the back.
    15: """
    16: import math
    17: 
    18: import bmesh
    19: from mathutils import Vector
    20: 
    21: 
    22: def lin(a, b, n):
    23:     """n + 1 values from a to b."""
    24:     return [a + (b - a) * i / n for i in range(n + 1)]
    25: 
    26: 
    27: def spline(pts):
    28:     """A Catmull-Rom curve through points (tuples), as a function of t in [0, 1]."""
    29:     P = [Vector(p) for p in pts]
    30:     n = len(P) - 1
    31: 
    32:     def at(t):
    33:         x = min(max(t, 0.0), 1.0) * n
    34:         i = min(int(x), n - 1)
    35:         s = x - i
    36:         p0, p1, p2, p3 = P[max(i - 1, 0)], P[i], P[i + 1], P[min(i + 2, n)]
    37:         return .5 * ((2 * p1) + (-p0 + p2) * s + (2 * p0 - 5 * p1 + 4 * p2 - p3) * s * s + (-p0 + 3 * p1 - 3 * p2 + p3) * s ** 3)
    38:     return at
    39: 
    40: 
    41: class Sheet:
    42:     """A plate t thick over f(u, v) on the grid us x vs. `inside` is a point on the plate's inner side
    43:     (default: the centroid of the surface, right for domes and shells round a body). `disp(u, v)`
    44:     moves the outer face out along the normal. `wrap` closes the sheet round u."""
    45: 
    46:     def __init__(self, f, us, vs, t, disp=None, inside=None, wrap=False):
    47:         self.us, self.vs, self.t, self.wrap = list(us), list(vs), t, wrap
    48:         nu, nv = len(self.us), len(self.vs)
    49:         S = [[Vector(f(u, v)) for v in self.vs] for u in self.us]
    50: 
    51:         def nrm(i, j):
    52:             if wrap:
    53:                 a, b = S[(i + 1) % nu][j], S[(i - 1) % nu][j]
    54:             else:
    55:                 a, b = S[min(i + 1, nu - 1)][j], S[max(i - 1, 0)][j]
    56:             c, d = S[i][min(j + 1, nv - 1)], S[i][max(j - 1, 0)]
    57:             n = (a - b).cross(c - d)
    58:             return n.normalized() if n.length > 1e-9 else None
    59:         N = [[nrm(i, j) for j in range(nv)] for i in range(nu)]
    60:         # a pole (a cap drawn from v = 0) has no normal of its own: it takes the mean of the next row's
    61:         for j in range(nv):
    62:             if any(N[i][j] is None for i in range(nu)):
    63:                 k = j + 1 if j + 1 < nv else j - 1
    64:                 m = sum((n for n in (N[i][k] for i in range(nu)) if n is not None), Vector())
    65:                 m = m.normalized() if m.length > 1e-9 else Vector((0, 0, 1))
    66:                 for i in range(nu):
    67:                     if N[i][j] is None:
    68:                         N[i][j] = m
    69:         c = Vector(inside) if inside is not None else sum((p for row in S for p in row), Vector()) / (nu * nv)
    70:         if sum(N[i][j].dot(S[i][j] - c) for i in range(nu) for j in range(nv)) < 0:
    71:             N = [[-n for n in row] for row in N]
    72:         if disp is not None:
    73:             S = [[S[i][j] + N[i][j] * disp(self.us[i], self.vs[j]) for j in range(nv)] for i in range(nu)]
    74:         self.O, self.N = S, N
    75:         self.I = [[S[i][j] - N[i][j] * t for j in range(nv)] for i in range(nu)]
    76: 
    77:     def bm(self):
    78:         bm = bmesh.new()
    79:         nu, nv = len(self.us), len(self.vs)
    80:         O = [[bm.verts.new(p) for p in row] for row in self.O]
    81:         I = [[bm.verts.new(p) for p in row] for row in self.I]
    82:         iu = range(nu) if self.wrap else range(nu - 1)
    83:         for i in iu:
    84:             k = (i + 1) % nu
    85:             for j in range(nv - 1):
    86:                 bm.faces.new((O[i][j], O[k][j], O[k][j + 1], O[i][j + 1]))
    87:                 bm.faces.new((I[i][j + 1], I[k][j + 1], I[k][j], I[i][j]))
    88:             bm.faces.new((O[i][0], I[i][0], I[k][0], O[k][0]))
    89:             bm.faces.new((O[k][-1], I[k][-1], I[i][-1], O[i][-1]))
    90:         if not self.wrap:
    91:             for j in range(nv - 1):
    92:                 bm.faces.new((O[0][j + 1], I[0][j + 1], I[0][j], O[0][j]))
    93:                 bm.faces.new((O[-1][j], I[-1][j], I[-1][j + 1], O[-1][j + 1]))
    94:         bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=1e-6)  # closes a pole
    95:         bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    96:         return bm
    97: 
    98:     def edge(self, side, at=.5, out=0.0):
    99:         """Points along one edge (u0, u1, v0, v1), `at` of the way through the thickness, pushed `out`
    100:         along the normal."""
    101:         nu, nv = len(self.us), len(self.vs)
    102:         idx = {"u0": [(0, j) for j in range(nv)], "u1": [(nu - 1, j) for j in range(nv)],
    103:                "v0": [(i, 0) for i in range(nu)], "v1": [(i, nv - 1) for i in range(nu)]}[side]
    104:         return [self.O[i][j] - self.N[i][j] * (self.t * at - out) for i, j in idx]
    105: 
    106:     def point(self, i, j, out=0.0):
    107:         return self.O[i][j] + self.N[i][j] * out
    108: 
    109: 
    110: def revolve(c, profile, kx=1.0, ky=1.0, steps=40):
    111:     """f(u, v) for a surface round a vertical axis through c = (x, y): u the plan angle in degrees, v in
    112:     [0, 1] along the profile, a list of (radius, z) points (or a function of v). kx and ky stretch the
    113:     plan into an ellipse. A profile that curves makes the plate domed."""
    114:     prof = profile if callable(profile) else spline(profile)
    115: 
    116:     def f(u, v):
    117:         r, z = prof(v)[:2]
    118:         a = math.radians(u)
    119:         return (c[0] + r * kx * math.cos(a), c[1] + r * ky * math.sin(a), z)
    120:     return f
    121: 
    122: 
    123: def tent(x, x0, w):
    124:     """1 at x0, falling linearly to 0 at x0 +- w: a ridge with a crease on its crest."""
    125:     return max(0.0, 1.0 - abs(x - x0) / w)
    126: 
    127: 
    128: def flutes(x, x0, x1, n, w=.5):
    129:     """n rounded flutes between x0 and x1, each `w` of its pitch wide, 0 between them."""
    130:     if not (x0 <= x <= x1):
    131:         return 0.0
    132:     s = (x - x0) / (x1 - x0) * n
    133:     f = s - math.floor(s)
    134:     d = abs(f - .5) / (w / 2)
    135:     return math.cos(min(d, 1.0) * math.pi / 2) ** 2 if d < 1 else 0.0
    136: 
    137: 
    138: def smooth(x, a, b):
    139:     """0 below a, 1 above b, smooth between."""
    140:     t = min(max((x - a) / (b - a), 0.0), 1.0)
  • read_file{"EndLine":260,"Path":"~/work/sortie/kit/lab/knightkit.py","StartLine":141}

    input

    {
      "EndLine": 260,
      "Path": "~/work/sortie/kit/lab/knightkit.py",
      "StartLine": 141
    }

    result, 121 lines

    Showing lines 141-260 of 535
    141:     return t * t * (3 - 2 * t)
    142: 
    143: 
    144: def bead(pts, r, n=None, rope=0.0, closed=False, pitch=None):
    145:     """A tube of radius r along points: a rolled rim. `rope` (0..1) twists three strands into it, a
    146:     roped rim, one turn every `pitch` metres."""
    147:     n = n or (12 if rope else 10)
    148:     pitch = pitch or r * 9
    149:     step = pitch / 9 if rope else r * 2.5
    150:     P0 = [Vector(p) for p in pts]
    151:     P = []
    152:     for i in range(len(P0) if closed else len(P0) - 1):
    153:         a, b = P0[i], P0[(i + 1) % len(P0)]
    154:         k = max(1, int((b - a).length / step + .999))
    155:         P += [a.lerp(b, j / k) for j in range(k)]
    156:     if not closed:
    157:         P.append(P0[-1])
    158:     m = len(P)
    159:     T = []
    160:     for i in range(m):
    161:         a = P[(i + 1) % m] if closed else P[min(i + 1, m - 1)]
    162:         b = P[(i - 1) % m] if closed else P[max(i - 1, 0)]
    163:         T.append((a - b).normalized())
    164:     up = Vector((0, 0, 1)) if abs(T[0].z) < .9 else Vector((1, 0, 0))
    165:     Nn = [(up - T[0] * up.dot(T[0])).normalized()]
    166:     for i in range(1, m):
    167:         v = Nn[-1] - T[i] * Nn[-1].dot(T[i])
    168:         Nn.append(v.normalized() if v.length > 1e-9 else Nn[-1])
    169:     bm = bmesh.new()
    170:     rings, s = [], 0.0
    171:     for i in range(m):
    172:         if i:
    173:             s += (P[i] - P[i - 1]).length
    174:         B = T[i].cross(Nn[i])
    175:         ring = []
    176:         for k in range(n):
    177:             q = 2 * math.pi * k / n
    178:             rr = r * (1 + rope * .2 * math.cos(3 * q - 2 * math.pi * s / pitch))
    179:             ring.append(bm.verts.new(P[i] + (Nn[i] * math.cos(q) + B * math.sin(q)) * rr))
    180:         rings.append(ring)
    181:     for i in range(m if closed else m - 1):
    182:         a, b = rings[i], rings[(i + 1) % m]
    183:         for k in range(n):
    184:             bm.faces.new((a[k], a[(k + 1) % n], b[(k + 1) % n], b[k]))
    185:     if not closed:
    186:         bm.faces.new(list(reversed(rings[0])))
    187:         bm.faces.new(rings[-1])
    188:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    189:     return bm
    190: 
    191: 
    192: def rivets(pts, r=.06, n=6):
    193:     """Small domed studs at points [(position, normal)]."""
    194:     bm = bmesh.new()
    195:     for p, nn in pts:
    196:         p, nn = Vector(p), Vector(nn).normalized()
    197:         a = nn.orthogonal().normalized()
    198:         b = nn.cross(a)
    199:         base = [bm.verts.new(p + (a * math.cos(2 * math.pi * k / n) + b * math.sin(2 * math.pi * k / n)) * r - nn * r * .3) for k in range(n)]
    200:         mid = [bm.verts.new(p + (a * math.cos(2 * math.pi * k / n) + b * math.sin(2 * math.pi * k / n)) * r * .75 + nn * r * .35) for k in range(n)]
    201:         tip = bm.verts.new(p + nn * r * .6)
    202:         bm.faces.new(list(reversed(base)))
    203:         for k in range(n):
    204:             j = (k + 1) % n
    205:             bm.faces.new((base[k], base[j], mid[j], mid[k]))
    206:             bm.faces.new((mid[k], mid[j], tip))
    207:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    208:     return bm
    209: 
    210: 
    211: def cap(c, axis, radii, up=(0, 0, 1)):
    212:     """f(u, v) for an ellipsoid round c with its pole along `axis`: u the angle round the axis in
    213:     degrees (0 toward `up`), v the angle from the pole in degrees. radii = (across up, across, along
    214:     the axis). Elbow and knee cops, fans and domes that face sideways."""
    215:     z = Vector(axis).normalized()
    216:     x = Vector(up) - z * Vector(up).dot(z)
    217:     x = x.normalized() if x.length > 1e-6 else z.orthogonal().normalized()
    218:     y = z.cross(x)
    219:     c = Vector(c)
    220:     ra, rb, rp = radii
    221: 
    222:     def f(u, v):
    223:         a, b = math.radians(u), math.radians(v)
    224:         return c + x * (ra * math.sin(b) * math.cos(a)) + y * (rb * math.sin(b) * math.sin(a)) + z * (rp * math.cos(b))
    225:     return f
    226: 
    227: 
    228: def put(P, name, sheet, role, jl, jr=None, bevel=.012):
    229:     """A sheet as a plate on a joint (mirrored onto jr)."""
    230:     P.solid(name, sheet.bm(), role, jl, jr, bevel=bevel)
    231: 
    232: 
    233: def rim(P, name, pts, r, jl, jr=None, role="trim", rope=0.0, closed=False):
    234:     """A rolled rim along points, in trim by default."""
    235:     P.solid(name, bead(pts, r, rope=rope, closed=closed), role, jl, jr, bevel=0)
    236: 
    237: 
    238: def curve(vals):
    239:     """A smooth function on [0, 1] through evenly spaced values."""
    240:     n = len(vals) - 1
    241:     s = spline([(i / n, v) for i, v in enumerate(vals)])
    242:     return lambda t: s(t)[1]
    243: 
    244: 
    245: def band(c, z0, z1, r, us, nv=6, kx=1.0, ky=1.0, t=.12, disp=None, wrap=False):
    246:     """A sheet round a vertical axis through c = (x, y) from height z0 to z1 (numbers or functions of
    247:     u). The radius r is a number, a pair (at z0, at z1), a list of evenly spaced values or a function
    248:     r(u, v), with v 0 at z0 and 1 at z1. Lames, tassets, greaves, sleeves."""
    249:     Z0 = z0 if callable(z0) else (lambda u: z0)
    250:     Z1 = z1 if callable(z1) else (lambda u: z1)
    251:     if callable(r):
    252:         R = r
    253:     elif isinstance(r, (int, float)):
    254:         R = lambda u, v: r
    255:     elif len(r) == 2:
    256:         R = lambda u, v: r[0] + (r[1] - r[0]) * v
    257:     else:
    258:         g = curve(r)
    259:         R = lambda u, v: g(v)
    260:
  • read_file{"EndLine":535,"Path":"~/work/sortie/kit/lab/knightkit.py","StartLine":261}

    input

    {
      "EndLine": 535,
      "Path": "~/work/sortie/kit/lab/knightkit.py",
      "StartLine": 261
    }

    result, 276 lines

    Showing lines 261-535 of 535
    261:     def f(u, v):
    262:         a = math.radians(u)
    263:         rr = R(u, v)
    264:         return (c[0] + rr * kx * math.cos(a), c[1] + rr * ky * math.sin(a), Z0(u) + (Z1(u) - Z0(u)) * v)
    265:     um = us[len(us) // 2]
    266:     if wrap:
    267:         us = list(us)[:-1]  # a closed ring: the last angle is the first
    268:     return Sheet(f, us, lin(0, 1, nv), t, disp=disp, inside=(c[0], c[1], (Z0(um) + Z1(um)) / 2), wrap=wrap)
    269: 
    270: 
    271: def helm(P, J, g, extra=None, base=True):
    272:     """The atelier's helm (makers.atelier) with `extra(P, J)` adding parts on the head joint, all
    273:     seated low between the pauldrons as atelier.head does. base=False leaves the atelier helm out, for a
    274:     line that draws its own (its shell must be named head_helmet, which atelier.crown_z reads)."""
    275:     from mathutils import Matrix
    276: 
    277:     from makers import atelier
    278:     H = J["head"]
    279:     if base:
    280:         atelier._head(P, J, g)
    281:     if extra is not None:
    282:         extra(P, J)
    283:     m = Matrix.Translation((0, 0, -atelier.HEAD_DROP))
    284:     for o in H.children:
    285:         if o.type == "MESH":
    286:             for v in o.data.vertices:
    287:                 v.co = m @ v.co
    288: 
    289: 
    290: def horn(pts, r0, n=10, power=1.4, squash=1.0, up=(0, 0, 1)):
    291:     """A solid tapering from radius r0 at the first point to a sharp tip at the last, along a line of
    292:     points (bend it for a swept horn). `squash` flattens the section across `up`: a blade."""
    293:     P = [Vector(p) for p in pts]
    294:     m = len(P)
    295:     L = [0.0]
    296:     for i in range(1, m):
    297:         L.append(L[-1] + (P[i] - P[i - 1]).length)
    298:     bm = bmesh.new()
    299:     rings = []
    300:     for i in range(m):
    301:         t = (P[min(i + 1, m - 1)] - P[max(i - 1, 0)]).normalized()
    302:         a = Vector(up) - t * Vector(up).dot(t)
    303:         a = a.normalized() if a.length > 1e-6 else t.orthogonal().normalized()
    304:         b = t.cross(a)
    305:         r = r0 * max(1 - L[i] / L[-1], 0.0) ** power
    306:         if i == m - 1:
    307:             rings.append([bm.verts.new(P[i])])
    308:             break
    309:         rings.append([bm.verts.new(P[i] + (a * math.cos(2 * math.pi * k / n) + b * squash * math.sin(2 * math.pi * k / n)) * r) for k in range(n)])
    310:     for i in range(m - 2):
    311:         x, y = rings[i], rings[i + 1]
    312:         for k in range(n):
    313:             bm.faces.new((x[k], x[(k + 1) % n], y[(k + 1) % n], y[k]))
    314:     tip = rings[-1][0]
    315:     last = rings[-2]
    316:     for k in range(n):
    317:         bm.faces.new((last[k], last[(k + 1) % n], tip))
    318:     bm.faces.new(list(reversed(rings[0])))
    319:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    320:     return bm
    321: 
    322: 
    323: def shoulder_root(P, J, role="main"):
    324:     """Round 1's cover over the step from the chest to the shoulder joint (makers.atelier.shoulder)."""
    325:     from makers import atelier
    326:     S = (J["shoulder", "L"], J["shoulder", "R"])
    327:     P.solid("shoulder_root", atelier.sheet(atelier.rect(1.6, 2.0, 14.0, 15.05), [(-.8, 14.0), (.25, 14.0), (.25, 15.05), (-.5, 15.05), (-.8, 14.8)],
    328:                                            atelier.ring((1.8, -.1), (.3, .72), 180, 360)), role, *S)
    329: 
    330: 
    331: def strip(path, w, t, grow_f):
    332:     """A flat band of width w along a path on a surface: path(s) -> (u, z) for s in [0, 1], grow_f(u, z, out) ->
    333:     the surface point at plan angle u and height z pushed out by `out`."""
    334:     def f(s, k):
    335:         u, z = path(s)
    336:         return grow_f(u, z + k * w / 2, 0.0)
    337:     return Sheet(f, lin(0, 1, 16), lin(-1, 1, 2), t, inside=(0, 0, 13.6))
    338: 
    339: 
    340: def sabaton(P, J, lames=((.55, -3.35),), point=1.0, keel=0.0, rims="front", rope=0.0, role="main"):
    341:     """A sabaton arched over the frame's foot, in foot space (frame_std.place_foot fits it), plus the
    342:     atelier's heel spinner. `lames` are (heel end y, toe end y) spans, each laid over the next toward
    343:     the toe. `point` 1 narrows the toe to a point, 0 keeps it broad and round. `keel` raises a ridge down
    344:     the instep. `rims`: "front" rolls each lame's toe edge in trim, "all" rims the whole hem, None none."""
    345:     import frame_std
    346:     from makers import atelier
    347:     FT = (J["foot", "L"], J["foot", "R"])
    348:     fit = frame_std.place_foot
    349:     y_tip = min(b for _, b in lames)
    350:     top = curve([1.18, 1.04, .86, .7, .56, .44])  # heel end to toe, by (.55 - y) / (.55 - y_tip)
    351:     wid = curve([.54, .54, .52, .48, .42, .3])
    352: 
    353:     def f(a, y, grow):
    354:         h = (.55 - y) / (.55 - y_tip)
    355:         w = wid(h) * (1 - point * smooth(h, .7, 1.0) * .8) + grow
    356:         zt = top(h) + grow
    357:         q = math.radians(a)
    358:         s = max(math.sin(q), 0.0) ** .7
    359:         return (1.2 + w * math.cos(q), y, .3 + (zt - .3) * s)
    360:     for i, (y0, y1) in enumerate(lames):
    361:         grow = .05 * (len(lames) - 1 - i)
    362:         sh = Sheet(lambda a, y, grow=grow: f(a, y, grow), lin(-8, 188, 22), lin(y0, y1, 10), .1,
    363:                    disp=(lambda a, y: keel * tent(a, 90, 26)) if keel else None, inside=(1.2, (y0 + y1) / 2, .3))
    364:         P.solid(f"sabaton{i}", fit(sh.bm()), role, *FT, bevel=.01)
    365:         if rims == "front":
    366:             P.solid(f"sabaton_rim{i}", fit(bead(sh.edge("v1", out=.015), .045, rope=rope)), "trim", *FT, bevel=0)
    367:         elif rims == "all":
    368:             pts = sh.edge("u0", out=.015)[::-1] + sh.edge("v1", out=.015) + sh.edge("u1", out=.015)
    369:             P.solid(f"sabaton_rim{i}", fit(bead(pts, .05, rope=rope)), "trim", *FT, bevel=0)
    370:     atelier.spinner(P, J, "medium")
    371: 
    372: 
    373: # ---- shared by every line: layered plates, add-ons, joint covers ---------------------------------------------
    374: def by(g, light, medium, heavy):
    375:     return {"light": light, "medium": medium, "heavy": heavy}[g]
    376: 
    377: 
    378: def put2(P, name, bm, jl, jr, roles, bevel=.012):
    379:     """A plate on jl, mirrored onto jr, each side its own role: roles is one role or (left, right)."""
    380:     from lib import copy, mirror_x
    381:     rl, rr = (roles, roles) if isinstance(roles, str) else roles
    382:     if jr is None:
    383:         P.solid(name, bm, rl, jl, bevel=bevel)
    384:         return
    385:     P.solid(f"{name}.L", copy(bm), rl, jl, bevel=bevel)
    386:     P.solid(f"{name}.R", mirror_x(bm), rr, jr, bevel=bevel)
    387:     bm.free()
    388: 
    389: 
    390: def lames(P, name, c, top, n, h, step, r0, dr, us, jl, jr, roles, rim_role, ky=1.0, kx=1.0, flare=.06, rope=0.0, dip=None, t=.12):
    391:     """n lames stacked downward under a plate, each tucked under the hem of the one above (dr < 0), so every hem
    392:     and its rim shows. `dip(u)` sweeps every edge down where it is positive."""
    393:     for i in range(n):
    394:         za, zb = top - step * i, top - step * i - h
    395:         z0 = (lambda u, zb=zb, i=i: zb - dip(u) * (1 + .3 * i)) if dip else zb
    396:         z1 = (lambda u, za=za, i=i: za - dip(u) * (1 + .3 * i)) if dip else za
    397:         r = r0 + dr * i
    398:         s = band(c, z0, z1, [r + flare, r + flare * .5, r], us, nv=3, kx=kx, ky=ky, t=t)
    399:         put2(P, f"{name}{i}", s.bm(), jl, jr, roles)
    400:         if rim_role:
    401:             rim(P, f"{name}_rim{i}", s.edge("v0", out=.015), .055, jl, jr, role=rim_role, rope=rope)
    402: 
    403: 
    404: def addon(P, name, c, r, us, z0, z1, point, jl, jr, roles, ky=1.0, kx=1.0, t=.12, rope=0.0, studs=4, disp=None, rim_role="trim"):
    405:     """A reinforcing plate bolted over a base plate: square top, a point of depth `point` at the bottom
    406:     (0 for a square plate), a rim and studs. r(v) is the base plate's radius plus the stand off."""
    407:     umid, half = (us[0] + us[-1]) / 2, (us[-1] - us[0]) / 2
    408:     bot = lambda u: z0 + point * (1 - tent(u, umid, half) ** .7)
    409:     s = band(c, bot, z1, lambda u, v: r(v), us, nv=8, kx=kx, ky=ky, t=t, disp=disp)
    410:     put2(P, name, s.bm(), jl, jr, roles)
    411:     loop = s.edge("v0", out=.02) + s.edge("u1", out=.02)[1:] + list(reversed(s.edge("v1", out=.02)))[1:] + list(reversed(s.edge("u0", out=.02)))[1:]
    412:     P.solid(f"{name}_rim", bead(loop, .06, rope=rope, closed=True), rim_role, jl, jr, bevel=0)
    413:     if studs:
    414:         n = len(us) - 1
    415:         at = [(2, 6), (n - 2, 6), (n // 2, 7), (n // 2, 2)][:studs]
    416:         P.solid(f"{name}_studs", rivets([(s.point(i, j, .02), s.N[i][j]) for i, j in at], r=.07), "metal", jl, jr, bevel=0)
    417:     return s
    418: 
    419: 
    420: # Joint covers: the soft layer under the plates, in the frame colour, so a gap between plates reads as a
    421: # deliberate shadow and not as machinery (docs/visual-language.md, Inner frame). As harness has mail and an
    422: # arming doublet under it. Three styles, one per line where it suits:
    423: #   quilt    padded and stitched in pillows, the arming doublet
    424: #   bellows  smooth folds round the joint
    425: #   mail     fine rows with a scalloped hem
    426: def soft(style, rows, cols=None, amp=1.0):
    427:     """The displacement of a cover's outer face: u in degrees, v in [0, 1], scaled by amp."""
    428:     import math as m
    429: 
    430:     def quilt(u, v):
    431:         fu = (u / (cols or 30.0)) % 1.0
    432:         fv = (v * rows) % 1.0
    433:         return .05 * amp * (m.sin(m.pi * fu) * m.sin(m.pi * fv)) ** .5
    434: 
    435:     def bellows(u, v):
    436:         return .04 * amp * abs(m.sin(m.pi * v * rows))
    437: 
    438:     def mail(u, v):
    439:         return amp * (.03 * abs(m.sin(m.pi * v * rows * 3)) + .015 * abs(m.sin(m.radians(u) * 30)))
    440:     return {"quilt": quilt, "bellows": bellows, "mail": mail}[style]
    441: 
    442: 
    443: def cover(P, name, c, z0, z1, r, us, jl, jr=None, style="quilt", rows=4, kx=1.0, ky=1.0, t=.07, wrap=False, cols=None, amp=1.0):
    444:     """A joint cover: a soft sheet round a vertical axis in the frame colour."""
    445:     s = band(c, z0, z1, r, us, nv=max(6, rows * 4), kx=kx, ky=ky, t=t, disp=soft(style, rows, cols, amp), wrap=wrap)
    446:     P.solid(name, s.bm(), "frame", jl, jr, bevel=0)
    447:     return s
    448: 
    449: 
    450: RING = lin(-180, 180, 36)
    451: 
    452: 
    453: def cover_x(P, name, c, x0, x1, r, jl, jr=None, style="quilt", rows=3, amp=1.0, t=.07):
    454:     """A joint cover round a horizontal axis along X at c = (y, z), from x0 to x1: a shoulder socket."""
    455:     g = curve(r) if not isinstance(r, (int, float)) else (lambda v: r)
    456: 
    457:     def f(u, v):
    458:         a = math.radians(u)
    459:         rr = g(v)
    460:         return (x0 + (x1 - x0) * v, c[0] + rr * math.cos(a), c[1] + rr * math.sin(a))
    461:     d = soft(style, rows, None, amp)
    462:     s = Sheet(f, RING[:-1], lin(0, 1, max(6, rows * 4)), t, disp=lambda u, v: d(u, v), inside=((x0 + x1) / 2, c[0], c[1]), wrap=True)
    463:     P.solid(name, s.bm(), "frame", jl, jr, bevel=0)
    464:     return s
    465: 
    466: 
    467: def joint_covers(P, J, g, style="quilt", fauld="mail"):
    468:     """The soft layer at every joint, by grade (docs/visual-language.md, coverage by grade). Light: the waist,
    469:     arming sleeves over the bare upper arm, a short fauld behind the hips and pads behind the knees, the
    470:     elbows, knees and neck showing. Medium: armpit gussets, elbow covers, a full fauld, a neck roll. Heavy:
    471:     rings round the knees and ankles, a longer fauld, wrist rolls: almost nothing of the frame shows."""
    472:     S, UA, FA = (J["shoulder", "L"], J["shoulder", "R"]), (J["upperarm", "L"], J["upperarm", "R"]), (J["forearm", "L"], J["forearm", "R"])
    473:     TH, SH = (J["thigh", "L"], J["thigh", "R"]), (J["shin", "L"], J["shin", "R"])
    474:     cover(P, "cover_waist", (0, .1), 11.1, 12.3, [.86, .8, .86], RING, J["waist"], style=style, rows=3, kx=1.02, wrap=True)
    475:     # the fauld: mail (or the line's own) round the hips, short and behind only on the light
    476:     # the fauld: hanging sections broken at each leg, flat, not a skirt round the hips: one behind on the light,
    477:     # front and back and a pair over the hips on the medium and heavy
    478:     fz = by(g, 9.85, 9.4, 9.0)
    479:     secs = [("back", lin(55, 125, 12))] + ([] if g == "light" else [("front", lin(-118, -62, 10))])
    480:     for nm, us in secs:
    481:         cover(P, f"cover_fauld_{nm}", (0, .05), fz, 10.95, [1.32, 1.28, 1.24], us, J["pelvis"], style=fauld, rows=by(g, 3, 4, 5), kx=1.05, ky=.9,
    482:               amp=.35)
    483:     if g != "light":
    484:         cover(P, "cover_fauld_side", (0, .05), fz + .2, 10.9, [1.42, 1.38, 1.32], lin(-30, 30, 10), J["pelvis"], J["pelvis"], style=fauld,
    485:               rows=by(g, 3, 4, 5), kx=1.05, ky=.9, amp=.35)
    486:     # the thigh under the cuisse, front and back plates or not
    487:     # the thigh under the cuisse: a quiet quilt whatever the line, it is a gap between plates, not a joint
    488:     cover(P, "cover_thigh", (1.16, 0), 6.9, 9.75, [.7, .72, .72], RING, *TH, style="quilt", rows=3, wrap=True, amp=.5, cols=45)
    489:     # knee: a pad behind (light), a ring round it (heavy)
    490:     kus = by(g, lin(40, 140, 12), lin(30, 150, 14), lin(15, 165, 18))  # behind only: the front is the poleyn's
    491:     # flat behind, shallow folds only in the bend
    492:     cover(P, "cover_knee", (1.2, .05), 5.4, 6.9, [.9, .92, .92, .9], kus, *SH, style=style, rows=3, amp=.4)
    493:     # the hip: a roll round the top of each thigh under the fauld
    494:     cover(P, "cover_hip", (1.16, .02), 9.55, 10.75, [.86, .9, .84], RING, *TH, style=style, rows=2, wrap=True)
    495:     # the shoulder socket: a roll round the frame's shoulder bar from the chest side to the pauldron, so the
    496:     # bar's square ends do not show
    497:     cover_x(P, "cover_socket", (0, 14.62), 1.22, 2.2, [.46, .5, .58, .66], *S, style=style, rows=3, amp=.5)
    498:     # the armpit gusset, between the chest side and the arm, over the rams at the chest corners
    499:     cover(P, "cover_armpit", (2.45, 0), 12.7, 14.4, [1.0, 1.12, 1.18], lin(140, 262, 18), *S, style=style, rows=4)
    500:     if g == "light":
    501:         # the arming sleeve over the bare upper arm posts, under the cap
    502:         cover(P, "cover_sleeve", (2.45, 0), 12.35, 14.35, [.54, .52, .5, .5], RING, *UA, style=style, rows=3, wrap=True, amp=.35)
    503:         return
    504:     # the elbow, in two halves so it can bend
    505:     cover(P, "cover_elbow_hi", (2.5, 0), 11.95, 12.5, [.52, .5], RING, *UA, style=style, rows=2, wrap=True)
    506:     cover(P, "cover_elbow_lo", (2.5, 0), 11.45, 11.97, [.5, .52], RING, *FA, style=style, rows=2, wrap=True)
    507:     cover(P, "cover_neck", (0, 0), 15.05, 15.7, [.56, .52, .5], RING, J["neck"], style=style, rows=3, wrap=True)
    508:     if g == "heavy":
    509:         cover(P, "cover_ankle", (1.2, .1), 1.35, 2.0, [.6, .56], RING, *SH, style=style, rows=2, wrap=True)
    510:         cover(P, "cover_wrist", (2.5, 0), 9.45, 9.9, [.5, .52], RING, *FA, style=style, rows=2, wrap=True)
    511: 
    512: 
    513: def head_layers(P, J, g, roles="main"):
    514:     """The helm steps up with the grade too: the light bare, the medium with cheek guards, the heavy with a
    515:     bevor rising to the sight, a gold brow rim and studs. Drawn round the atelier helm before it is seated."""
    516:     if g == "light":
    517:         return
    518:     H = J["head"]
    519:     ch = band((0, -.05), 15.82, 16.32, [.62, .6], lin(-66, -16, 8), nv=4, ky=1.3, t=.1)
    520:     put2(P, "helm_cheek", ch.bm(), H, H, roles)
    521:     if g != "heavy":
    522:         return
    523:     rim(P, "helm_cheek_rim", ch.edge("v0", out=.01), .04, H, H)
    524:     bv = band((0, -.15), 15.6, lambda u: 16.18 - .06 * (1 - tent(u, -90, 60)), [.86, .8, .74], lin(-156, -24, 24), nv=5, ky=1.08, t=.12)
    525:     put2(P, "helm_bevor", bv.bm(), H, None, roles if isinstance(roles, str) else roles[0])
    526:     rim(P, "helm_bevor_rim", bv.edge("v1", out=.02), .05, H)
    527:     P.solid("helm_studs", rivets([(ch.point(i, j, .02), ch.N[i][j]) for i, j in ((2, 1), (6, 1), (2, 3), (6, 3))], r=.05), "metal", H, H, bevel=0)
    528: 
    529: 
    530: def back_layers(P, J, g, roles="main"):
    531:     """The heavy's pack carries a second layer: plates over the tanks either side, rimmed and studded."""
    532:     if g != "heavy":
    533:         return
    534:     B = J["backpack"]
    535:     addon(P, "pack_cheek", (0, 1.5), lambda v: 1.55 + .04 * v, lin(14, 50, 8), 12.3, 14.5, 0.0, B, B, roles, kx=1.02, ky=.95, t=.12, studs=2)

agent

+15:17
reasoning

Investigating potential rendering inconsistencies related to "black blocks" and shading artifacts. Specifically, examining code responsible for joint coverage and material properties in relation to image generation. Suspect a rendering bug arising from how these aspects are handled, leading to the observed visual anomalies.

The "black blocks" are now understood as intentional rendering of armor elements, specifically cover_armpit and cover_fauld_front. The code positions these elements in a way that creates these visual artifacts. The origin point and radii values in cover_armpit cause it to project forward, creating the unwanted block effect. Similarly, cover_fauld_front's positioning explains the rectangle between the thighs.

The visual artifacts stem from specific code implementations within knightkit.py. The exaggerated protrusions of "black blocks" are caused by the positioning and material assignment of cover_armpit and cover_fauld_front. The "puffy pillow" shading arises from how Sheet.bm() creates side thickness walls sharing vertices with the outer face, compounded by a bevel operation and smooth shading on all faces. This leads to vertex normal averaging, resulting in the unwanted shading effect.

The "puffy pillow" shading across the outer sheet stems from vertex normal averaging during the bevel and smooth shading operations, particularly when tent(u, -90, 30) generates a central keel ridge. This operation causes ridge crest vertices to be smoothed across the entire breastplate instead of splitting the edge, resulting in the rounded shading. Splitting edges at a certain threshold or at the ridge seam resolves the issue by creating a sharp metallic crease and crisp borders. This explains the awkward appearance of Round 2's output, validating the hypothesis.

The exaggerated protrusions of armor elements are caused by the positioning and material assignment of cover_armpit and cover_fauld_front. Specifically, the origin points and radii cause these elements to project outward as oversized black rectangles, overwriting underlying painted armor. This positioning leads to the creation of the problematic "black blocks". Furthermore, normal smoothing across all surfaces combined with the welding of different surfaces leads to the "puffy pillow" shading on armor plates. Finally, the Round 2 mechs were only exported as static lineups and were never presented as standalone rigged mechs on the 22-joint skeleton.

The "striker" configuration, which is the default for a specific visual setup, lacks weapons and thrusters and uses a drab color palette. The immediate hypothesis is that addressing the rendering issues in Estoc and Harness will produce a positive visual impact when rendered using the project's rendering tools. To test this, the following fixes will be applied: the Sheet.bm() function will be modified to split edges, and the cover_armpit will be repositioned to tuck inside.

  • read_file{"EndLine":310,"Path":"~/work/sortie/kit/lib.py","StartLine":240}

    input

    {
      "EndLine": 310,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 240
    }

    result, 72 lines

    Showing lines 240-310 of 437
    240:     cutter = link(bpy.data.objects.new("_cut", me))
    241:     bpy.context.view_layer.update()
    242:     cutter.matrix_world = target.matrix_world.copy()
    243:     mod = target.modifiers.new("bool", "BOOLEAN")
    244:     mod.operation = op
    245:     mod.object = cutter
    246:     mod.solver = "EXACT"
    247:     if role is not None:
    248:         mod.material_mode = "TRANSFER"
    249:     bake(target)
    250:     bpy.data.objects.remove(cutter, do_unlink=True)
    251:     bpy.data.meshes.remove(me)
    252:     return target
    253: 
    254: 
    255: def two_view(front, side, top=None, span=60.0):
    256:     """Intersect a front outline (x, z) with a side outline (y, z), and optionally a top outline
    257:     (x, y). Returns a bmesh. The classic way to block out armour and heads."""
    258:     a = prism(front, -span, span, "xz")
    259:     me = bpy.data.meshes.new("_tv")
    260:     a.to_mesh(me)
    261:     a.free()
    262:     o = link(bpy.data.objects.new("_tv", me))
    263:     boolean(o, prism(side, -span, span, "yz"), "INTERSECT")
    264:     if top is not None:
    265:         boolean(o, prism(top, -span, span, "xy"), "INTERSECT")
    266:     bm = bmesh.new()
    267:     bm.from_mesh(o.data)
    268:     bpy.data.objects.remove(o, do_unlink=True)
    269:     return bm
    270: 
    271: 
    272: def clip(bm, x=(-60, 60), y=(-60, 60), z=(-60, 60)):
    273:     """The part of a solid inside an axis-aligned box. Cutting one envelope into several boxes with
    274:     gaps between them gives separate shells over the same form."""
    275:     me = bpy.data.meshes.new("_clip")
    276:     bm.to_mesh(me)
    277:     bm.free()
    278:     o = link(bpy.data.objects.new("_clip", me))
    279:     cut = loft([(z[0], [(x[0], y[0]), (x[1], y[0]), (x[1], y[1]), (x[0], y[1])]),
    280:                 (z[1], [(x[0], y[0]), (x[1], y[0]), (x[1], y[1]), (x[0], y[1])])])
    281:     boolean(o, cut, "INTERSECT")
    282:     out = bmesh.new()
    283:     out.from_mesh(o.data)
    284:     data = o.data
    285:     bpy.data.objects.remove(o, do_unlink=True)
    286:     bpy.data.meshes.remove(data)
    287:     return out
    288: 
    289: 
    290: def copy(bm):
    291:     me = bpy.data.meshes.new("_copy")
    292:     bm.to_mesh(me)
    293:     out = bmesh.new()
    294:     out.from_mesh(me)
    295:     bpy.data.meshes.remove(me)
    296:     return out
    297: 
    298: 
    299: def _keep_side(bm, co, no, below):
    300:     """Keep the part of a solid below (or above) a plane and cap the opening."""
    301:     geom = bm.verts[:] + bm.edges[:] + bm.faces[:]
    302:     res = bmesh.ops.bisect_plane(bm, geom=geom, plane_co=co, plane_no=no, clear_outer=below, clear_inner=not below)
    303:     edges = [e for e in res["geom_cut"] if isinstance(e, bmesh.types.BMEdge)]
    304:     if edges:
    305:         bmesh.ops.holes_fill(bm, edges=edges, sides=0)
    306:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    307:     return bm
    308: 
    309: 
    310: def halves(bm, co, no, gap=.04):
  • read_file{"EndLine":240,"Path":"~/work/sortie/kit/lib.py","StartLine":160}

    input

    {
      "EndLine": 240,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 160
    }

    result, 82 lines

    Showing lines 160-240 of 437
    160:     me = bpy.data.meshes.new("_m")
    161:     bm.to_mesh(me)
    162:     out = bmesh.new()
    163:     out.from_mesh(me)
    164:     bpy.data.meshes.remove(me)
    165:     bmesh.ops.scale(out, vec=(-1, 1, 1), verts=out.verts)
    166:     bmesh.ops.reverse_faces(out, faces=out.faces)
    167:     return out
    168: 
    169: 
    170: def rot(axis, deg, about=(0, 0, 0)):
    171:     c = Vector(about)
    172:     return Matrix.Translation(c) @ Matrix.Rotation(math.radians(deg), 4, axis) @ Matrix.Translation(-c)
    173: 
    174: 
    175: # ---- objects ----------------------------------------------------------------------------------------------
    176: def solid(name, bm, role, parent=None, bevel=0.0, segs=1, angle=40, smooth=False, outline=True, panels=None):
    177:     """Turn a bmesh into an object with a material role, an optional chamfer on edges sharper than
    178:     `angle`, flat or smooth shading, parented to a joint without moving. Armour roles get panel
    179:     seams on their large faces unless panels=False."""
    180:     me = bpy.data.meshes.new(name)
    181:     bm.to_mesh(me)
    182:     bm.free()
    183:     me.materials.append(material(role))
    184:     o = link(bpy.data.objects.new(name, me))
    185:     if bevel > 0:
    186:         mod = o.modifiers.new("bevel", "BEVEL")
    187:         mod.width = bevel
    188:         mod.segments = segs
    189:         mod.limit_method = "ANGLE"
    190:         mod.angle_limit = math.radians(angle)
    191:         mod.use_clamp_overlap = True
    192:         mod.miter_outer = "MITER_ARC"
    193:         bake(o)
    194:     if panels is None:
    195:         panels = role in ("main", "accent", "hull") and not smooth
    196:     if panels:
    197:         panel_lines(o)
    198:     me = o.data
    199:     if smooth:
    200:         me.shade_smooth()
    201:         me.set_sharp_from_angle(angle=math.radians(35))
    202:     if not outline:
    203:         o["outline"] = False
    204:     if parent is not None:
    205:         attach(o, parent)
    206:     return o
    207: 
    208: 
    209: def panel_lines(o, min_area=1.1, width=0.05, depth=0.016):
    210:     """Recess every large face slightly inside a thin border: reads as panel seams on armour."""
    211:     bm = bmesh.new()
    212:     bm.from_mesh(o.data)
    213:     faces = [f for f in bm.faces if f.calc_area() > min_area]
    214:     if faces:
    215:         bmesh.ops.inset_individual(bm, faces=faces, thickness=width, depth=-depth, use_even_offset=True)
    216:     bm.to_mesh(o.data)
    217:     bm.free()
    218:     return o
    219: 
    220: 
    221: def bake(o):
    222:     dg = bpy.context.evaluated_depsgraph_get()
    223:     me = bpy.data.meshes.new_from_object(o.evaluated_get(dg))
    224:     old = o.data
    225:     o.modifiers.clear()
    226:     o.data = me
    227:     me.name = old.name
    228:     bpy.data.meshes.remove(old)
    229:     return o
    230: 
    231: 
    232: def boolean(target, cutter_bm, op="DIFFERENCE", role=None):
    233:     """Cut (or intersect/union) a solid object with a bmesh volume. With a role, the faces the cutter
    234:     leaves behind (the inside of a cavity) take that material."""
    235:     me = bpy.data.meshes.new("_cut")
    236:     cutter_bm.to_mesh(me)
    237:     cutter_bm.free()
    238:     if role is not None:
    239:         me.materials.append(material(role))
    240:     cutter = link(bpy.data.objects.new("_cut", me))