Files
grass-cutters/ArtSource/Blender/scripts/gc_props.py
NiemandKG d1c3761e58 Grass Cutters Together: the project as of moon-sweepers f3666f0
A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and
Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date.
Images, audio, models and binaries go through Git LFS (.gitattributes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:44:40 +06:00

408 lines
20 KiB
Python

"""GRASS CUTTER - cargo + props that replace the sea set: hay bale (SM_Barrel), herb sack (SM_Canister), the field hemp plant
(SM_Hemp, drawn instanced by GrassField), potted hemp (SM_Decor_Palm), scarecrows (SM_Buoy out in the meadow,
SM_Decor_Lifebuoy on the deck) and the loading ramp (SM_Dock).
Conventions as os_decor.py: meters, Z-up, front = -Y. Cargo origin = centre; everything else origin = bottom centre.
SM_Hemp: 1.0 m tall, unit footprint (the shader scales it by the current grass height). Stalk faces sample the small
stalk patch in the corner of T_HempLeaf (u, v < 0.058); leaf cards use the whole texture.
Run (from project root):
blender -b --factory-startup --python ArtSource/Blender/scripts/gc_props.py -- [SM_Barrel SM_Hemp ...]
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from os_decor import * # noqa: F401,F403 (common helpers + bx/cy/rod/rev/softbox/decal/finalize/...)
import os_decor as D
D.DECAL_MATS = ("M_Label", "M_Logo", "M_HempCard") # uv_keep must not box-project the leaf cards
_join0 = join
def join(objs, name):
"""os_decor.join with one UV layer named UVMap on every part (mixed names split UVs on join)."""
objs = [o for o in objs if o is not None]
for o in objs:
me = o.data
if not me.uv_layers:
me.uv_layers.new(name="UVMap")
act = me.uv_layers.active or me.uv_layers[0]
for l in [l for l in me.uv_layers if l.name != act.name]:
me.uv_layers.remove(l)
me.uv_layers[0].name = "UVMap"
return _join0(objs, name)
PATCH = 0.03 # centre of the stalk patch in T_HempLeaf (UV)
def set_uv(o, fn):
"""Per-loop UV from fn(vertex_co, face) -> (u, v)."""
me = o.data
if not me.uv_layers:
me.uv_layers.new(name="UVMap")
uvl = me.uv_layers.active.data
for p in me.polygons:
for li in p.loop_indices:
uvl[li].uv = fn(me.vertices[me.loops[li].vertex_index].co, p)
return o
def leaf_card(name, base, yaw, pitch, length, width, bend=0.25, m="M_HempCard"):
"""Bent quad strip (2 quads) carrying the whole leaf texture: v = 0 at the stem end, u across.
pitch = angle above horizontal (deg), bend = how much the tip droops (fraction of length)."""
bm = bmesh.new()
uvl = bm.loops.layers.uv.verify()
rows = []
for k, t in enumerate((0.0, 0.5, 1.0)):
y = -length * t
z = -bend * length * t * t
rows.append([bm.verts.new((-width / 2, y, z)), bm.verts.new((width / 2, y, z))])
for k in range(2):
a, b = rows[k], rows[k + 1]
f = bm.faces.new((a[0], a[1], b[1], b[0]))
for l, uv in zip(f.loops, ((0, k * 0.5), (1, k * 0.5), (1, k * 0.5 + 0.5), (0, k * 0.5 + 0.5))):
l[uvl].uv = uv
o = mesh_obj(name, bm)
set_mats(o, m)
xf(o, rot=(-pitch, 0, 0))
xf(o, rot=(0, 0, yaw), loc=base)
return o
# ======================================================================= cargo
def hay_bale():
R, H = 0.26, 0.3
prof = [(0.0, -H), (0.2, -H), (0.238, -H + 0.008), (0.256, -H + 0.03), (R, -H + 0.07), (R + 0.006, 0.0),
(R, H - 0.07), (0.256, H - 0.03), (0.238, H - 0.008), (0.2, H), (0.0, H)]
body = rev("bale", prof, "M_Hay", segs=28, close_top=False)
wobble(body, 0.008, 9.0, seed=2.0)
D.uv_cyl(body, 2, 2.4, 1.6)
P = [body]
# end faces: a darker straw swirl (concentric layers)
for s in (-1, 1):
for k, rr in enumerate((0.17, 0.1, 0.04)):
ring = torus("swirl", rr, 0.012, loc=(0, 0, s * (H - 0.002)), seg=20, rseg=4, m="M_Straw")
P.append(ring)
# twine bands
for z in (-0.17, 0.17):
P.append(torus("twine", R + 0.008, 0.009, loc=(0, 0, z), seg=28, rseg=5, m="M_Twine"))
# loose straw sticking out
rnd = random.Random(5)
for k in range(14):
a = rnd.uniform(0, TAU)
z = rnd.choice((-1, 1)) * rnd.uniform(H - 0.06, H - 0.01)
p0 = Vector((math.cos(a) * (R - 0.01), math.sin(a) * (R - 0.01), z))
d = Vector((math.cos(a + rnd.uniform(-0.6, 0.6)), math.sin(a + rnd.uniform(-0.6, 0.6)), rnd.uniform(-0.4, 0.4) * (1 if z > 0 else -1))).normalized()
P.append(rod(p0, p0 + d * rnd.uniform(0.05, 0.1), 0.004, "M_Straw", verts=3))
b = join(P, "SM_Barrel_body")
# GreenHaul label band between the twine (UV 0..1 around)
lab = cyl("label", R + 0.0075, 0.18, (0, 0, 0), verts=28, m="M_Label", cap=False)
bm = bmesh.new(); bm.from_mesh(lab.data)
bmesh.ops.delete(bm, geom=[f for f in bm.faces if f.calc_center_median().y > -0.12], context="FACES")
bm.to_mesh(lab.data); bm.free()
uv_face_fit(lab, lambda f: True, 0, 2, flip_u=False)
o = join([b, lab], "SM_Barrel")
smooth(o, 50)
return dict(elev=20, azim=-30)
def herb_sack():
prof = [(0.0, -0.45), (0.1, -0.448), (0.155, -0.43), (0.185, -0.39), (0.2, -0.3), (0.205, -0.15), (0.2, 0.0), (0.188, 0.12),
(0.16, 0.2), (0.11, 0.255), (0.07, 0.275), (0.065, 0.29), (0.09, 0.32), (0.13, 0.36), (0.14, 0.39), (0.115, 0.4), (0.0, 0.33)]
body = rev("sack", prof, "M_Burlap", segs=24, close_top=True)
# folds: pinch the neck into pleats + a lumpy, slumped body
for v in body.data.vertices:
p = v.co
a = math.atan2(p.y, p.x)
if p.z > 0.2:
k = min(1.0, (p.z - 0.2) / 0.1)
r = math.hypot(p.x, p.y) * (1 + 0.18 * k * math.sin(a * 7))
v.co = Vector((math.cos(a) * r, math.sin(a) * r, p.z))
elif p.z < 0.0:
v.co.x *= 1.04
wobble(body, 0.014, 6.0, seed=4.0)
D.uv_cyl(body, 2, 2.2, 2.2)
P = [body]
P.append(torus("tie", 0.074, 0.012, loc=(0, 0, 0.282), seg=16, rseg=5, m="M_Twine"))
P.append(ptube("knot", bez([(0.07, -0.02, 0.285), (0.12, -0.05, 0.27), (0.15, -0.04, 0.2), (0.14, -0.06, 0.13)], 8), 0.008, "M_Twine"))
# herbs peeking out of the top
rnd = random.Random(3)
for k in range(6):
a = rnd.uniform(0, TAU)
base = (math.cos(a) * 0.05, math.sin(a) * 0.05, 0.36)
P.append(leaf_card("herb", base, math.degrees(a) + 90, rnd.uniform(40, 70), rnd.uniform(0.1, 0.14), 0.09, bend=0.1))
b = join(P, "SM_Canister_body")
# stencilled logo patch on the front
lg = cyl("logo", 0.2075, 0.22, (0, 0, -0.14), verts=24, m="M_Logo", cap=False)
bm = bmesh.new(); bm.from_mesh(lg.data)
bmesh.ops.delete(bm, geom=[f for f in bm.faces if f.calc_center_median().y > -0.13], context="FACES")
bm.to_mesh(lg.data); bm.free()
uv_face_fit(lg, lambda f: True, 0, 2, flip_u=False)
o = join([b, lg], "SM_Canister")
smooth(o, 60)
return dict(elev=18, azim=-30)
# ======================================================================= hemp
def hemp_parts(height, spread, tiers, rnd, card_m="M_HempCard", stalk_m="M_HempCard", stalk_r=0.012, z0=0.0):
P = []
st = cyl("stalk", stalk_r, height * 0.94, (0, 0, z0 + height * 0.47), verts=5, m=stalk_m, r2=stalk_r * 0.45, cap=False)
if stalk_m == "M_HempCard":
set_uv(st, lambda c, f: (PATCH + 0.01 * (c.x / max(1e-4, stalk_r)), PATCH))
P.append(st)
for k in range(tiers):
t = k / max(1, tiers - 1)
z = z0 + height * (0.18 + 0.66 * t)
n = 3 if k < tiers - 1 else 2
L = spread * (1.0 - 0.55 * t)
for j in range(n):
yaw = 360 * j / n + k * 47 + rnd.uniform(-15, 15)
P.append(leaf_card("leaf", (0, 0, z), yaw, rnd.uniform(18, 34) + 18 * t, L * rnd.uniform(0.9, 1.1), L * 0.95,
bend=0.22 - 0.1 * t, m=card_m))
# top cola: a crossed bunch of upright leaves
for j in range(3):
P.append(leaf_card("cola", (0, 0, z0 + height * 0.86), 120 * j + 20, 68, spread * 0.42, spread * 0.36, bend=0.05, m=card_m))
return P
def field_hemp():
"""Instanced by the grass shader: 1 m tall, origin at the root."""
P = hemp_parts(1.0, 0.42, 4, random.Random(11))
o = join(P, "SM_Hemp")
smooth(o, 80)
return dict(elev=14, azim=-30, bg=(0.55, 0.7, 0.5))
def potted_hemp():
P = []
pot_prof = [(0, 0), (0.22, 0), (0.245, 0.02), (0.28, 0.2), (0.305, 0.38), (0.31, 0.4), (0.34, 0.41), (0.35, 0.44), (0.35, 0.5),
(0.33, 0.52), (0.305, 0.515), (0.295, 0.48)]
mats = ["M_PaintTerracotta"] * 3 + ["M_Teal"] + ["M_PaintTerracotta"] * 2 + ["M_Teal"] * 5
P.append(rev("pot", pot_prof, mats, segs=24, close_top=False))
P.append(cy(0.3, 0.42, 0.47, "M_Soil", verts=24, name="soil"))
rnd = random.Random(9)
for k in range(6):
a = rnd.uniform(0, TAU); rr = rnd.uniform(0.12, 0.24)
P.append(sphere("pebble", rnd.uniform(0.03, 0.045), (math.cos(a) * rr, math.sin(a) * rr, 0.47), seg=6, rings=4,
m="M_Straw", scale=(1, 0.8, 0.5)))
# three stalks of different heights
for (dx, dy, h, s) in ((0.0, 0.0, 1.45, 0.5), (0.12, 0.07, 1.05, 0.4), (-0.11, 0.08, 0.85, 0.36)):
for p in hemp_parts(h, s, 5 if h > 1.2 else 4, rnd, stalk_m="M_LeafDark", stalk_r=0.016, z0=0.45):
xf(p, loc=(dx, dy, 0))
P.append(p)
# a little wooden stake + plant tag
P.append(rod((0.2, -0.12, 0.42), (0.2, -0.12, 0.72), 0.01, "M_Wood", verts=5))
P.append(bx(0.16, 0.24, -0.135, -0.125, 0.64, 0.7, "M_PaintWhite", bevel=0.004, segs=1, name="tag"))
o = join(P, "SM_Decor_Palm")
finalize(o, uv=1.0, ang=70)
return dict(elev=16)
# ======================================================================= scarecrow
def scarecrow_parts(H=2.1, plate=False):
P = []
s = H / 2.1
# post + crossbar
P.append(bx(-0.045 * s, 0.045 * s, -0.045 * s, 0.045 * s, 0.0, 1.95 * s, "M_Wood", bevel=0.012, segs=1, name="post"))
P.append(bx(-0.62 * s, 0.62 * s, -0.035 * s, 0.035 * s, 1.36 * s, 1.43 * s, "M_Wood", bevel=0.01, segs=1, name="bar"))
if plate:
P.append(bx(-0.22, 0.22, -0.22, 0.22, 0, 0.05, "M_DarkGrey", bevel=0.02, name="plate"))
for sx in (-1, 1):
for sy in (-1, 1):
P.append(hexbolt(sx * 0.16, sy * 0.16, 0.055, r=0.016, h=0.02))
else:
# hay piled around the foot
P.append(sphere("hay", 0.2 * s, (0, 0, 0.02), seg=10, rings=6, m="M_Hay", scale=(1.2, 1.0, 0.45)))
# shirt: torso + sleeves along the crossbar (red flannel)
torso = softbox("shirt", (0.42 * s, 0.24 * s, 0.6 * s), (0, 0, 1.2 * s), r=0.08 * s, m="M_PaintRed", bulge=(0.02, 0.03, 0))
wobble(torso, 0.012, 8.0, seed=1.0)
P.append(torso)
for sx in (-1, 1):
sl = ptube("sleeve", [(sx * 0.17 * s, 0, 1.4 * s), (sx * 0.38 * s, 0, 1.39 * s), (sx * 0.55 * s, 0, 1.37 * s)], 0.075 * s, "M_PaintRed", rs=2)
P.append(sl)
# straw sticking out of the cuffs
for k in range(5):
a = TAU * k / 5
p0 = Vector((sx * 0.56 * s, math.cos(a) * 0.03 * s, 1.37 * s + math.sin(a) * 0.03 * s))
P.append(rod(p0, p0 + Vector((sx * 0.09, math.cos(a) * 0.04, math.sin(a) * 0.04 - 0.05)) * s, 0.008 * s, "M_Straw", verts=3))
# dungarees + patch
P.append(softbox("trousers", (0.44 * s, 0.26 * s, 0.34 * s), (0, 0, 0.84 * s), r=0.07 * s, m="M_PaintBlue"))
for sx in (-1, 1):
P.append(bx(sx * 0.13 * s - 0.03 * s, sx * 0.13 * s + 0.03 * s, -0.135 * s, -0.115 * s, 0.98 * s, 1.42 * s, "M_PaintBlue", bevel=0.006, segs=1, name="strap"))
P.append(bx(0.05 * s, 0.15 * s, -0.142 * s, -0.128 * s, 0.76 * s, 0.86 * s, "M_PaintYellow", bevel=0.005, segs=1, name="patch"))
for sx in (-1, 1):
for k in range(4):
a = TAU * k / 4
p0 = Vector((sx * 0.12 * s + math.cos(a) * 0.03 * s, math.sin(a) * 0.03 * s, 0.68 * s))
P.append(rod(p0, p0 + Vector((math.cos(a) * 0.03, math.sin(a) * 0.03, -0.12)) * s, 0.009 * s, "M_Straw", verts=3))
# sack head with a stitched face
head = sphere("head", 0.16 * s, (0, 0, 1.68 * s), seg=14, rings=9, m="M_Burlap", scale=(1, 0.95, 1.08))
wobble(head, 0.01, 9.0, seed=6.0)
D.uv_cyl(head, 2, 1.2, 1.4)
P.append(head)
for sx in (-1, 1):
for d in ((-1, -1), (1, 1)):
P.append(rod((sx * 0.06 * s - 0.022 * s, -0.152 * s, 1.73 * s + d[0] * 0.022 * s),
(sx * 0.06 * s + 0.022 * s, -0.152 * s, 1.73 * s - d[0] * 0.022 * s), 0.008 * s, "M_DarkGrey", verts=4))
smile = [(x * s, -0.15 * s + 0.02 * s * abs(x / 0.08) ** 2, (1.6 + 0.03 * (x / 0.08) ** 2) * s) for x in (-0.08, -0.04, 0.0, 0.04, 0.08)]
P.append(ptube("smile", smile, 0.007 * s, "M_DarkGrey"))
P.append(torus("neck", 0.07 * s, 0.014 * s, loc=(0, 0, 1.53 * s), seg=14, rseg=4, m="M_Twine"))
# straw hat
P.append(rev("hat", [(0.0, 1.8 * s), (0.27 * s, 1.79 * s), (0.28 * s, 1.805 * s), (0.14 * s, 1.83 * s), (0.12 * s, 1.95 * s), (0.0, 1.97 * s)],
["M_Straw", "M_Straw", "M_Straw", "M_Straw", "M_Straw"], segs=20, close_top=False))
P.append(cy(0.128 * s, 1.83 * s, 1.87 * s, "M_Twine", verts=20, name="hatband"))
return P
def scarecrow_field():
o = join(scarecrow_parts(2.1), "SM_Buoy")
finalize(o, uv=1.6, ang=50)
return dict(elev=12)
def scarecrow_deck():
o = join(scarecrow_parts(1.75, plate=True), "SM_Decor_Lifebuoy")
finalize(o, uv=1.6, ang=50)
return dict(elev=12)
# ======================================================================= ramp
def ramp():
"""Loading ramp from the deck edge (y = 0, z = 0) down to the meadow (y = -6, z = -1.2)."""
L, W = 6.12, 3.0
F = [] # built flat, then tilted down as a whole
F.append(bx(-W / 2, W / 2, -L, 0.0, -0.1, -0.06, "M_DarkGrey", bevel=0.0, name="sub"))
y = -L
while y < -0.18:
y1 = min(y + 0.27, -0.18)
F.append(bx(-W / 2 + 0.12, W / 2 - 0.12, y, y1 - 0.025, -0.07, 0.0, "M_WoodDeck", bevel=0.012, segs=1, name="plank"))
y += 0.27
for sx in (-1, 1):
x0, x1 = sorted((sx * (W / 2 - 0.12), sx * W / 2))
F.append(bx(x0, x1, -L, 0.0, -0.32, 0.12, "M_HullWhite", bevel=0.03, segs=2, name="curb"))
F.append(bx(x0 - 0.004, x1 + 0.004, -L + 0.2, -0.2, 0.02, 0.07, "M_PaintOrange", bevel=0.0, name="stripe"))
for yy in (-1.0, -3.0, -5.0):
F.append(bx(sx * (W / 2 - 0.06) - 0.05, sx * (W / 2 - 0.06) + 0.05, yy - 0.05, yy + 0.05, 0.12, 0.62, "M_PaintOrange", bevel=0.015, segs=1, name="bollard"))
F.append(bx(sx * (W / 2 - 0.06) - 0.052, sx * (W / 2 - 0.06) + 0.052, yy - 0.052, yy + 0.052, 0.5, 0.56, "M_Reflective", bevel=0.0, name="refl"))
# hazard threshold at the top + a steel lip at the bottom
F.append(bx(-W / 2 + 0.12, W / 2 - 0.12, -0.18, 0.0, -0.06, 0.01, "M_Hazard", bevel=0.0, name="thresh"))
F.append(bx(-W / 2 + 0.12, W / 2 - 0.12, -L - 0.3, -L + 0.02, -0.04, 0.0, "M_Steel", bevel=0.0, name="lip"))
for o in F:
xf(o, rot=(math.degrees(math.asin(0.2)), 0, 0))
P = list(F)
# legs down to the ground
for yy in (-2.0, -4.0):
z = yy * 0.2 / math.cos(math.asin(0.2)) - 0.1
for sx in (-1, 1):
P.append(bx(sx * 1.3 - 0.07, sx * 1.3 + 0.07, yy - 0.07, yy + 0.07, -1.35, z, "M_Steel", bevel=0.01, segs=1, name="leg"))
P.append(bx(sx * 1.3 - 0.16, sx * 1.3 + 0.16, yy - 0.16, yy + 0.16, -1.35, -1.3, "M_DarkGrey", bevel=0.0, name="foot"))
P.append(bx(-1.3, 1.3, yy - 0.04, yy + 0.04, z - 0.12, z - 0.04, "M_Steel", bevel=0.0, name="brace"))
o = join(P, "Body")
finalize(o, uv=1.0, ang=40)
return dict(elev=26, azim=-50)
# ======================================================================= hand tools + loose clippings
def shears():
"""Garden shears: grip loops at the origin, blades forward (-Y). BladeA / BladeB pivot on the screw (origin)."""
PV = Vector((0, -0.085, 0))
for nm, sx, dz, m in (("BladeA", 1, 0.0045, "M_PaintOrange"), ("BladeB", -1, -0.0045, "M_TrimLine")):
P = []
blade = [(-0.004 * sx, -0.07), (0.016 * sx, -0.075), (0.012 * sx, -0.2), (0.004 * sx, -0.29), (-0.004 * sx, -0.3), (-0.006 * sx, -0.2)]
if sx < 0:
blade = list(reversed(blade))
b = slab("blade", blade, dz - 0.003, dz + 0.003, "M_Blade", plane="XY", bevel=0.0015, segs=1)
P.append(b)
# arm back to the grip loop on the opposite side
P.append(ptube("arm", [(0.0, -0.085, dz), (-0.012 * sx, -0.045, dz), (-0.03 * sx, 0.0, dz)], 0.007, "M_Steel"))
loop = torus("loop", 0.032, 0.011, loc=(-0.045 * sx, 0.035, dz), seg=18, rseg=6, m=m)
loop.scale = (0.8, 1.15, 1.0)
apply_xform(loop)
P.append(loop)
o = join(P, nm)
finalize(o, uv=6.0, ang=40)
set_origin(o, tuple(PV))
o = join([cy(0.011, -0.012, 0.012, "M_Brass", y=PV.y, verts=10, name="screw"),
cy(0.006, 0.012, 0.016, "M_Steel", y=PV.y, verts=6, name="screwcap")], "Body")
finalize(o, uv=6.0)
# hedge-shear size: big enough to read in the first-person view next to the glove
S = 1.7
for ob in bpy.context.scene.objects:
if ob.type == "MESH":
ob.data.transform(Matrix.Scale(S, 4))
ob.location = ob.location * S
return dict(elev=50, azim=-20)
def scythe():
"""Scythe: grip at the origin, snath forward (-Y) with a second hand nib, the blade sweeps out to +X (player's left)."""
P = []
end = Vector((0, -1.3, -0.06))
P.append(ptube("snath", bez([(0, 0.12, 0.0), (0, -0.4, 0.03), (0, -0.9, 0.01), tuple(end)], 12), 0.022, "M_Wood", rs=2))
P.append(cyl("grip", 0.027, 0.16, (0, 0.02, 0), axis="Y", verts=12, m="M_Rubber"))
# nib: the second handle, sticking up
P.append(rod((0, -0.62, 0.02), (0, -0.62, 0.17), 0.016, "M_Wood", verts=8))
P.append(cyl("nibgrip", 0.022, 0.09, (0, -0.62, 0.13), verts=10, m="M_PaintOrange"))
P.append(torus("ring", 0.03, 0.009, loc=(0, -0.62, 0.02), axis="Y", seg=12, rseg=4, m="M_Steel"))
P.append(torus("collar", 0.032, 0.012, loc=tuple(end), axis="Y", seg=12, rseg=4, m="M_Steel"))
# the blade: curved, tapering, lying flat a little below the snath end
n = 14
outer, inner = [], []
for i in range(n + 1):
t = i / n
x = 0.76 * t
y = end.y - 0.02 - 0.13 * math.sin(math.pi * t * 0.95)
w = 0.08 * (1 - t) ** 0.8 + 0.006
outer.append((x, y - w * 0.15))
inner.append((x, y + w))
pts = outer + list(reversed(inner))
bl = slab("blade", pts, end.z - 0.035, end.z - 0.028, "M_Blade", plane="XY", bevel=0.0, segs=1)
P.append(bl)
sp = [(p[0], p[1] + 0.004) for p in inner]
P.append(ptube("spine", [(x, y, end.z - 0.03) for x, y in sp], 0.007, "M_Steel"))
P.append(bx(-0.03, 0.05, end.y - 0.04, end.y + 0.04, end.z - 0.045, end.z - 0.015, "M_Steel", bevel=0.005, segs=1, name="tang"))
o = join(P, "Body")
finalize(o, uv=3.0, ang=40)
return dict(elev=40, azim=-30)
def clip_pile():
"""A heap of fresh clippings, 1.2 m across (about 6 kg); origin at the bottom centre. One material (drawn instanced)."""
mound = sphere("mound", 0.6, (0, 0, 0), seg=16, rings=8, m="M_Clippings", scale=(1.0, 0.9, 0.5))
bm = bmesh.new(); bm.from_mesh(mound.data)
bmesh.ops.delete(bm, geom=[v for v in bm.verts if v.co.z < -0.02], context="VERTS")
bm.to_mesh(mound.data); bm.free()
wobble(mound, 0.07, 3.5, seed=5.0)
P = [mound]
rnd = random.Random(21)
for k in range(18):
a = rnd.uniform(0, TAU); r = rnd.uniform(0.05, 0.5)
z = 0.28 * math.sqrt(max(0.0, 1 - (r / 0.6) ** 2))
base = (math.cos(a) * r, math.sin(a) * r * 0.9, z)
P.append(leaf_card("strand", base, math.degrees(rnd.uniform(0, TAU)), rnd.uniform(-15, 35), rnd.uniform(0.12, 0.22), 0.025,
bend=0.3, m="M_Clippings"))
o = join(P, "SM_ClipPile")
uv_box(o, 1.5)
smooth(o, 70)
return dict(elev=30, bg=(0.5, 0.62, 0.4))
BUILDERS = {
"SM_Barrel": hay_bale,
"SM_Canister": herb_sack,
"SM_Hemp": field_hemp,
"SM_Decor_Palm": potted_hemp,
"SM_Buoy": scarecrow_field,
"SM_Decor_Lifebuoy": scarecrow_deck,
"SM_Dock": ramp,
"SM_Tool_Shears": shears,
"SM_Tool_Scythe": scythe,
"SM_ClipPile": clip_pile,
}
if __name__ == "__main__":
run(BUILDERS)