A 3D model pipeline, pushed by GPT-6.2-Astra

agent (cont.)

+0:40
  • exec_commandcat tools/poses.py && cat tools/terrain.py (+4 more)

    command

    cat tools/poses.py && cat tools/terrain.py
    
    rg -n '^class |^def |COSTUMES|^export|^function |^(async |const (scene|cam|renderer|[a-z]+ ?= ?`))' tools/{outfit,gear,export_glb,vroid_portrait}.py review/vroid-02/{index.html,build.py}
    
    ls -la ~/context && ls ~/.local/share/lowmarch/vroid/lowmarch_bodies | tail -80 && ls -la ~/.cache && which chromium chromium-browser node python3 blender || true && ls -l ~/context/sortie-node_modules | head -60 && cat .gitignore
    
    cat tools/shots/arm_shoot.py && cat tools/shots/variant_build.py
    
    cat art/cast/cast.py | head -275

    result, 635 lines

    Script completed
    Wall time 0.1 seconds
    Output:
    Warning: truncated output (original token count: 12536)
    Total output lines: 828
    
    """Poses for VRoid skeletons: bone name -> 3x3 rotation applied in the bone's own (rest) frame.
    
    Rest pose is a T-pose with identity bone rotations, so local axes start aligned with the model:
    x = character's left is -x, y up, the character faces -z. For the RIGHT arm the bones run along
    +x and the palm faces -y; for the LEFT arm along -x.
    """
    import math
    
    import numpy as np
    
    
    def rot(axis, deg):
        a = math.radians(deg)
        c, s = math.cos(a), math.sin(a)
        x, y, z = np.asarray(axis, float) / np.linalg.norm(axis)
        return np.array([[c + x * x * (1 - c), x * y * (1 - c) - z * s, x * z * (1 - c) + y * s],
                         [y * x * (1 - c) + z * s, c + y * y * (1 - c), y * z * (1 - c) - x * s],
                         [z * x * (1 - c) - y * s, z * y * (1 - c) + x * s, c + z * z * (1 - c)]])
    
    
    def as4(r):
        r = np.asarray(r, float)
        if r.shape == (4, 4):
            return r
        m = np.eye(4)
        m[:3, :3] = r
        return m
    
    
    def move(dx=0.0, dy=0.0, dz=0.0, r=None):
        """A 4x4 adjustment: translate (in the bone's parent frame units, metres) and optionally rotate."""
        m = as4(np.eye(3) if r is None else r)
        m[:3, 3] = (dx, dy, dz)
        return m
    
    
    def merge(*poses):
        out = {}
        for p in poses:
            for k, r in p.items():
                out[k] = as4(out[k]) @ as4(r) if k in out else r
        return out
    
    
    def fist(side, curl=(70, 85, 55), thumb=35):
        """Curl the fingers of one hand toward the palm (a grip)."""
        sz = -1 if side == "R" else 1               # rotation about local z that bends toward -y
        out = {}
        for f in ("Index", "Middle", "Ring", "Little"):
            for i, a in enumerate(curl, 1):
                out[f"J_Bip_{side}_{f}{i}"] = rot((0, 0, 1), sz * a)
        out[f"J_Bip_{side}_Thumb2"] = rot((0, 1, 0), (1 if side == "R" else -1) * thumb)
        out[f"J_Bip_{side}_Thumb3"] = rot((0, 0, 1), sz * 30)
        return out
    
    
    # Bust: arms down from the T-pose, shoulders relaxed.
    BUST = {"J_Bip_L_UpperArm": rot((0, 0, 1), 72), "J_Bip_R_UpperArm": rot((0, 0, 1), -72),
            "J_Bip_L_Shoulder": rot((0, 0, 1), 6), "J_Bip_R_Shoulder": rot((0, 0, 1), -6)}
    
    # Battle idle: sword in the right hand held forward, left arm loose, feet apart.
    BATTLE_IDLE = merge(BUST, {
        "J_Bip_R_UpperArm": rot((0, 1, 0), 18),       # swing the right arm a little forward
        "J_Bip_R_LowerArm": rot((0, 1, 0), 55),       # bend the elbow, forearm forward
        "J_Bip_R_Hand": rot((1, 0, 0), -20),          # tip the blade up a little
        "J_Bip_L_LowerArm": rot((0, 1, 0), -20),
        "J_Bip_L_UpperLeg": rot((0, 0, 1), -5) @ rot((1, 0, 0), 8),
        "J_Bip_R_UpperLeg": rot((0, 0, 1), 5) @ rot((1, 0, 0), -10),
        "J_Bip_R_LowerLeg": rot((1, 0, 0), 12),
    }, fist("R"), fist("L", curl=(25, 35, 20), thumb=10))
    
    
    # ---- battle clips: (time in seconds, pose) keyframes ------------------------------------------------------------
    # Signs (VRoid rest frame): the character faces -z. For the right arm, rot_z(+) raises it,
    # rot_y(+) swings it forward. For legs, rot_x(+) swings the leg forward, rot_x(-) on a lower leg
    # bends the knee. For the spine, rot_y(+) turns the shoulders toward the left (the attack side),
    # rot_x(-) leans forward.
    WIND_UP = merge(BATTLE_IDLE, {
        "J_Bip_C_Hips": move(0, -0.02, 0.05),
        "J_Bip_C_Spine": rot((0, 1, 0), -22),
        "J_Bip_C_Chest": rot((1, 0, 0), 4),
        "J_Bip_R_UpperArm": rot((0, 0, 1), 95) @ rot((0, 1, 0), -40),
        "J_Bip_R_LowerArm": rot((0, 1, 0), 45),
        "J_Bip_R_Hand": rot((1, 0, 0), 25),
        "J_Bip_L_UpperArm": rot((0, 1, 0), -25),
        "J_Bip_L_UpperLeg": rot((1, 0, 0), 12),
        "J_Bip_R_LowerLeg": rot((1, 0, 0), -14),
    })
    SLASH = merge(BATTLE_IDLE, {
        "J_Bip_C_Hips": move(0, -0.07, -0.30),
        "J_Bip_C_Spine": rot((0, 1, 0), 26),
        "J_Bip_C_Chest": rot((1, 0, 0), -12),
        "J_Bip_R_UpperArm": rot((0, 0, 1), 30) @ rot((0, 1, 0), 70),
        "J_Bip_R_LowerArm": rot((0, 1, 0), -50),
        "J_Bip_R_Hand": rot((1, 0, 0), 15),
        "J_Bip_L_UpperArm": rot((0, 1, 0), -35) @ rot((0, 0, 1), -10),
        "J_Bip_L_UpperLeg": rot((1, 0, 0), 38),
        "J_Bip_L_LowerLeg": rot((1, 0, 0), -40),
        "J_Bip_R_UpperLeg": rot((1, 0, 0), -30),
        "J_Bip_R_LowerLeg": rot((1, 0, 0), -12),
    })
    FOLLOW = merge(SLASH, {
        "J_Bip_C_Spine": rot((0, 1, 0), 14),
        "J_Bip_R_UpperArm": rot((0, 0, 1), -40) @ rot((0, 1, 0), 15),
        "J_Bip_R_LowerArm": rot((0, 1, 0), -10),
        "J_Bip_R_Hand": rot((1, 0, 0), 25),
    })
    IDLE_BREATH = merge(BATTLE_IDLE, {"J_Bip_C_Chest": rot((1, 0, 0), -2.5), "J_Bip_R_UpperArm": rot((0, 0, 1), 3),
                                      "J_Bip_C_Hips": move(0, -0.008, 0)})
    
    CLIPS = {
        "idle": [(0.0, BATTLE_IDLE), (0.9, IDLE_BREATH), (1.8, BATTLE_IDLE)],
        "attack": [(0.0, BATTLE_IDLE), (0.32, WIND_UP), (0.44, WIND_UP), (0.56, SLASH), (0.68, FOLLOW), (1.05, FOLLOW),
                   (1.5, BATTLE_IDLE)],
    }
    """Battle-scene terrain built in code: the ground a unit stands on in the side-view battle.
    
    Pieces use the same primitive dicts as outfit.py, with `world=True` so the renderer keeps them
    fixed while the character turns. Model coordinates: metres, y up, ground at y = 0.
    """
    import math
    
    import numpy as np
    
    from outfit import grid_mesh, piece, ball
    
    
    def _noise(x, z, seed):
        rng = np.random.default_rng(seed)
        out = np.zeros_like(x)
        for k in range(5):
            fx, fz, ph = rng.uniform(1.5, 6.0), rng.uniform(1.5, 6.0), rng.uniform(0, 2 * math.pi, 2)
            out += np.sin(x * fx + ph[0]) * np.cos(z * fz + ph[1]) / (k + 1)
        return out
    
    
    def plains(width=4.2, depth=1.8, thick=0.25, seed=3, tufts=26, stones=5):
        """A raised plains platform: grassy top with gentle bumps, an earth bank on the sides, grass
        tufts and a few stones."""
        out = []
        nx, nz = 60, 26
        xs = np.linspace(-width / 2, width / 2, nx)
        zs = np.linspace(-depth / 2, depth / 2, nz)
        X, Z = np.meshgrid(xs, zs, indexing="ij")
        Y = 0.012 * _noise(X, Z, seed) - 0.004
        # keep it flat where the unit stands
        Y *= np.clip(np.hypot(X / 0.5, Z / 0.4) - 0.6, 0, 1)
        top = np.stack([X, Y, Z], -1)
        pos, tri = grid_mesh(top)
        out.append(piece("ground", "grass", pos, tri, outward_from=[0, -5, 0]))
        # earth bank on the four sides
        def bank(edge, name):
            lo = edge.copy()
            lo[:, 1] = -thick
            lo[:, 0] *= 1.02
            lo[:, 2] *= 1.02
            P = np.stack([edge, lo], 1)
            p_, t_ = grid_mesh(P)
            return piece(name, "dirt", p_, t_, outward_from=[0, -thick / 2, 0])
        out.append(bank(top[:, 0], "bank_back"))
        out.append(bank(top[:, -1], "bank_front"))
        out.append(bank(top[0, :], "bank_left"))
        out.append(bank(top[-1, :], "bank_right"))
        rng = np.random.default_rng(seed + 1)
        for i in range(tufts):
            x, z = rng.uniform(-width / 2 * 0.95, width / 2 * 0.95), rng.uniform(-depth / 2 * 0.9, depth / 2 * 0.9)
            if abs(x) < 0.45 and abs(z) < 0.35:
                continue
            h = rng.uniform(0.04, 0.09)
            blades = []
            for b in range(5):
                a = rng.uniform(0, 2 * math.pi)
                lean = np.array([math.cos(a), 0, math.sin(a)]) * rng.uniform(0.01, 0.03)
                base = np.array([x, 0.0, z]) + lean * 0.4
                tip = base + np.array([0, h, 0]) + lean
                w = np.array([-math.sin(a), 0, math.cos(a)]) * 0.007
                blades.append(np.array([base - w, base + w, tip]))
            pos = np.concatenate(blades)
            tri = np.arange(len(pos)).reshape(-1, 3)
            out.append(piece(f"tuft{i}", "grass", pos, tri, outward_from=[x, -1, z]))
        for i in range(stones):
            x, z = rng.uniform(-width / 2 * 0.9, width / 2 * 0.9), rng.uniform(-depth / 2 * 0.8, depth / 2 * 0.8)
            if abs(x) < 0.5 and abs(z) < 0.4:
                continue
            r = rng.uniform(0.04, 0.09)
            out.append(ball(f"stone{i}", "stone", [x, r * 0.35, z], r, squash=(1.0, 0.55, 0.8)))
        for p in out:
            p["world"] = True
        return out
    
    
    TERRAIN = {"plains": plains}
    
    review/vroid-02/build.py:89:def costume_of(c):
    review/vroid-02/build.py:94:    base = outfit.COSTUMES[c.get("costume") or "lord"]
    review/vroid-02/build.py:106:def model_path(name, c):
    review/vroid-02/build.py:137:def arm_room(name, c, need=0.006, most=16):
    review/vroid-02/build.py:155:def portrait(name, view):
    review/vroid-02/build.py:165:def springs(v):
    review/vroid-02/build.py:183:def wrap_json(path):
    review/vroid-02/build.py:188:def character(args):
    review/vroid-02/build.py:218:def save_geometry(name, p):
    review/vroid-02/build.py:231:def _fit_of(c):
    review/vroid-02/build.py:243:def _nth(p):
    review/vroid-02/build.py:248:def proportion_checks(name, c):
    review/vroid-02/build.py:310:def scenery(name):
    review/vroid-02/build.py:318:def duel_cached():
    review/vroid-02/build.py:332:def as_list(o):
    review/vroid-02/index.html:302:const scene = new THREE.Scene();
    review/vroid-02/index.html:306:const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0.1, 40);
    review/vroid-02/index.html:609:function compPass(fs, uniforms) {
    review/vroid-02/index.html:631:function targetsFor(w, h) {
    review/vroid-02/index.html:646:class Cloth {
    review/vroid-02/index.html:777:class SkirtRig extends Cloth {
    review/vroid-02/index.html:859:function paintMaterial(V, role, map, index, infoRole = role, decal = false) {
    review/vroid-02/index.html:912:async function parseGlb(file) {
    review/vroid-02/index.html:918:function prepMesh(o, V, opts = {}) {
    review/vroid-02/index.html:946:async function loadCharacter(name) {
    review/vroid-02/index.html:983:async function loadGround() {
    review/vroid-02/index.html:994:function applyMaterials() {
    review/vroid-02/index.html:1011:function setClip(name, blendFrom = null) {
    review/vroid-02/index.html:1024:function animate(dt) {
    review/vroid-02/index.html:1051:function armSide(c, side) {                          // +1 when the arm points along the model's +x
    review/vroid-02/index.html:1060:function turnBone(c, name, deg) {                    // about the model's front axis, at the bone's own joint
    review/vroid-02/index.html:1068:function applyPose(c) {
    review/vroid-02/index.html:1081:function applyMotion(c, dt) {
    review/vroid-02/index.html:1099:function makeSprings(c, groups) {
    review/vroid-02/index.html:1123:function stepSprings(c, dt) {
    review/vroid-02/index.html:1156:function layoutCompare() {
    review/vroid-02/index.html:1179:function placeTags() {                               // the names under the feet
    review/vroid-02/index.html:1193:function compareChanged() {                          // the comparison is in the link, to share it
    review/vroid-02/index.html:1203:function insets() {
    review/vroid-02/index.html:1209:function fitFrustum() {
    review/vroid-02/index.html:1219:function size() {
    review/vroid-02/index.html:1229:function matchCamera() {
    review/vroid-02/index.html:1245:function focusAt(e) {
    review/vroid-02/index.html:1255:function setYaw(y) {
    review/vroid-02/index.html:1265:function buildParts() {
    review/vroid-02/index.html:1275:function groupedSelect(label, skip, onPick) {      // every model in its group, as one dropdown
    review/vroid-02/index.html:1289:function buildWho() {
    review/vroid-02/index.html:1331:async function setView(view, clip) {
    review/vroid-02/index.html:1377:function applySkin(meshes) {
    review/vroid-02/index.html:1388:function render() {
    review/vroid-02/index.html:1487:function holdPose(clip, t) {
    review/vroid-02/index.html:1497:function settleCloth() {
    review/vroid-02/index.html:1503:function frameAt(centre, h, tw, th, pitch) {
    review/vroid-02/index.html:1510:async function runSheet(kind) {
    review/vroid-02/index.html:1600:async function loadChecks() {
    review/vroid-02/index.html:1647:function setPanel(open) {
    review/vroid-02/index.html:1695:function frame(now) {
    tools/vroid_portrait.py:78:def role_of(material):
    tools/vroid_portrait.py:85:def bands(v, table):
    tools/vroid_portrait.py:95:def repose(v, prims, ref, target):
    tools/vroid_portrait.py:119:def reduce_blocks(char, depth, pid, role, h, w):
    tools/vroid_portrait.py:143:def camera_rotation(yaw, pitch):
    tools/vroid_portrait.py:152:def smooth(t):
    tools/vroid_portrait.py:173:def bone_pose(v, sh, base_pose):
    tools/vroid_portrait.py:274:def landmarks(prims, roles):
    tools/vroid_portrait.py:329:def sculpt(prims, roles, lm, sh, sigma=0.022):
    tools/vroid_portrait.py:363:def face_texture(prims, roles, v):
    tools/vroid_portrait.py:373:def strip_blush(prims, roles, v, keep):
    tools/vroid_portrait.py:393:def face_normals(prims, roles, lm, amount, hair=0.0, forward=0.0, pull=0.5, neck=None):
    tools/vroid_portrait.py:457:def eye_closure(mo):
    tools/vroid_portrait.py:464:def hide_closed_irises(mo, further=None):
    tools/vroid_portrait.py:482:def eye_lines(prim):
    tools/vroid_portrait.py:509:def painted_span(P, uv, tri, tex, x, half=0.002):
    tools/vroid_portrait.py:524:def lid_gap(P_now, P_unit, P_open, lines, uv, tri, tex):
    tools/vroid_portrait.py:543:def lash_size(P, uv, lines, k):
    tools/vroid_portrait.py:556:def keep_lash_weight(prim, P_open, uv, lines, closure):
    tools/vroid_portrait.py:571:def neck_frame(prims, roles, neck):
    tools/vroid_portrait.py:583:def axis_at(A, u, y):
    tools/vroid_portrait.py:588:def _shadow_card(name, src, P):
    tools/vroid_portrait.py:607:def shadow_cards(prims, roles, lm, amount, neck=None):
    tools/vroid_portrait.py:677:def face_lines(prims, roles, v, amount):
    tools/vroid_portrait.py:812:def mouth_room(v, mo, pose, yaws=(0.0, 30.0, -30.0)):
    tools/vroid_portrait.py:837:def hold_mouth(v, mo, pose):
    tools/vroid_portrait.py:852:def reshape(prims, roles, lm, sh):
    tools/vroid_portrait.py:887:def keep_lash_fan(prims, now, k, lines, closure):
    tools/vroid_portrait.py:905:class Portrait:
    tools/vroid_portrait.py:994:            costume = outfit.COSTUMES[costume] if isinstance(costume, str) else costume
    tools/vroid_portrait.py:1292:def uv_to_3d(prims, uv):
    tools/vroid_portrait.py:1319:def draw_mouth(c, rol, pts):
    tools/vroid_portrait.py:1338:def draw_curve_mouth(c, rol, dep, pts, lip=False, keep=(0.12, 0.88), dark=(0.28, 0.72)):
    tools/vroid_portrait.py:1363:def smooth_view(portrait, yaw=35, pitch=None, palette=None, view="bust", w=None, h=None):
    tools/vroid_portrait.py:1378:def image(char, scale=1, bg=None, palette=None):
    tools/vroid_portrait.py:1392:def main():
    tools/gear.py:44:def shape(build="average", face="plain", **extra):
    tools/gear.py:57:def _bind(fit, pcs, bone):
    tools/gear.py:63:def _group(pcs, g):
    tools/gear.py:70:def helmet(fit, kind="kettle", role="steel", lift=0.030, name="helmet", rivets=True, trim_role=None):
    tools/gear.py:124:def coif(fit, role="mail", name="coif", lift=0.017, face=True):
    tools/gear.py:140:def hood(fit, role="cloth", name="hood", lift=0.022, peak=0.03):
    tools/gear.py:151:def mail_pattern(w, h, ring_px=7, hem=None):
    tools/gear.py:164:def quilted(fit, under, name="gambeson", role="padding", y_neck=None, y_hem=None, flare=0.08, split=10.0,
    tools/gear.py:215:def mail_shirt(fit, under, name="hauberk", role="mail", y_top=None, y_hem=None, sleeve=0.55, flare=0.05):
    tools/gear.py:249:def riveted_vest(fit, under, name="brigandine", role="leather", rivet_role="steel", y_top=None, y_bottom=None):
    tools/gear.py:273:def shield(fit, shape="heater", side="L", role="signature", face_role="heraldry", width=0.46, height=0.62,
    tools/gear.py:311:def _hand_frame(fit, hand="R"):
    tools/gear.py:323:def spear(fit, length=2.0, grip=0.55, head=0.26, hand="R", shaft_role="wood", name="spear"):
    tools/gear.py:337:def axe(fit, haft=0.85, blade=0.24, double=False, hand="R", shaft_role="wood", name="axe", grip=0.18):
    tools/gear.py:356:def dagger(fit, blade=0.24, hand="R", name="dagger"):
    tools/gear.py:367:def staff(fit, length=1.65, hand="R", wood="wood", head_role="gold", name="staff", grip=0.75):
    tools/gear.py:382:def bow(fit, length=1.25, hand="L", name="bow", wood="wood"):
    tools/gear.py:403:def quiver(fit, name="quiver", role="leather"):
    tools/gear.py:421:def robe(fit, under, name="robe", role="signature", trim=0.012, y_hem=None, flare=0.16, split=0.0, sleeve_flare=0.07):
    tools/gear.py:457:def witch_hat(fit, name="hat", role="signature", band_role="gold", height=0.32, brim=0.12, lift=0.034):
    tools/gear.py:484:def puff(fit, side, role="signature", size=1.0, name=None, piping=None, gather=0.48, cap=None, under=None):
    tools/gear.py:637:def _limb_frame(fit, side, Q, limb="arm"):
    tools/gear.py:663:def _let_out(fit, pc, limb, knots, prof, ease, folds=6, toward=0.72, behind=0.15, fold_amp=(0.18, 0.22),
    tools/gear.py:687:def _tuck(fit, pc, covers, limb, gap=0.003, both=False, span=None):
    tools/gear.py:728:def loose_sleeves(fit, shirt, ease=0.030, cuff=0.70, folds=6):
    tools/gear.py:740:def tuck_sleeves(fit, shirt, cuff_pcs, gap=0.003):
    tools/gear.py:745:def _leg_s(fit, y):
    tools/gear.py:753:def flare_boots(fit, boots, y_top, ease=0.010):
    tools/gear.py:761:def breeches(fit, trousers, boots, y_hem, y_boot, ease=0.040, folds=7):
    tools/gear.py:775:def slim_under(fit, trousers, y_hem, pull=0.018, ramp=0.05):
    tools/gear.py:796:def breastplate(fit, under, role="steel", name="breastplate", y_top=None, y_bottom=None, plackart=True, keel=0.008,
    tools/gear.py:832:def scale_pattern(w=256, h=128, cols=8):
    tools/gear.py:847:def skirt_cone(fit, under, y_top, y_hem, flare, cz=None, clear=None, gap=0.012, side=0.0):
    tools/gear.py:898:def scale_skirt(fit, under, y_top, y_hem, role="mail", name="fauld", flare=0.05, split=0.0, share=0.55, clear=None,
    tools/gear.py:913:def pleated_skirt(fit, under, y_top, y_hem, role="signature", name="skirt_pleats", flare=0.09, pleats=26, depth=0.012,
    tools/gear.py:926:def cuffs(fit, role="glove", name="cuff", length=0.38, flare=0.030, lift=0.010):
    tools/gear.py:944:def round_shield(fit, side="L", radius=0.24, wood="wood", rim="steel", name="shield"):
    tools/gear.py:969:def halberd(fit, length=2.1, grip=0.80, hand="R", name="halberd"):
    tools/export_glb.py:26:def group_of(p, role):
    tools/export_glb.py:47:def skin_ramp(h):
    tools/export_glb.py:63:def hex_rgb(h):
    tools/export_glb.py:68:def export(portrait, palette, path, max_tex=512, only_world=False):
    tools/export_glb.py:183:def scene_info(portrait, palette):
    tools/export_glb.py:277:def _quat(R):
    tools/export_glb.py:296:def _trs(m):
    tools/export_glb.py:302:def fill_line_specks(rgba, most=400):
    tools/export_glb.py:319:def fill_lid(rgba, v_edge, close=3):
    tools/export_glb.py:355:def even_mouth(rgba):
    tools/export_glb.py:380:def export_skinned(portrait, palette, path, clips=None, max_tex=512):
    tools/outfit.py:32:def grid_mesh(P):
    tools/outfit.py:41:def piece(name, role, pos, tri, nrm=None, outward_from=None, axis=None):
    tools/outfit.py:59:def thick_grid(P, thickness, outward_from, axis=None):
    tools/outfit.py:90:def frame_axes(a, hint=(0, 1, 0)):
    tools/outfit.py:99:def box(name, role, centre, axes, half):
    tools/outfit.py:113:def tube(name, role, start, axis, length, r0, r1=None, seg=16, rows=2):
    tools/outfit.py:127:def ball(name, role, centre, r, seg=14, rows=8, squash=(1, 1, 1)):
    tools/outfit.py:140:def ribbon(name, role, curve, width=0.006, lift=0.002, normals=None, away=None, closed=False):
    tools/outfit.py:163:class Fit:
    tools/outfit.py:230:def without(pc, bones, max_w=0.3):
    tools/outfit.py:239:def inherit(child, parent):
    tools/outfit.py:246:def near_normals(pc, pts):
    tools/outfit.py:251:def wrap(fit, name, role, bones, offset, min_w=0.5, exclude=(), y_min=None, y_max=None, subdiv=0,
    tools/outfit.py:304:def loop_trim(name, role, garment, pick, width=0.008, lift=0.0015):
    tools/outfit.py:313:def slice_line(pc, axis=0, value=0.0, keep=lambda p: True):
    tools/outfit.py:328:def collar(fit, name, role, height_back=0.044, height_front=0.028, gap_deg=50, clear=(0.009, 0.015),
    tools/outfit.py:355:def pauldron(fit, name, role, over, side="L", lames=((0, 62, 0.012, 0.016), (55, 78, 0.010, 0.013),
    tools/outfit.py:397:def drape(P0, collide, clearance, pinned, steps=90, iters=10, gravity=0.0025, bend=0.25, closed=False):
    tools/outfit.py:445:def cape(fit, name, role, under, length=1.0, phi=0.55, seg=44, rows=18, top_clear=0.003,
    tools/outfit.py:474:def tails(fit, name, role, under, y_top, length=0.36, front_gap=60, seg=40, rows=12, clear=(0.012, 0.030)):
    tools/outfit.py:498:def belt(fit,…2536 tokens truncated…ive to LOWMARCH_VROID.
    Palette chars: hair A-E (dark->light), eyes r s t (dark->light), coat K L M P (dark->light).
    """
    # common enemies share an army palette: the enemy's dark red cloth, worn leather, dull steel
    MOB_COLORS = dict(A="#2a2420", B="#4a3a30", C="#6e5644", D="#92785e", E="#b89c7e",
                      r="#2a1a12", s="#5a4630", t="#8a7050", K="#3a1418", L="#5e2026", M="#7e2a30", P="#a84848")
    MOB_PAINT = dict(signature="#7b3026", doublet="#3a3330", heraldry="#d8cfc0", leather="#5a3e2a", boot="#3e2c22",
                     glove="#4a3426", steel="#9aa0aa", gold="#a88a4a", hair="#4a3a2e", motif="#d8cfc0",
                     padding="#8a7a62", cloth="#4a4038", wood=dict(kind="leather", base="#6a4a30"),
                     mail=dict(kind="steel", base="#8a909a"), fur=dict(kind="leather", base="#6a5444"), linen="#b8ad94",
                     grain=dict(signature=0.03, padding=0.03, fur=0.10))
    
    # generic units vary in hair, eyes and skin (palette letters: hair A-E dark to light, eyes r s t)
    HAIRS = {"brown": ("#2a1d14", "#4a3424", "#6e5038", "#94704e", "#c09a74"),
             "black": ("#141418", "#24242c", "#383844", "#50505e", "#76768a"),
             "blond": ("#6b4a1e", "#a8782e", "#d4a648", "#ecd07a", "#fbf0c0"),
             "red": ("#3a140c", "#6a2414", "#9a3a1e", "#c45a30", "#e8905a"),
             "grey": ("#3a3a3e", "#5e5e64", "#85858c", "#aeaeb4", "#d8d8dc"),
             "auburn": ("#2e1610", "#52281a", "#7a3e26", "#a05a3a", "#c88a62"),
             "blue": ("#1d2a52", "#2c4a8a", "#3f74c0", "#63a3e0", "#a6d8f6")}
    EYES = {"brown": ("#2a1a12", "#5a3a1c", "#9a7040"), "blue": ("#1a2a4a", "#3a6ab0", "#8ac0ec"),
            "green": ("#12321e", "#2e8a4e", "#9edcae"), "grey": ("#2a2e34", "#5a6470", "#a0aab4"),
            "amber": ("#3a2410", "#8a5a20", "#d8a050")}
    SKINS = {"light": None, "fair": "#f4dccb", "tan": "#e3bf9c", "olive": "#d6b08a", "brown": "#b08060",
             "dark": "#8a5e44", "pale": "#f6e6e2",           # the mobs' older tones, kept as they were
             # the skin range (2026-10-30): the lit colour of each tone; tools/export_glb.py skin_ramp derives its shade
             # and deep shade. People, light to deep, undertones in the names:
             "porcelain": "#f9e8e1", "ivory": "#f8e1d5", "peach": "#f4d3bd", "sand": "#e7c3a0", "honey": "#d9aa7d",
             "olive_mid": "#c8a881", "amber": "#c18b5e", "caramel": "#a87047", "chestnut": "#8b5638", "umber": "#6e4129",
             "mahogany": "#5a3122", "ebony": "#432a1f",
             # fantasy
             "drow_ash": "#6d6888", "drow_slate": "#4a4560", "ashen": "#b8b5ad", "orc": "#7e9659", "orc_deep": "#566c3e",
             "sea": "#6f97c3", "infernal": "#b25648"}
    
    
    POLEARMS = ("soldier", "soldier_f")                     # classes that hold their weapon in both hands
    
    
    def mob(model, label, costume, build, face, hair="brown", eyes="brown", skin="light", hair_from=None, hair_trim=None,

    235 more lines not shown.