Files
grass-cutters/ArtSource/Blender/scripts/gc_up_base.py
NiemandKG 88c1ee9202 Base fixes: climb over the railing, hay on the deck, no yard logs, console back, logo T
- Climbing up from the meadow rises straight up the side until the feet clear the
  railing, goes over it and drops onto the deck, instead of an arc through the fence.
- Props stand their lowest point on the floor (the hay bale was half under the deck).
- The timber bay lines on the unloading yard are gone.
- SM_Terminal: the chalkboard's back stands proud of the frame bars, no more
  flickering where their back faces shared a plane.
- Logo: the scythe standing in for the first T of CUTTERS is now a plain T
  (Tools/ui/logo_t.py copies the second T); menu logo, Steam capsules and the
  demo's capsules rebuilt from it.
- -demofix: close shots of those spots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:08:13 +06:00

889 lines
53 KiB
Python

"""GRASS CUTTER - model upgrade, the base: SM_DeckTile, SM_Ladder, SM_Dock.
Same names, pivots, footprints and named children as gc_farm_base.py. Deck surface z = 0, the meadow z = -1.2.
Run (from anywhere):
blender -b --factory-startup --python D:/PROJECTS/LOCAL/GrassCutter/ArtSource/Blender/scripts/gc_up_base.py -- [SM_Name ...]
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import numpy as np
from gc_up_kit import * # noqa: F401,F403
# ======================================================================= deck tile
def fence(alt):
"""Cream post-and-rail along the -Y edge. Corner posts differ in size so two rails sharing a corner never z-fight, and the
E/W rails sit a little higher to lap the N/S rails. The side panels stay clear for the ladders (x = +-1.5)."""
yc, yr, dz = -2.86, -2.955, 0.04 if alt else 0.0
Q = []
for x, w in ((-2.86, 0.15), (-0.95, 0.17), (0.95, 0.17), (2.86, 0.19)):
pts = [(x - w / 2, 0.02), (x + w / 2, 0.02), (x + w / 2, 0.97), (x, 1.05), (x - w / 2, 0.97)]
Q.append(grain(prism("post", pts, "XZ", yc - w / 2, yc + w / 2, CRM, bev=0.012), (0, 0, 1)))
Q.append(plain(x - w / 2 - 0.022, x + w / 2 + 0.022, yc - w / 2 - 0.022, yc + w / 2 + 0.022, 0.0, 0.06, IRON, "shoe"))
Q.append(plain(x - w / 2 - 0.006, x + w / 2 + 0.006, yc - w / 2 - 0.006, yc + w / 2 + 0.006, 0.8, 0.83, IRON, "band"))
Q.append(beam((-2.99, yr, 0.91 + dz), (2.99, yr, 0.91 + dz), 0.055, 0.13, CRM, bev=0.012, name="rail"))
Q.append(beam((-2.99, yr, 0.52 + dz), (2.99, yr, 0.52 + dz), 0.055, 0.12, CRM, bev=0.012, name="rail"))
# X panel in the middle, a kick board under it
for s in (-1, 1):
Q.append(beam((-0.83 * s, -2.905 - 0.01 * s, 0.14), (0.83 * s, -2.905 - 0.01 * s, 0.84), 0.04, 0.09, CRM, bev=0, name="brace"))
Q.append(grain(plain(-0.86, 0.86, -2.935, -2.885, 0.06, 0.15, TIM, "kick"), (1, 0, 0)))
for x in (-0.95, 0.95):
nut(Q, (x, yr - 0.03, 0.91 + dz), (0, -1, 0), r=0.02, h=0.01)
nut(Q, (x, yr - 0.03, 0.52 + dz), (0, -1, 0), r=0.02, h=0.01)
return Q
def deck_tile():
rng = random.Random(41)
P = [plain(-3.0, 3.0, -3.0, 3.0, -0.13, -0.05, IRON, "sub")]
# the boards run to the x edges so they carry on over a tile seam, butts fall on the joists
n, y0 = 16, -2.84
pitch = 5.68 / n
joists = (-2.3, -0.78, 0.78, 2.3)
for i in range(n):
yc = y0 + pitch * (i + 0.5)
cuts = sorted(rng.sample(joists, rng.choice((1, 1, 2))))
xs = [-2.997] + cuts + [2.997]
for a, b in zip(xs, xs[1:]):
m = rng.choice((PK, PK, PK, PK, PKW, PKD))
P.append(plank_x(a + 0.004, b - 0.004, yc, pitch - 0.016, -0.07, -rng.choice((0.0, 0.0, 0.003, 0.006)), m, rng))
# two rim boards, the y edges of the frame
for s in (-1, 1):
y0_, y1_ = sorted((s * 2.84, s * 2.998))
P.append(grain(bx(-2.998, 2.998, y0_, y1_, -0.14, 0.0, TIM, bev=0.012, name="rim"), (1, 0, 0)))
# fascia boards round the frame, iron corner brackets with their bolts
for s in (-1, 1):
x0, x1 = sorted((s * 2.9, s * 2.99))
for z0, z1 in ((-0.27, -0.06), (-0.47, -0.285)):
P.append(grain(bx(x0, x1, -2.9, 2.9, z0, z1, TIM, bev=0.012, name="fasciax"), (0, 1, 0)))
P.append(grain(bx(-2.9, 2.9, x0, x1, z0, z1, TIM, bev=0.012, name="fasciay"), (1, 0, 0)))
for sx in (-1, 1):
for sy in (-1, 1):
P.append(plain(sx * 2.68, sx * 3.0, sy * 2.99, sy * 3.0, -0.46, -0.08, IRON, "bracket"))
P.append(plain(sx * 2.99, sx * 3.0, sy * 2.68, sy * 3.0, -0.46, -0.08, IRON, "bracket"))
for z in (-0.36, -0.18):
nut(P, (sx * 2.84, sy * 3.0, z), (0, sy, 0), r=0.024, h=0.012, m=STL)
nut(P, (sx * 3.0, sy * 2.84, z), (sx, 0, 0), r=0.024, h=0.012, m=STL)
# joists under the boards, two carrying beams on the stilts
for x in joists:
P.append(grain(plain(x - 0.08, x + 0.08, -2.9, 2.9, -0.44, -0.12, TIM, "joist"), (0, 1, 0)))
for y in (-1.85, 1.85):
P.append(grain(bx(-2.6, 2.6, y - 0.16, y + 0.16, -0.68, -0.42, TIM, bev=0.03, name="carrier"), (1, 0, 0)))
# the odd repair: an iron mending plate over a butt, a nailed-on patch board, loose straw
for (x, i) in ((joists[1], 3), (joists[2], 11)):
y = y0 + pitch * (i + 0.5)
P.append(plain(x - 0.13, x + 0.13, y - 0.05, y + 0.05, -0.006, 0.004, IRON, "mend"))
y = y0 + pitch * 7.5
P.append(plank_x(1.05, 1.62, y, pitch - 0.05, -0.02, 0.007, PKW, rng, ch=0.006))
straws(P, (-1.3, -0.6, 0), 5, 0.4, rng)
straws(P, (1.7, 1.5, 0), 4, 0.35, rng)
ffin(P, "Body", ang=35)
# stilts: four tapered posts on fieldstone pads, cross braced
F = []
for x in (-1.85, 1.85):
for y in (-1.85, 1.85):
F.append(grain(cz("stilt", 0.19, -1.25, -0.66, x, y, TIM, v=8, r2=0.16), (0, 0, 1)))
F.append(cz("cap", 0.215, -0.72, -0.66, x, y, IRON, v=8))
F.append(cz("collar", 0.215, -1.12, -1.06, x, y, IRON, v=8))
F.append(rock(0.42, (x, y, -1.24), seed=int(x * y + x * 3 + 9), sc=(1.05, 1.05, 0.34), m="M_Concrete", amp=0.13, name="pad"))
zh, zl = -0.72, -1.1
for s in (-1, 1):
for (d, p0, p1) in ((0.21, -1.68, 1.68), (-0.21, 1.68, -1.68)):
xx = s * 1.85 + d
F.append(beam((xx, p0, zh), (xx, p1, zl), 0.05, 0.13, bev=0.012, name="brace"))
F.append(beam((p0, xx, zh), (p1, xx, zl), 0.13, 0.05, bev=0.012, name="brace"))
for s in (-1, 1):
for t in (-1, 1):
nut(F, (s * 1.85 + 0.235 * t, 0.0, (zh + zl) / 2), (t, 0, 0), r=0.03, h=0.014)
nut(F, (0.0, s * 1.85 + 0.235 * t, (zh + zl) / 2), (0, t, 0), r=0.03, h=0.014)
ffin(F, "Floats", ang=35)
# the fence, one edge per object so DeckTileView can toggle them. Same origins as the old railings
for nm, ang in (("Rail_N", 0), ("Rail_S", 180), ("Rail_E", -90), ("Rail_W", 90)):
Q = xgs(fence(ang in (-90, 90)), rz=math.radians(ang))
o = ffin(Q, nm, uv=0.35, ang=35) # uv 0.35: the worn paint of M_HullWhite reads as patches, not as spots
p = Matrix.Rotation(math.radians(ang), 3, "Z") @ Vector((0, -2.86, 0))
set_origin(o, (round(p.x, 4), round(p.y, 4), 0.0))
return dict(elev=26, azim=-35, man=(0.6, -1.2, 0), views=[("_close", dict(elev=14, azim=-24, dist_mul=0.42, target=(0.9, -2.0, 0.3))), ("_low", dict(elev=-10, azim=-30, dist_mul=0.8))])
# ======================================================================= ladder
def ladder():
"""Hangs off the deck edge (y = 0): stringers just outside the fence, grab rails passing between its two rails onto the deck."""
P = []
y = -0.145
for s in (-1, 1):
x = s * 0.26
pts = [(x - 0.055, -2.16), (x + 0.055, -2.16), (x + 0.055, 0.9), (x + s * 0.02, 0.92), (x - 0.055, 0.88 if s > 0 else 0.9)]
P.append(grain(prism("stringer", pts, "XZ", -0.2, -0.09, TIM, bev=0.014), (0, 0, 1)))
P.append(beam((x, -0.14, 0.74), (x, 0.42, 0.74), 0.07, 0.08, bev=0.016, name="grab"))
P.append(grain(bx(x - 0.04, x + 0.04, 0.38, 0.46, 0.02, 0.78, TIM, bev=0.014, name="grabpost"), (0, 0, 1)))
P.append(plain(x - 0.09, x + 0.09, 0.33, 0.51, 0.0, 0.03, IRON, "foot"))
for dy in (-0.055, 0.055):
nut(P, (x + 0.06, 0.42 + dy, 0.03), (0, 0, 1), r=0.016, h=0.01, m=STL)
nut(P, (x - 0.06, 0.42 + dy, 0.03), (0, 0, 1), r=0.016, h=0.01, m=STL)
# iron hook over the deck edge, stand-off against the fascia, bands
P.append(ptube("hook", rpath([(x, 0.16, 0.012), (x, -0.02, 0.012), (x, -0.02, -0.2), (x, -0.09, -0.2)], 0.04, 2), 0.02, IRON, segs=5))
P.append(plain(x - 0.04, x + 0.04, -0.1, 0.0, -0.36, -0.28, TIM, "stand"))
P.append(plain(x - 0.064, x + 0.064, -0.209, -0.081, 0.02, 0.08, IRON, "band"))
P.append(plain(x - 0.064, x + 0.064, -0.209, -0.081, -1.2, -1.14, IRON, "band"))
# round rungs through the stringers, lashed with rope. One was snapped and replaced with a sawn board
z = -0.4
k = 0
while z > -1.75:
if k == 2:
P.append(grain(bx(-0.345, 0.345, y - 0.075, y - 0.03, z - 0.05, z + 0.05, PKD, bev=0.008, name="srung"), (1, 0, 0)))
for sx in (-0.26, 0.26):
nut(P, (sx, y - 0.075, z), (0, -1, 0), r=0.014, h=0.008, m=STL)
else:
P.append(grain(cx("rung", 0.04, -0.34 + 0.01 * k, 0.34, y, z, TIM, v=6), (1, 0, 0)))
for s in (-1, 1):
rope_turns(P, (s * 0.26, y, z), 0.08, n=2, r=0.013, seg=6, step=0.03)
k += 1
z -= 0.3
P.append(beam((-0.3, 0.13, 0.74), (0.3, 0.13, 0.74), 0.07, 0.07, bev=0.016, name="bar"))
# red paint on the stringer tops so the way down reads from across the deck, rope grips where a hand lands, a back tie between the stringers
for s in (-1, 1):
x = s * 0.26
P.append(plain(x - 0.059, x + 0.059, -0.204, -0.086, 0.7, 0.84, PRED, "paint"))
P.append(plain(x - 0.043, x + 0.043, -0.1, -0.09, 0.2, 0.32, IRON, "strap"))
for z in (0.52, 0.55, 0.58, 0.61):
P.append(torus("grip", 0.08, 0.012, (x, -0.145, z), "Z", seg=6, rseg=3, m=ROPE))
P.append(grain(bx(-0.34, 0.34, -0.09, -0.05, -0.08, 0.06, PKD, bev=0.008, name="backtie"), (1, 0, 0)))
# a frayed rope end left hanging
P.append(ptube("frayed", [(0.33, y, -0.42), (0.345, y - 0.02, -0.56), (0.335, y - 0.015, -0.68)], 0.011, ROPE, segs=4))
ffin(P, "Body", ang=35)
return dict(elev=18, azim=-55, views=[("_close", dict(elev=10, azim=-30, dist_mul=0.5, target=(0, 0, 0.1)))])
# ======================================================================= dock: the loading ramp
def ramp():
"""Loading ramp from the deck edge (y = 0, z = 0) down to the meadow (y = -6, z = -1.2). Same slope, length and width as before:
its colliders (RampDeck, RampCurbL/R) are hard-coded in ProjectBuilder.Scene."""
rng = random.Random(23)
L, W = 6.12, 3.0
th = math.asin(0.2)
F = [] # built flat, then tilted down as a whole
for x in (-0.82, 0.0, 0.82):
F.append(grain(plain(x - 0.08, x + 0.08, -L, -0.02, -0.32, -0.07, TIM, "stringer"), (0, 1, 0)))
F.append(plain(-W / 2 + 0.1, W / 2 - 0.1, -L, -0.02, -0.12, -0.075, IRON, "pan"))
y = -L
k = 0
while y < -0.2:
y1 = min(y + 0.29, -0.18)
m = rng.choice((PK, PK, PK, PKW, PKD))
j0, j1 = rng.uniform(0.0, 0.05), rng.uniform(0.0, 0.05)
F.append(plank_x(-W / 2 + 0.11 + j0, W / 2 - 0.11 - j1, (y + y1 - 0.016) / 2, y1 - y - 0.022, -0.09, -rng.choice((0.0, 0.0, 0.004)), m, rng))
# livestock cleats: every third board has a batten nailed across so hooves and boots grip
if k % 3 == 1:
F.append(grain(bx(-W / 2 + 0.14, W / 2 - 0.14, y + 0.09, y + 0.15, -0.004, 0.024, TIM, bev=0.008, name="cleat"), (1, 0, 0)))
for x in (-0.82, 0.0, 0.82):
nut(F, (x, y + 0.12, 0.024), (0, 0, 1), r=0.016, h=0.008, m=STL)
k += 1
y += 0.29
# a tin patch over a board that gave way
F.append(plain(0.28, 0.72, -3.42, -3.08, -0.002, 0.008, TIN, "patch"))
for (x, yy) in ((0.31, -3.39), (0.69, -3.39), (0.31, -3.11), (0.69, -3.11)):
nut(F, (x, yy, 0.008), (0, 0, 1), r=0.012, h=0.006, m=STL)
for sx in (-1, 1):
x0, x1 = sorted((sx * (W / 2 - 0.12), sx * W / 2))
F.append(grain(bx(x0, x1, -L, 0.0, -0.32, 0.1, TIM, bev=0.018, name="curb"), (0, 1, 0)))
xc = sx * (W / 2 - 0.06)
for yy in (-1.0, -3.0, -5.0):
pts = [(yy - 0.06, 0.08), (yy + 0.06, 0.08), (yy + 0.06, 0.55), (yy, 0.62), (yy - 0.06, 0.55)]
F.append(grain(prism("rpost", pts, "YZ", xc - 0.06, xc + 0.06, CRM, bev=0.01), (0, 0, 1)))
F.append(plain(xc - 0.066, xc + 0.066, yy - 0.066, yy + 0.066, 0.42, 0.47, IRON, "rband"))
F.append(plain(xc - 0.07, xc + 0.07, yy - 0.07, yy + 0.07, 0.08, 0.14, IRON, "rshoe"))
nut(F, (sx * 1.5, yy, -0.1), (sx, 0, 0), r=0.03, h=0.008)
# rope handrail sagging between the posts
for (a, b) in ((-1.0, -3.0), (-3.0, -5.0)):
pts = [(xc, a + (b - a) * t / 6, 0.5 - 0.14 * (1 - (2 * t / 6 - 1) ** 2)) for t in range(7)]
F.append(ptube("rrope", pts, 0.017, ROPE, segs=5))
# iron threshold at the top, iron lip at the bottom
F.append(plain(-W / 2 + 0.12, W / 2 - 0.12, -0.18, 0.0, -0.06, 0.008, IRON, "thresh"))
for x in (-1.0, -0.33, 0.33, 1.0):
nut(F, (x, -0.09, 0.008), (0, 0, 1), r=0.02, h=0.01, m=STL)
F.append(bx(-W / 2 + 0.12, W / 2 - 0.12, -L - 0.3, -L + 0.02, -0.04, 0.0, IRON, bev=0.01, name="lip"))
for o in F:
xg(o, rx=th)
P = list(F)
# legs down to the ground, cross braced
z_at = lambda yy: yy * math.tan(th)
for yy in (-2.0, -4.0):
z = z_at(yy) - 0.1
for sx in (-1, 1):
P.append(grain(bx(sx * 1.3 - 0.09, sx * 1.3 + 0.09, yy - 0.09, yy + 0.09, -1.3, z - 0.16, TIM, bev=0.018, name="leg"), (0, 0, 1)))
P.append(rock(0.3, (sx * 1.3, yy, -1.3), seed=int(yy * sx + 20), sc=(1.05, 1.05, 0.34), amp=0.12, name="pad"))
P.append(grain(bx(-1.42, 1.42, yy - 0.05, yy + 0.05, z - 0.3, z - 0.14, TIM, bev=0.014, name="cross"), (1, 0, 0)))
z = z_at(-2.0) - 0.1
P.append(beam((-1.2, -2.08, z - 0.3), (1.2, -2.08, -1.2), 0.05, 0.11, bev=0.012, name="xbrace"))
P.append(beam((1.2, -1.92, z - 0.3), (-1.2, -1.92, -1.2), 0.05, 0.11, bev=0.012, name="xbrace"))
# the side trusses: a raking strut up from each leg, iron straps where they meet the curb, hay-gold end caps on the curbs
for sx in (-1, 1):
xs = sx * 1.4
P.append(beam((xs, -2.0, -1.22), (xs, -3.3, z_at(-3.3) - 0.3), 0.05, 0.11, bev=0.012, name="strut"))
P.append(beam((xs, -4.0, -1.22), (xs, -2.75, z_at(-2.75) - 0.3), 0.05, 0.11, bev=0.012, name="strut"))
P.append(beam((xs, -2.0, -1.22), (xs, -0.75, z_at(-0.75) - 0.3), 0.05, 0.11, bev=0.012, name="strut"))
for yy in (-3.05, -0.8):
nut(P, (sx * 1.43, yy, z_at(yy) - 0.33), (sx, 0, 0), r=0.03, h=0.012)
cap = plain(sx * 1.37, sx * 1.51, -L - 0.01, -L + 0.28, -0.33, 0.11, GOLD, "curbcap")
P.append(xg(cap, rx=th))
# straw trodden into the boards
S = []
straws(S, (-0.4, -1.6, 0), 4, 0.4, rng)
straws(S, (0.5, -4.6, 0), 4, 0.45, rng)
for o in S:
xg(o, rx=th, t=(0, 0, 0.012))
P += S
ffin(P, "Body", ang=35)
return dict(elev=26, azim=-50, man=(-0.6, -2.4, -0.5), views=[("_close", dict(elev=16, azim=-20, dist_mul=0.42, target=(0.5, -3.0, -0.3))), ("_side", dict(elev=4, azim=-90, dist_mul=0.9))])
# ======================================================================= crew cabin
def uvbox(o, s=0.5, off=(0, 0)):
"""Box-projected at scale s and kept: 0.5 gives M_BarnRed / M_HullWhite boards about 29 cm wide."""
uv_box(o, s, off)
return uv_keep(o)
def tin_slope(P, x0, x1, ya, za, yb, zb, n=6, t=0.03, rusty=(), lift=0.008):
"""Lapped sheets of tin from the eave (ya, za) up to (yb, zb), every other sheet lifted so the laps cast a line."""
w = (x1 - x0) / n
for k in range(n):
xa, xb = x0 + k * w - (0.02 if k else 0), x0 + (k + 1) * w + (0.02 if k < n - 1 else 0)
dz = lift * (k % 2)
a, b, c, d = (xa, ya, za + dz), (xb, ya, za + dz), (xb, yb, zb + dz), (xa, yb, zb + dz)
if ya > yb:
a, b, c, d = d, c, b, a
m = "M_TinOld" if k in rusty else TIN
P.append(uv_keep_slope(board(a, b, c, d, t, m, bev=0, along="ad", name="sheet"), (a, d)))
def heart(cx_, cz_, s, y0, y1, m=IRON):
pts = [(0, -1.0), (0.9, 0.05), (0.72, 0.62), (0.3, 0.72), (0, 0.42), (-0.3, 0.72), (-0.72, 0.62), (-0.9, 0.05)]
return prism("heart", [(cx_ + a * s, cz_ + b * s) for a, b in pts], "XZ", y0, y1, m)
def window(P, x, y, z, w=1.0, h=1.1, rz=0.0, shutters=True, flowers=False, curtains=True, rng=None, seed=3):
"""Cream window built facing -Y then turned about Z: gingham curtains tied back behind the glazing bars, heart shutters, a window box."""
rng = rng or random.Random(seed)
fw = 0.075
iw, ih = w / 2 - fw, h / 2 - fw
Q = [plain(-w / 2, w / 2, -0.02, 0.01, -h / 2, h / 2, "M_WindowGlass", "pane")]
for sx in (-1, 1):
Q.append(grain(plain(sx * w / 2, sx * iw, -0.07, 0.01, -h / 2, h / 2, CRM, "jamb"), (0, 0, 1)))
for sz in (-1, 1):
Q.append(grain(plain(-w / 2, w / 2, -0.075, 0.01, sz * h / 2, sz * ih, CRM, "head"), (1, 0, 0)))
Q.append(grain(plain(-0.018, 0.018, -0.052, -0.022, -ih, ih, CRM, "bar"), (0, 0, 1)))
Q.append(grain(plain(-iw, iw, -0.052, -0.022, -0.018, 0.018, CRM, "bar"), (1, 0, 0)))
Q.append(grain(plain(-w / 2 - 0.07, w / 2 + 0.07, -0.13, 0.01, -h / 2 - 0.05, -h / 2 + 0.01, CRM, "sill"), (1, 0, 0)))
Q.append(grain(plain(-w / 2 - 0.06, w / 2 + 0.06, -0.11, 0.01, h / 2 - 0.01, h / 2 + 0.05, CRM, "lintel"), (1, 0, 0)))
if curtains:
for sx in (-1, 1):
e, m_ = sx * iw, sx * 0.02
tie = -ih * 0.25
pts = [(e, ih), (m_, ih), (m_ + sx * iw * 0.12, ih * 0.45), (e - sx * iw * 0.42, tie + 0.03), (e - sx * iw * 0.5, tie - 0.05), (e - sx * iw * 0.3, -ih * 0.6), (e - sx * iw * 0.2, -ih), (e, -ih)]
if sx > 0:
pts = list(reversed(pts))
Q.append(uvbox(prism("curtain", pts, "XZ", -0.03, -0.024, "M_Fabric"), 3.0))
Q.append(plain(e, e - sx * iw * 0.5, -0.036, -0.03, tie - 0.05, tie - 0.02, RED, "tie"))
val = [(-iw, ih), (iw, ih)]
n = 6
for k in range(n + 1):
val.append((iw - 2 * iw * k / n, ih - (0.13 if k % 2 == 0 else 0.09)))
Q.append(uvbox(prism("valance", val, "XZ", -0.034, -0.028, "M_Fabric"), 3.0))
if shutters:
for sx in (-1, 1):
x0, x1 = sorted((sx * (w / 2 + 0.01), sx * (w / 2 + 0.33)))
xm = (x0 + x1) / 2
Q.append(grain(plain(x0, x1, -0.055, 0.0, -h / 2 + 0.02, h / 2 - 0.02, GRN, "shut"), (0, 0, 1)))
Q.append(plain(x0 - 0.002, x1 + 0.002, -0.066, -0.05, h / 2 - 0.16, h / 2 - 0.09, GRN, "ledge"))
Q.append(plain(x0 - 0.002, x1 + 0.002, -0.066, -0.05, -h / 2 + 0.09, -h / 2 + 0.16, GRN, "ledge"))
Q.append(heart(xm, h * 0.12, 0.062, -0.061, -0.05))
if flowers:
z0, z1 = -h / 2 - 0.25, -h / 2 - 0.06
Q.append(grain(bx(-w / 2 - 0.02, w / 2 + 0.02, -0.28, -0.03, z0, z1, RED, bev=0.01, name="wbox"), (1, 0, 0)))
Q.append(plain(-w / 2 + 0.02, w / 2 - 0.02, -0.26, -0.05, z1 - 0.03, z1 + 0.012, "M_Soil", "wsoil"))
for k in range(2):
Q.append(plain(-0.03 + 0.5 * (k * 2 - 1) * w * 0.7, 0.03 + 0.5 * (k * 2 - 1) * w * 0.7, -0.05, -0.02, z0 - 0.06, z0 + 0.0, IRON, "bracket"))
nf = max(4, int(w / 0.17))
for k in range(nf):
xx = -w / 2 + 0.1 + (w - 0.2) * k / (nf - 1)
yy = -0.155 + rng.uniform(-0.05, 0.05)
Q.append(rock(0.075, (xx, yy, z1 + 0.05), seed=k + 2, sc=(1, 1, 0.8), m=rng.choice((LEAF, LEAFD)), amp=0.15, name="foliage"))
Q.append(rock(0.036, (xx + rng.uniform(-0.03, 0.03), yy - 0.03, z1 + 0.1 + rng.uniform(0, 0.03)), seed=k, m=rng.choice((PRED, GOLD, INK, PRED)), amp=0.1, name="bloom"))
xgs(Q, rz=math.radians(rz), t=(x, y, z))
P += Q
def crew_cabin():
"""The bunkhouse: red board-and-batten on a stone skirt, a tin roof that sweeps down over a covered porch, a dormer with the GreenHaul
plaque, curtains and heart shutters. The scene keeps a box of 5.8 x 3.2 x 3.8 m around the origin, door toward -Y."""
rng = random.Random(5)
P = []
HW, YF, YB, YR, ZR = 2.62, -0.72, 1.82, 0.55, 4.0
slope = lambda y: ZR - abs(y - YR) # the 45 degree main roof
# walls, stone skirt
pts = [(YF, 0.2), (YB, 0.2), (YB, slope(YB) - 0.02), (YR, ZR - 0.05), (YF, slope(YF) - 0.02)]
P.append(uvbox(prism("walls", pts, "YZ", -HW, HW, RED)))
P.append(uvbox(bx(-HW - 0.07, HW + 0.07, YF - 0.07, YB + 0.07, 0.0, 0.32, "M_RockWet", bev=0.018, name="skirt"), 0.8))
# battens over the board seams
for k in range(8):
x = -2.59 + 0.37 + k * 0.74
for y, s in ((YF, -1), (YB, 1)):
P.append(grain(plain(x - 0.024, x + 0.024, y, y + s * 0.022, 0.32, slope(y), RED, "batten"), (0, 0, 1)))
for k in range(5):
y = YF + 0.25 + k * 0.51
for s in (-1, 1):
P.append(grain(plain(s * HW, s * (HW + 0.022), y - 0.024, y + 0.024, 0.32, slope(y) - 0.02, RED, "batten"), (0, 0, 1)))
# cream corner boards
for sx in (-1, 1):
for y, s in ((YF, -1), (YB, 1)):
P.append(grain(plain(sx * (HW + 0.03), sx * (HW - 0.13), y, y + s * 0.03, 0.3, slope(y), CRM, "corner"), (0, 0, 1)))
P.append(grain(plain(sx * HW, sx * (HW + 0.03), y + s * 0.03, y - s * 0.14, 0.3, slope(y) - 0.1, CRM, "corner"), (0, 0, 1)))
# roof: tin sheets, two rust-brown replacements. The front slope sweeps on over the porch at a shallower pitch
YE, ZE = YB + 0.15, slope(YB + 0.15)
YK, ZK = YF - 0.14, slope(YF - 0.14)
YP, ZP = -1.97, 2.2
tin_slope(P, -2.9, 2.9, YE, ZE, YR, ZR, n=7, rusty=(5,))
tin_slope(P, -2.9, 2.9, YK, ZK, YR, ZR, n=7, rusty=(1,))
tin_slope(P, -2.9, 2.9, YP, ZP, YK + 0.03, ZK + 0.015, n=7, rusty=(4,))
P.append(prism("ridge", [(YR - 0.15, ZR - 0.13), (YR, ZR + 0.035), (YR + 0.15, ZR - 0.13), (YR + 0.15, ZR - 0.09), (YR, ZR + 0.075), (YR - 0.15, ZR - 0.09)], "YZ", -2.93, 2.93, STL))
for sx in (-1, 1):
x = sx * 2.92
P.append(beam((x, YE - 0.02, ZE - 0.05), (x, YR, ZR - 0.03), 0.06, 0.17, CRM, bev=0, name="barge"))
P.append(beam((x, YK, ZK - 0.05), (x, YR, ZR - 0.03), 0.06, 0.17, CRM, bev=0, name="barge"))
P.append(beam((x, YP - 0.02, ZP - 0.05), (x, YK, ZK - 0.05), 0.06, 0.15, CRM, bev=0, name="barge"))
P.append(grain(plain(-2.95, 2.95, YP - 0.04, YP - 0.01, ZP - 0.15, ZP + 0.025, CRM, "fascia"), (1, 0, 0)))
P.append(grain(plain(-2.95, 2.95, YE + 0.01, YE + 0.04, ZE - 0.17, ZE + 0.02, CRM, "fascia"), (1, 0, 0)))
# rafters under the porch roof, and their tails along the back eave
for k in range(9):
x = -2.76 + k * 0.69
P.append(beam((x, YP + 0.04, ZP - 0.07), (x, YF, ZK - 0.08), 0.07, 0.11, bev=0, name="rafter"))
# gutter along the porch eave, with a downpipe into the rain barrel
P.append(cx("gutter", 0.05, -2.85, 2.85, YP - 0.06, ZP - 0.04, TIN, v=6))
P.append(ptube("downpipe", rpath([(2.72, YP - 0.06, ZP - 0.06), (2.72, -1.86, ZP - 0.24), (2.72, -1.86, 1.2), (2.5, -1.55, 0.95)], 0.08, 2), 0.04, TIN, segs=6))
# porch: floor, posts with knee brackets, beam, cream pickets
y0_ = -1.9
for k in range(5):
yc = y0_ + 0.118 + k * 0.236
cut = rng.uniform(-1.6, 1.8)
for a, b in ((-2.86, cut), (cut, 2.86)):
P.append(plank_x(a + 0.004, b - 0.004, yc, 0.222, 0.08, 0.2, rng.choice((PK, PK, PKW, PKD)), rng))
P.append(grain(bx(-2.88, 2.88, -1.95, -1.88, 0.0, 0.19, TIM, bev=0.012, name="pfascia"), (1, 0, 0)))
for sx in (-1, 1):
P.append(grain(bx(sx * 2.8, sx * 2.88, -1.9, YF, 0.0, 0.19, TIM, bev=0.012, name="pfascia"), (0, 1, 0)))
for x in (-2.7, -0.26, 1.36, 2.7):
P.append(grain(bx(x - 0.075, x + 0.075, -1.855, -1.705, 0.2, 2.1, CRM, bev=0.02, name="ppost"), (0, 0, 1)))
P.append(plain(x - 0.095, x + 0.095, -1.875, -1.685, 0.2, 0.32, CRM, "pbase"))
P.append(plain(x - 0.095, x + 0.095, -1.875, -1.685, 1.98, 2.06, CRM, "pcap"))
for s in (-1, 1):
if abs(x + s * 0.3) > 2.75:
continue
kn = [(0, 0), (0.4, 0), (0.33, -0.05), (0.18, -0.12), (0.05, -0.29), (0, -0.4)]
kp = [(x + s * (0.07 + a), 2.08 + b) for a, b in kn]
P.append(grain(prism("knee", kp if s > 0 else list(reversed(kp)), "XZ", -1.81, -1.75, CRM), (1, 0, 0)))
P.append(grain(bx(-2.8, 2.8, -1.86, -1.7, 2.08, 2.24, CRM, bev=0.016, name="pbeam"), (1, 0, 0)))
for (a, b) in ((-2.62, -0.34), (1.44, 2.62)):
for z, hh in ((0.98, 0.05), (0.36, 0.035)):
P.append(grain(plain(a, b, -1.815, -1.745, z - hh, z + hh, CRM, "prail"), (1, 0, 0)))
n = int((b - a) / 0.2)
for k in range(n):
x = a + (b - a) * (k + 0.5) / n
P.append(grain(plain(x - 0.028, x + 0.028, -1.792, -1.768, 0.39, 0.93, CRM, "picket"), (0, 0, 1)))
for sx in (-1, 1):
x = sx * 2.7
for z, hh in ((0.98, 0.05), (0.36, 0.035)):
P.append(grain(plain(x - 0.035, x + 0.035, -1.7, YF, z - hh, z + hh, CRM, "prail"), (0, 1, 0)))
for k in range(5):
y = -1.62 + k * 0.19
P.append(grain(plain(x - 0.012, x + 0.012, y - 0.028, y + 0.028, 0.39, 0.93, CRM, "picket"), (0, 0, 1)))
# two steps up to the door
P.append(grain(bx(-0.02, 1.12, -2.0, -1.84, 0.0, 0.1, TIM, bev=0.014, name="step"), (1, 0, 0)))
for x in (-0.02, 1.12):
P.append(plain(x - 0.03, x + 0.03, -2.0, -1.88, 0.0, 0.1, IRON, "stepshoe"))
# the door: 1.0 x 1.86 m, tractor green boards with a little curtained window, strap hinges
DX0, DX1, YD = 0.05, 1.05, YF
for x0, x1 in ((DX0 - 0.1, DX0), (DX1, DX1 + 0.1)):
P.append(grain(plain(x0, x1, YD - 0.07, YD + 0.01, 0.2, 2.14, CRM, "jamb"), (0, 0, 1)))
P.append(grain(bx(DX0 - 0.15, DX1 + 0.15, YD - 0.1, YD + 0.01, 2.14, 2.26, CRM, bev=0.016, name="dhead"), (1, 0, 0)))
bw = (DX1 - DX0) / 4
for k in range(4):
P.append(grain(plain(DX0 + k * bw + 0.004, DX0 + (k + 1) * bw - 0.004, YD - 0.03, YD + 0.005, 0.2, 2.13, GRN, "dboard"), (0, 0, 1)))
for z in (0.34, 1.15):
P.append(grain(plain(DX0 + 0.01, DX1 - 0.01, YD - 0.05, YD - 0.028, z - 0.05, z + 0.05, GRN, "dledge"), (1, 0, 0)))
P.append(beam((DX0 + 0.08, YD - 0.04, 0.42), (DX1 - 0.08, YD - 0.04, 1.08), 0.09, 0.022, GRN, bev=0, name="dbrace"))
DC = (DX0 + DX1) / 2
P.append(plain(DC - 0.27, DC + 0.27, YD - 0.04, YD - 0.028, 1.38, 1.92, "M_WindowGlass", "dpane"))
for sz, (z0, z1) in zip((0, 1), ((1.34, 1.4), (1.9, 1.96))):
P.append(plain(DC - 0.32, DC + 0.32, YD - 0.058, YD - 0.028, z0, z1, CRM, "dframe"))
for sx in (-1, 1):
P.append(plain(sx * 0.32 + DC, sx * 0.26 + DC, YD - 0.058, YD - 0.028, 1.34, 1.96, CRM, "dframe"))
P.append(plain(DC - 0.012, DC + 0.012, YD - 0.054, YD - 0.04, 1.4, 1.9, CRM, "dbar"))
P.append(plain(DC - 0.26, DC + 0.26, YD - 0.054, YD - 0.04, 1.64, 1.664, CRM, "dbar"))
P.append(uvbox(plain(DC - 0.26, DC + 0.26, YD - 0.045, YD - 0.04, 1.72, 1.9, "M_Fabric", "dcurtain"), 3.0))
for z in (0.46, 1.78):
P.append(plain(DX0 - 0.02, DX0 + 0.42 if z < 1 else DX0 + 0.22, YD - 0.058, YD - 0.046, z - 0.022, z + 0.022, IRON, "hinge"))
nut(P, (DX0 + 0.14, YD - 0.058, z), (0, -1, 0), r=0.014, h=0.008, m=STL)
P.append(plain(DX1 - 0.18, DX1 - 0.09, YD - 0.04, YD - 0.028, 0.94, 1.14, IRON, "latch"))
P.append(sphere("knob", 0.036, (DX1 - 0.135, YD - 0.075, 1.04), seg=8, rings=5, m="M_Brass"))
# a lucky horseshoe over the door, a burlap mat, a lantern on a bracket, a broom left out
shoe = [(DC + math.cos(a) * 0.085, YD - 0.105, 2.2 + math.sin(a) * 0.1 - 0.02) for a in [math.radians(-40 + 260 * k / 8) for k in range(9)]]
P.append(ptube("shoe", shoe, 0.014, IRON, segs=4))
P.append(uv_wall(plain(DC - 0.42, DC + 0.42, -1.5, -0.86, 0.2, 0.212, BUR, "mat")))
P.append(ptube("larm", rpath([(1.32, YD - 0.02, 1.98), (1.32, YD - 0.2, 1.98), (1.32, YD - 0.2, 1.86)], 0.03, 2), 0.014, IRON, segs=5))
P.append(lantern(P, 1.32, YD - 0.2, 1.6, m="M_Emissive", r=0.06))
P.append(beam((-0.18, YD - 0.1, 0.2), (-0.1, YD - 0.04, 1.5), 0.03, 0.03, bev=0, name="broom"))
P.append(cyl_between("bristle", (-0.17, YD - 0.1, 0.42), (-0.19, YD - 0.11, 0.2), 0.035, STRAW, v=6, r2=0.11))
# windows
window(P, -1.5, YF, 1.36, w=1.15, h=1.12, flowers=True, seed=4)
window(P, 2.0, YF, 1.4, w=0.66, h=0.98, shutters=False, seed=5)
window(P, -1.3, YB, 1.36, w=1.0, h=1.05, rz=180, seed=6)
window(P, 1.3, YB, 1.36, w=1.0, h=1.05, rz=180, seed=7)
window(P, -HW, 0.55, 1.36, w=0.92, h=1.05, rz=-90, flowers=True, seed=8)
window(P, HW, 0.55, 1.36, w=0.92, h=1.05, rz=90, seed=9)
window(P, -HW, 0.55, 2.92, w=0.5, h=0.56, rz=-90, shutters=False, curtains=False)
window(P, HW, 0.55, 2.92, w=0.5, h=0.56, rz=90, shutters=False, curtains=False)
# dormer over the door with the GreenHaul plaque
D0, D1 = DC - 0.6, DC + 0.6
P.append(uvbox(prism("dormer", [(D0, 2.7), (D1, 2.7), (D1, 3.25), (DC, 3.64), (D0, 3.25)], "XZ", -0.66, 0.4, RED)))
roof_ridge_y(P, DC - 0.74, DC + 0.74, -0.8, 0.42, 3.13, 3.74, m=TIN, t=0.03)
for s in (-1, 1):
P.append(beam((DC + s * 0.74, -0.81, 3.1), (DC, -0.81, 3.71), 0.05, 0.13, CRM, bev=0.008, name="dbarge"))
P.append(grain(bx(DC - 0.36, DC + 0.36, -0.7, -0.66, 2.8, 3.44, CRM, bev=0.01, name="plaque"), (0, 0, 1)))
for sx in (-1, 1):
for z in (2.84, 3.4):
nut(P, (DC + sx * 0.32, -0.7, z), (0, -1, 0), r=0.014, h=0.008)
P.append(uv_keep(rig_quad("logo", (DC - 0.3, -0.705, 2.83), (DC + 0.3, -0.705, 2.83), (DC + 0.3, -0.705, 3.43), (DC - 0.3, -0.705, 3.43), "M_Logo")))
# stove pipe through the front slope, hat, stays
px, py = 2.0, 0.05
zf = slope(py)
P.append(cz("flash", 0.2, zf - 0.08, zf + 0.06, px, py, IRON, v=10, r2=0.1))
P.append(cz("stove", 0.085, zf, zf + 1.02, px, py, IRON, v=10))
for z in (zf + 0.34, zf + 0.72):
P.append(cz("sband", 0.094, z, z + 0.04, px, py, STL, v=10))
P.append(cz("hatstem", 0.03, zf + 1.0, zf + 1.1, px, py, IRON, v=6))
P.append(cz("hat", 0.2, zf + 1.09, zf + 1.22, px, py, TIN, v=10, r2=0.03))
for (dx, dy) in ((-0.55, -0.25), (0.45, -0.3), (0.0, 0.5)):
P.append(cyl_between("stay", (px, py, zf + 0.8), (px + dx, py + dy, slope(py + dy) + 0.03), 0.007, IRON, v=4))
# little arrow vane at the far end of the ridge
vx = -2.1
P.append(cz("vmast", 0.016, ZR, ZR + 0.56, vx, YR, IRON, v=6))
P.append(beam((vx - 0.3, YR, ZR + 0.44), (vx + 0.3, YR, ZR + 0.44), 0.012, 0.02, IRON, bev=0, name="varrow"))
P.append(prism("vhead", [(vx - 0.42, ZR + 0.44), (vx - 0.27, ZR + 0.52), (vx - 0.27, ZR + 0.36)], "XZ", YR - 0.008, YR + 0.008, IRON))
P.append(prism("vtail", [(vx + 0.22, ZR + 0.44), (vx + 0.36, ZR + 0.53), (vx + 0.36, ZR + 0.35)], "XZ", YR - 0.008, YR + 0.008, PRED))
# a CREW board nailed to the porch rail
sx0, sx1 = -1.95, -0.95
P.append(grain(bx(sx0, sx1, -1.85, -1.815, 0.48, 0.82, RED, bev=0.008, name="crewsign"), (1, 0, 0)))
for x in (sx0 + 0.06, sx1 - 0.06):
nut(P, (x, -1.85, 0.76), (0, -1, 0), r=0.014, h=0.008)
sign_text(P, "CREW", 0.2, INK, ((sx0 + sx1) / 2, -1.853, 0.64))
# porch dressing from the pack, scaled to a 1.3 m crew
S = 0.72
P.append(pack_part("SM_Prop_Chair_Rocking_01", (-2.05, -1.2, 0.2), rz=PI + 0.45, scale=S))
for k, (x, z) in enumerate(((1.62, 0.28), (1.82, 0.28), (2.02, 0.28), (2.22, 0.28), (1.72, 0.45), (1.92, 0.45), (2.12, 0.45))):
P.append(grain(cyl_between("log", (x, -1.12 + 0.02 * (k % 3), z), (x, -0.8, z), 0.098, TIM, v=6), (0, 1, 0)))
P.append(grain(revm("rbarrel", [(0.2, 0.2), (0.25, 0.42), (0.265, 0.6), (0.25, 0.8), (0.21, 0.98), (0.17, 0.98), (0.2, 0.62), (0, 0.86)], TIM, segs=10, loc=(2.44, -1.5, 0)), (0, 0, 1)))
for z, r in ((0.4, 0.252), (0.8, 0.255)):
P.append(cz("rhoop", r, z - 0.02, z + 0.02, 2.44, -1.5, IRON, v=10, cap=False))
P.append(pack_part("SM_Prop_Tool_Bucket_01", (1.62, -1.5, 0.2), rz=0.3, scale=0.8))
ffin(P, "Body", ang=35, ms={CRM: 0.4})
return dict(elev=20, azim=-32, man=(0.55, -2.3, 0), views=[
("_front", dict(elev=8, azim=-8, dist_mul=0.72)), ("_close", dict(elev=10, azim=-14, dist_mul=0.42, target=(0.2, -1.6, 1.2))),
("_back", dict(elev=22, azim=150)), ("_far", dict(elev=8, azim=-40, dist_mul=2.6))])
# ======================================================================= terminal: the upgrade stand
def xm(o, M):
"""Bake a matrix into a part, its grain hint with it."""
apply_xform(o)
o.data.transform(M)
o.data.update()
if o.get("grain") is not None:
grain(o, M.to_3x3() @ Vector(o["grain"]))
return o
def cog(R=0.07, t=0.02, n=8, m=STL):
"""A little gear, lying flat."""
pts = []
for k in range(n * 2):
a = PI * k / n
rr = R if k % 2 == 0 else R * 0.74
pts.append((rr * math.cos(a - PI / n * 0.3), rr * math.sin(a - PI / n * 0.3)))
pts.append((rr * math.cos(a + PI / n * 0.3), rr * math.sin(a + PI / n * 0.3)))
return prism("cog", pts, "XY", -t / 2, t / 2, m)
def terminal():
"""The GreenHaul upgrade stand. The solid box of the scene is 1.2 x 0.9 x 1.8, the board keeps the corners of the old Screen exactly."""
rng = random.Random(8)
P = []
# plank counter on a timber frame: cream boards with real gaps over a dark back
P.append(plain(-0.5, 0.5, -0.29, 0.36, 0.1, 0.92, IRON, "cback"))
n = 7
for k in range(n):
x = -0.49 + (k + 0.5) * 0.98 / n
P.append(grain(plain(x - 0.064, x + 0.064, -0.325, -0.29, 0.12 + rng.uniform(0, 0.02), 0.93, CRM, "cboard"), (0, 0, 1)))
for s in (-1, 1):
for k in range(5):
y = -0.27 + (k + 0.5) * 0.62 / 5
P.append(grain(plain(s * 0.5, s * 0.535, y - 0.056, y + 0.056, 0.12, 0.93, CRM, "cboard"), (0, 0, 1)))
for x in (-0.54, 0.54):
for y in (-0.34, 0.38):
P.append(grain(bx(x - 0.055, x + 0.055, y - 0.055, y + 0.055, 0.0, 0.94, TIM, bev=0.016, name="cpost"), (0, 0, 1)))
P.append(plain(x - 0.062, x + 0.062, y - 0.062, y + 0.062, 0.0, 0.06, IRON, "cshoe"))
for y in (-0.345, 0.385):
P.append(grain(bx(-0.5, 0.5, y - 0.03, y + 0.03, 0.05, 0.15, TIM, bev=0.012, name="rail"), (1, 0, 0)))
# the top: three thick boards with a nosing, iron corners
for k in range(3):
y0 = -0.45 + k * 0.298
P.append(plank_x(-0.6, 0.6, y0 + 0.146, 0.288, 0.92, 1.0, (PK, PKD, PK)[k], rng, ch=0.014))
for sx in (-1, 1):
P.append(plain(sx * 0.6, sx * 0.485, -0.455, -0.335, 0.915, 1.004, IRON, "ccorner"))
# uprights, back brace
for x in (-0.52, 0.52):
P.append(grain(bx(x - 0.05, x + 0.05, 0.04, 0.14, 0.98, 1.85, TIM, bev=0.016, name="upright"), (0, 0, 1)))
P.append(grain(bx(x - 0.036, x + 0.036, -0.446, -0.374, 0.98, 1.79, TIM, bev=0.012, name="fpost"), (0, 0, 1)))
P.append(grain(bx(-0.47, 0.47, 0.01, 0.07, 1.3, 1.4, TIM, bev=0.012, name="brace"), (1, 0, 0)))
for y, z in ((-0.42, 1.79), (0.09, 1.83)):
P.append(grain(bx(-0.57, 0.57, y - 0.045, y + 0.045, z - 0.07, z + 0.03, TIM, bev=0.012, name="purlin"), (1, 0, 0)))
# striped market awning: red and cream boards falling to the front, each ending in a scalloped tab
S, w = 8, 1.24 / 8
for k in range(S):
x0, x1 = -0.62 + k * w, -0.62 + (k + 1) * w
m = RED if k % 2 == 0 else CRM
pts = [(-0.54, 1.815), (0.47, 1.875), (0.47, 1.91), (-0.54, 1.85)]
P.append(grain(prism("aw", pts, "YZ", x0 + 0.002, x1 - 0.002, m), (0, 1, 0.06)))
xc = (x0 + x1) / 2
tab = [(x0 + 0.004, 1.82), (x1 - 0.004, 1.82), (x1 - 0.004, 1.76), (xc + 0.04, 1.72), (xc, 1.71), (xc - 0.04, 1.72), (x0 + 0.004, 1.76)]
P.append(grain(prism("tab", tab, "XZ", -0.552, -0.54, m), (0, 0, 1)))
# the chalkboard, tilted back 15 degrees. Its Screen below is the old quad, so the frame and lettering sit around the same corners
H = M4((-15, 0, 0), (0, -0.02, 1.4))
# its back stands 6 mm proud of the frame bars so the two back faces never share a plane (they flickered from behind)
Hd = [bx(-0.4, 0.4, -0.08, -0.024, -0.27, 0.27, TIM, bev=0.008, name="backboard")]
for sz in (-1, 1):
Hd.append(grain(bx(-0.4, 0.4, -0.115, -0.03, min(sz * 0.2, sz * 0.27), max(sz * 0.2, sz * 0.27), RED, bev=0.012, name="cframe"), (1, 0, 0)))
for sx in (-1, 1):
Hd.append(grain(bx(min(sx * 0.33, sx * 0.4), max(sx * 0.33, sx * 0.4), -0.115, -0.03, -0.2, 0.2, RED, bev=0.012, name="cframe"), (0, 0, 1)))
Hd.append(grain(plain(-0.36, 0.36, -0.155, -0.09, -0.285, -0.255, TIM, "ctray"), (1, 0, 0)))
Hd.append(cx("chalk", 0.009, 0.16, 0.24, -0.125, -0.243, INK, v=5))
Hd.append(cx("chalk", 0.009, -0.22, -0.16, -0.125, -0.243, PRED, v=5))
ys = -0.103
head = text("chalkhead", "UPGRADES", 0.085, INK)
orient(head, "-Y", (0.0, ys - 0.004, 0.125))
Hd.append(head)
for k, (x0, x1, z) in enumerate(((-0.27, 0.04, 0.03), (0.14, 0.27, 0.03), (-0.27, -0.02, -0.05), (0.14, 0.27, -0.05), (-0.27, 0.08, -0.13), (0.14, 0.27, -0.13))):
Hd.append(plain(x0, x1, ys - 0.006, ys - 0.002, z - 0.009, z + 0.009, INK if k % 2 == 0 else GOLD, "chalkline"))
for o in Hd:
xm(o, H)
P += Hd
# on the counter: a brass bell, an open ledger with a pencil, a crate of spare cogs, an oil can
P.append(revm("bell", [(0, 1.0), (0.055, 1.0), (0.055, 1.016), (0.042, 1.044), (0.022, 1.07), (0.0, 1.082)], "M_Brass", segs=8, loc=(0.02, -0.34, 0)))
P.append(cz("bellknob", 0.011, 1.07, 1.1, 0.02, -0.34, "M_Brass", v=6))
lb = [plain(-0.17, 0.0, -0.11, 0.11, 0.0, 0.016, GRN, "lcover"), plain(0.0, 0.17, -0.11, 0.11, 0.0, 0.016, GRN, "lcover"),
plain(-0.16, -0.003, -0.1, 0.1, 0.016, 0.034, CRM, "lpage"), plain(0.003, 0.16, -0.1, 0.1, 0.016, 0.032, CRM, "lpage")]
for k in range(4):
y = -0.07 + k * 0.045
lb.append(plain(-0.14, -0.03, y, y + 0.008, 0.034, 0.0355, IRON, "linel"))
lb.append(plain(0.03, 0.14 - 0.02 * (k % 2), y, y + 0.008, 0.032, 0.0335, IRON, "liner"))
lb.append(grain(cx("pencil", 0.007, 0.02, 0.17, 0.0, 0.042, GOLD, v=5), (1, 0, 0)))
xgs(lb, rz=0.14, t=(-0.33, -0.27, 1.0))
P += lb
cx_, cy_ = 0.36, -0.28
P.append(plain(cx_ - 0.16, cx_ + 0.16, cy_ - 0.11, cy_ + 0.11, 1.0, 1.02, TIM, "crateb"))
for s in (-1, 1):
for z in (1.02, 1.09):
P.append(plain(cx_ - 0.17, cx_ + 0.17, cy_ + s * 0.112 - 0.01, cy_ + s * 0.112 + 0.01, z, z + 0.055, TIM, "crates"))
P.append(plain(cx_ + s * 0.16 - 0.012, cx_ + s * 0.16 + 0.012, cy_ - 0.12, cy_ + 0.12, 1.0, 1.15, TIM, "crateh"))
for (dx, dy, dz, rx_, ry_, rr, m) in ((-0.07, -0.02, 1.1, 0.5, 0.2, 0.07, STL), (0.05, 0.03, 1.12, -0.4, 0.3, 0.055, "M_Brass"), (0.0, -0.05, 1.07, 0.1, -0.2, 0.06, IRON)):
P.append(xf(cog(R=rr, t=0.022, m=m), rx=rx_, ry=ry_, t=(cx_ + dx, cy_ + dy, dz)))
P.append(revm("oilcan", [(0, 1.0), (0.075, 1.0), (0.075, 1.09), (0.03, 1.15), (0.016, 1.17), (0, 1.17)], PRED, segs=8, loc=(0.16, 0.0, 0)))
P.append(cyl_between("spout", (0.2, 0.0, 1.11), (0.31, -0.02, 1.26), 0.011, STL, v=5, r2=0.005))
# lantern under the awning, a spanner hanging from the right post, GreenHaul plaques
P.append(ptube("lhook", rpath([(-0.556, -0.41, 1.66), (-0.67, -0.41, 1.66), (-0.67, -0.41, 1.58)], 0.03, 2), 0.009, IRON, segs=4))
P.append(lantern(P, -0.67, -0.41, 1.33, m="M_Emissive", r=0.05))
P.append(cyl_between("peg", (0.556, -0.41, 1.5), (0.6, -0.41, 1.5), 0.01, IRON, v=4))
sp = [plain(-0.012, 0.012, -0.018, 0.0, -0.17, 0.0, STL, "span"), plain(-0.04, -0.012, -0.018, 0.0, -0.21, -0.15, STL, "span"), plain(0.012, 0.04, -0.018, 0.0, -0.21, -0.15, STL, "span"),
torus("spring", 0.02, 0.008, (0, -0.009, 0.0), "Y", seg=6, rseg=3, m=STL)]
xgs(sp, rz=PI / 2, t=(0.596, -0.405, 1.47))
P += sp
P.append(grain(bx(-0.3, 0.3, -0.352, -0.325, 0.26, 0.86, RED, bev=0.008, name="plaque"), (1, 0, 0)))
yl = -0.355
P.append(uv_keep(rig_quad("logo", (-0.26, yl, 0.3), (0.26, yl, 0.3), (0.26, yl, 0.82), (-0.26, yl, 0.82), "M_Logo")))
xl = -0.547
P.append(plain(xl, xl + 0.012, -0.24, 0.3, 0.24, 0.78, RED, "plaque2"))
P.append(uv_keep(rig_quad("logo", (xl - 0.003, 0.27, 0.28), (xl - 0.003, -0.21, 0.28), (xl - 0.003, -0.21, 0.76), (xl - 0.003, 0.27, 0.76), "M_Logo")))
for sx in (-1, 1):
for z in (0.29, 0.83):
nut(P, (sx * 0.27, -0.352, z), (0, -1, 0), r=0.012, h=0.008)
ffin(P, "Body", ang=35, ms={CRM: 0.45, RED: 0.5})
# Screen: UV 0..1 exactly over the board, same corners as ever
corners = [H @ Vector(c) for c in ((-0.32, ys, -0.2), (0.32, ys, -0.2), (0.32, ys, 0.2), (-0.32, ys, 0.2))]
sc = rig_quad("Screen", *[tuple(c) for c in corners], "M_Charcoal")
set_origin(sc, tuple(sum(corners, Vector()) / 4))
return dict(elev=16, azim=-35, man=(0.95, -0.9, 0), views=[("_close", dict(elev=12, azim=-18, dist_mul=0.55, target=(0, -0.3, 1.25))), ("_back", dict(elev=20, azim=150)), ("_far", dict(elev=8, azim=-40, dist_mul=2.6))])
# ======================================================================= supply wall: the crew's tool wall
MODELS = common.MODELS.replace("\\", "/") + "/"
WALL_TOOLS = (("NailScissors", 0.5), ("GardenShears", 0.8), ("Sickle", 0.24), ("Scythe", 0.46), ("LongScythe", 0.52), ("WideScythe", 0.6), ("Hammer", 0.7))
WALL_Y, WALL_Z = -0.14, 0.9 # hung at Unity local (1.8 - 0.6 i, 0.9, 0.14), see SupplyWallPiece in ProjectBuilder.Scene.cs
def hang(v, i, s):
"""A tool's vertex in wall space. The FBX bakes the axis conversion and the scene turns the tool -90 about X, so tool -Y (forward) points up."""
return (-(1.8 - 0.6 * i) + s * v[0], WALL_Y + s * v[2], WALL_Z - s * v[1])
def tool_tris(name):
"""Triangles of a tool FBX, as an n x 3 x 3 array in its Blender space."""
before, mats0, imgs0 = set(bpy.data.objects), set(bpy.data.materials), set(bpy.data.images)
bpy.ops.import_scene.fbx(filepath=MODELS + "SM_Tool_" + name + ".fbx")
new = [o for o in bpy.data.objects if o not in before]
bpy.context.view_layer.update()
T = []
for o in new:
if o.type != "MESH":
continue
me = o.data
me.calc_loop_triangles()
co = [o.matrix_world @ v.co for v in me.vertices]
T += [[tuple(co[k]) for k in t.vertices] for t in me.loop_triangles]
for o in new:
d = o.data if o.type == "MESH" else None
bpy.data.objects.remove(o)
if d is not None and d.users == 0:
bpy.data.meshes.remove(d)
for m_ in [m_ for m_ in bpy.data.materials if m_ not in mats0]:
bpy.data.materials.remove(m_) # mat() reuses a material by name, and these point at images that did not load
for im in [im for im in bpy.data.images if im not in imgs0]:
bpy.data.images.remove(im)
return np.array(T)
def silhouette(xz, cell=0.01, grow=0.025):
"""Outer outline of 2D triangles (m x 3 x 2): raster, dilate, trace with the filled side on the left. Returns a counter-clockwise (x, z) loop."""
o = xz.reshape(-1, 2).min(0) - (grow + 3 * cell)
n = ((xz.reshape(-1, 2).max(0) + grow + 3 * cell - o) / cell).astype(int) + 2
M = np.zeros((n[0], n[1]), dtype=bool)
gx, gz = np.meshgrid(o[0] + (np.arange(n[0]) + 0.5) * cell, o[1] + (np.arange(n[1]) + 0.5) * cell, indexing="ij")
for a, b, c in xz:
i0, j0 = np.floor((np.minimum(np.minimum(a, b), c) - o) / cell).astype(int)
i1, j1 = np.ceil((np.maximum(np.maximum(a, b), c) - o) / cell).astype(int) + 1
X, Z = gx[i0:i1, j0:j1], gz[i0:i1, j0:j1]
d0 = (b[0] - a[0]) * (Z - a[1]) - (b[1] - a[1]) * (X - a[0])
d1 = (c[0] - b[0]) * (Z - b[1]) - (c[1] - b[1]) * (X - b[0])
d2 = (a[0] - c[0]) * (Z - c[1]) - (a[1] - c[1]) * (X - c[0])
M[i0:i1, j0:j1] |= ((d0 >= 0) & (d1 >= 0) & (d2 >= 0)) | ((d0 <= 0) & (d1 <= 0) & (d2 <= 0))
r = int(round(grow / cell))
D = M.copy()
for di in range(-r, r + 1):
for dj in range(-r, r + 1):
if di * di + dj * dj <= r * r:
D |= np.roll(np.roll(M, di, 0), dj, 1)
nxt = {}
F = np.pad(D, 1)
for i, j in zip(*np.nonzero(D)):
i_, j_ = i + 1, j + 1
if not F[i_, j_ - 1]:
nxt.setdefault((i, j), []).append((i + 1, j))
if not F[i_ + 1, j_]:
nxt.setdefault((i + 1, j), []).append((i + 1, j + 1))
if not F[i_, j_ + 1]:
nxt.setdefault((i + 1, j + 1), []).append((i, j + 1))
if not F[i_ - 1, j_]:
nxt.setdefault((i, j + 1), []).append((i, j))
loops = []
while nxt:
s = next(iter(nxt))
L, p = [], s
while True:
L.append(p)
q = nxt[p].pop()
if not nxt[p]:
del nxt[p]
p = q
if p == s:
break
loops.append(L)
L = max(loops, key=len)
return [(float(o[0] + a * cell), float(o[1] + b * cell)) for a, b in L]
def simplify(pts, tol=0.009):
"""Douglas-Peucker on a closed loop."""
P_ = np.array(pts)
def dp(a, b):
A, B = P_[a], P_[b]
idx = np.arange(a + 1, b)
if len(idx) == 0:
return []
d = B - A
L = max(np.hypot(*d), 1e-9)
e = np.abs(d[0] * (P_[idx, 1] - A[1]) - d[1] * (P_[idx, 0] - A[0])) / L
k = int(np.argmax(e))
if e[k] < tol:
return []
m = int(idx[k])
return dp(a, m) + [m] + dp(m, b)
far = int(np.argmax(np.hypot(*(P_ - P_[0]).T)))
keep = [0] + dp(0, far) + [far] + dp(far, len(pts) - 1) + [len(pts) - 1]
return [tuple(P_[k]) for k in keep[:-1]]
def stroke(name, loop, w, y, m):
"""A painted line along a closed (x, z) loop, one sided toward -Y: quads only, so concave outlines need no triangulating."""
ip = inset(loop, w)
bm = bmesh.new()
o_ = [bm.verts.new((a, y, b)) for a, b in loop]
i_ = [bm.verts.new((a, y, b)) for a, b in ip]
n = len(loop)
for k in range(n):
j = (k + 1) % n
bm.faces.new((o_[k], o_[j], i_[j], i_[k]))
o = mesh_obj(name, bm)
set_mats(o, m)
return uv_wall(o)
def peg_dots(xs, zs, y, r, m):
"""Peg holes in one mesh, flat hexagons facing -Y (4 tris each)."""
bm = bmesh.new()
for x in xs:
for z in zs:
v = [bm.verts.new((x + r * math.cos(k * PI / 3), y, z + r * math.sin(k * PI / 3))) for k in range(6)]
bm.faces.new(v)
o = mesh_obj("pegs", bm)
set_mats(o, m)
return uv_wall(o)
def peg(P, x, z, y0=0.02, y1=-0.2, r=0.012):
"""A hook: washer on the board, a peg out, the tip turned up."""
P.append(cy("washer", 0.026, y0 - 0.008, y0, x, z, STL, v=6))
P.append(ptube("hook", [(x, y0, z), (x, y1, z), (x, y1 - 0.02, z + 0.035)], r, IRON, segs=4))
def supply_wall():
"""The shadow board: a recessed green pegboard in a timber frame, a cream outline traced from each real tool, pegs for it to hang on, a lean-to roof.
The board stands at y = +0.02 because the Long Scythe reaches y = +0.006. The tools alone use the face above the shelf: nothing else is fixed there."""
rng = random.Random(31)
P = []
XO, XI, YF, YB, YP = 2.27, 2.13, -0.15, 0.15, 0.02
ZD, ZH = 0.46, 2.06 # top of the dado, underside of the header
# sill on two iron shoes, corner posts through to the roof
P.append(grain(bx(-XO, XO, YF - 0.02, YB + 0.02, 0.0, 0.1, TIM, bev=0.016, name="sill"), (1, 0, 0)))
for s in (-1, 1):
P.append(grain(bx(min(s * XI, s * XO), max(s * XI, s * XO), YF, YB, 0.1, 2.62, TIM, bev=0.018, name="post"), (0, 0, 1)))
P.append(plain(s * (XI - 0.012), s * (XO + 0.012), YF - 0.012, YF + 0.16, 0.1, 0.26, IRON, "shoe"))
for z in (0.16, 0.2):
nut(P, (s * 2.2, YF - 0.012, z), (0, -1, 0), r=0.016, h=0.008, m=STL)
# red board dado under the shelf, a capping rail
for k in range(3):
z0 = 0.1 + k * 0.12
P.append(grain(plain(-XI, XI, YF + 0.03, YF + 0.06, z0 + 0.003, z0 + 0.117, RED, "dado"), (1, 0, 0)))
P.append(grain(bx(-XI, XI, YF + 0.01, YP, ZD, ZD + 0.05, TIM, bev=0.01, name="capping"), (1, 0, 0)))
# the green pegboard: boards with real gaps on a dark back, a skin of red boards behind
P.append(plain(-XI, XI, YP + 0.012, YP + 0.024, ZD, ZH, IRON, "back"))
nb = 14
bw = 2 * XI / nb
for k in range(nb):
x = -XI + bw * k
P.append(grain(plain(x + 0.004, x + bw - 0.004, YP, YP + 0.012, ZD, ZH, GRN, "pegboard"), (0, 0, 1)))
P.append(uvbox(plain(-XI, XI, YB - 0.03, YB, 0.1, 2.66, RED, "skin")))
for s in (-1, 1):
P.append(beam((s * XI, YB + 0.01, 0.2), (s * 0.1, YB + 0.01, 2.36), 0.09, 0.03, bev=0, name="backbrace"))
P.append(peg_dots([-XI + bw / 4 + bw / 2 * k for k in range(nb * 2)], [0.6 + 0.16 * k for k in range(10)], YP - 0.0025, 0.0125, IRON))
# the header over the tools, cream, with the TOOLS sign bolted on
P.append(grain(bx(-XI, XI, YF + 0.02, YF + 0.06, ZH, 2.6, CRM, bev=0.01, name="header"), (1, 0, 0)))
P.append(grain(bx(-XI, XI, YF, YF + 0.06, ZH - 0.03, ZH + 0.05, TIM, bev=0.01, name="headrail"), (1, 0, 0)))
SY = YF - 0.03
P.append(grain(bx(-0.92, 0.92, SY, YF + 0.02, 2.14, 2.45, RED, bev=0.01, name="sign"), (1, 0, 0)))
for z in (2.17, 2.42):
P.append(plain(-0.88, 0.88, SY - 0.004, SY, z - 0.009, z + 0.009, INK, "signline"))
sign_text(P, "TOOLS", 0.21, INK, (0, SY - 0.004, 2.295))
for sx in (-1, 1):
for z in (2.2, 2.39):
nut(P, (sx * 0.86, SY, z), (0, -1, 0), r=0.014, h=0.008)
# each tool's outline, traced from the model as it hangs, and two pegs that cradle it where it is narrow
for i, (nm, s) in enumerate(WALL_TOOLS):
T = tool_tris(nm)
W = np.array([hang(v, i, s) for v in T.reshape(-1, 3)]).reshape(-1, 3, 3)
loop = simplify(silhouette(W[:, :, [0, 2]]))
P.append(stroke("outline", loop, 0.014, YP - 0.005, INK))
zs = W[:, :, 2]
z0, z1 = zs.min(), zs.max()
best = None
for zc in np.linspace(z0 + 0.3 * (z1 - z0), z0 + 0.72 * (z1 - z0), 9):
hit = W[(zs.min(1) <= zc) & (zs.max(1) >= zc)][:, :, 0]
if len(hit) and (best is None or hit.max() - hit.min() < best[0]):
best = (hit.max() - hit.min(), float(zc), float(hit.min()), float(hit.max()))
_, zc, xa, xb = best
peg(P, xa - 0.018, zc)
peg(P, xb + 0.018, zc)
print(f"[SM_SupplyWall] {nm:13s} outline {len(loop)} pts, pegs at z {zc:.2f}, x {xa - 0.018:.2f} / {xb + 0.018:.2f}")
# the little shelf, under the tools, on three brackets
sx0, sx1, sz = -0.95, 1.05, 0.56
P.append(plank_x(sx0, sx1, -0.11, 0.2, sz - 0.04, sz, PK, rng, ch=0.01))
P.append(plain(sx0, sx1, -0.222, -0.208, sz - 0.03, sz + 0.03, TIM, "shelflip"))
for x in (-0.8, 0.05, 0.9):
P.append(prism("bracket", [(0.0, sz - 0.04), (-0.19, sz - 0.04), (0.0, sz - 0.24)], "YZ", x - 0.012, x + 0.012, IRON))
# oil cans and rags, all under z 0.8 so the tools clear them
P.append(revm("oilcan", [(0, sz), (0.075, sz), (0.08, sz + 0.012), (0.08, sz + 0.1), (0.032, sz + 0.155), (0.018, sz + 0.175), (0, sz + 0.175)], PRED, segs=8, loc=(-0.62, -0.11, 0)))
P.append(cyl_between("spout", (-0.55, -0.11, sz + 0.1), (-0.4, -0.14, sz + 0.235), 0.011, STL, v=5, r2=0.005))
P.append(ptube("canhandle", [(-0.69, -0.11, sz + 0.13), (-0.76, -0.11, sz + 0.13), (-0.77, -0.11, sz + 0.05), (-0.7, -0.11, sz + 0.03)], 0.008, IRON, segs=4))
P.append(revm("tincan", [(0, sz), (0.07, sz), (0.07, sz + 0.15), (0.058, sz + 0.165), (0.058, sz + 0.15), (0, sz + 0.15)], TIN, segs=8, loc=(-0.26, -0.1, 0)))
P.append(cz("tinlabel", 0.072, sz + 0.04, sz + 0.11, -0.26, -0.1, GOLD, v=8, cap=False))
P.append(revm("oiler", [(0, sz), (0.05, sz), (0.05, sz + 0.05), (0.012, sz + 0.1), (0.006, sz + 0.19), (0, sz + 0.19)], "M_Brass", segs=6, loc=(-0.06, -0.14, 0)))
P.append(uvbox(rock(0.11, (0.3, -0.1, sz + 0.05), seed=3, sc=(1.25, 0.8, 0.5), m="M_Fabric", amp=0.14, name="ragpile"), 3.0))
P.append(uvbox(rock(0.08, (0.32, -0.13, sz + 0.105), seed=5, sc=(1.15, 0.8, 0.4), m=RED, amp=0.14, name="ragtop"), 1.0))
P.append(uvbox(plain(0.62, 0.84, -0.21, -0.02, sz, sz + 0.008, "M_Fabric", "rag"), 3.0))
P.append(uvbox(plain(0.62, 0.84, -0.232, -0.222, sz - 0.2, sz + 0.036, "M_Fabric", "rag"), 3.0))
P.append(uvbox(plain(0.62, 0.84, -0.232, -0.2, sz + 0.03, sz + 0.038, "M_Fabric", "rag"), 3.0))
# a coil of rope hung on the dado under the tools, a lantern on the left post
cx_, cz_ = 1.22, 0.28
peg(P, cx_, cz_ + 0.13, y0=-0.12, y1=-0.2)
for k in range(3):
P.append(torus("coil", 0.15 - k * 0.008, 0.016, (cx_ + 0.004 * k, -0.145 - k * 0.024, cz_), "Y", seg=10, rseg=3, m=ROPE))
P.append(ptube("ropeend", [(cx_ - 0.13, -0.17, cz_ - 0.09), (cx_ - 0.15, -0.19, cz_ - 0.16)], 0.012, ROPE, segs=4))
P.append(ptube("larm", rpath([(-2.2, YF, 1.98), (-2.2, YF - 0.2, 1.98), (-2.2, YF - 0.2, 1.87)], 0.03, 2), 0.013, IRON, segs=4))
P.append(lantern(P, -2.2, YF - 0.2, 1.62, m="M_Emissive", r=0.05))
# at its feet: a bucket and a sack of feed
P.append(pack_part("SM_Prop_Tool_Bucket_01", (1.62, -0.34, 0.0), rz=0.5, scale=0.85))
sack(P, (-1.5, -0.34, 0.0), r=0.15, h=0.32, rz=0.7)
# the lean-to: high at the back, a tin roof over the tools, on rafters and knee braces
ZB, ZE, YE = 2.72, 2.58, -0.52
tin_slope(P, -2.36, 2.36, YE, ZE, YB + 0.05, ZB, n=6, rusty=(4,))
k_ = (ZB - ZE) / (YB + 0.05 - YE)
roofz = lambda y: ZE + (y - YE) * k_
for x in (-2.2, -1.32, -0.44, 0.44, 1.32, 2.2):
P.append(beam((x, YE + 0.03, roofz(YE + 0.03) - 0.075), (x, YB, roofz(YB) - 0.075), 0.08, 0.1, bev=0, name="rafter"))
for s in (-1, 1):
P.append(beam((s * 2.2, YF, 2.04), (s * 2.2, YE + 0.1, roofz(YE + 0.1) - 0.12), 0.08, 0.09, bev=0, name="knee"))
P.append(beam((s * 2.36, YE, ZE - 0.03), (s * 2.36, YB + 0.05, ZB - 0.03), 0.05, 0.12, CRM, bev=0, name="barge"))
P.append(grain(plain(-2.39, 2.39, YE - 0.03, YE, ZE - 0.1, ZE + 0.02, CRM, "fascia"), (1, 0, 0)))
ffin(P, "Body", ang=35, ms={CRM: 0.4})
return dict(elev=12, azim=-28, man=(0.15, -1.0, 0), views=[("_bare", dict(elev=6, azim=-4, dist_mul=0.72)), ("_side", dict(elev=8, azim=-88)), ("_back", dict(elev=16, azim=150))])
BUILDERS = {"SM_DeckTile": deck_tile, "SM_Ladder": ladder, "SM_Dock": ramp, "SM_CrewCabin": crew_cabin, "SM_Terminal": terminal, "SM_SupplyWall": supply_wall}
BUDGET = {"SM_DeckTile": 5000, "SM_Ladder": 2000, "SM_Dock": 5000, "SM_CrewCabin": 8000, "SM_Terminal": 4500, "SM_SupplyWall": 6000}
if __name__ == "__main__":
build_main(BUILDERS, BUDGET)