Separate authored assets and install generated output transactionally (#92)

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
2026-11-02 01:19:51 +03:00
parent e7c00267b1
commit 657d8f16c6
9 changed files with 1090 additions and 766 deletions
+24
View File
@@ -8,9 +8,33 @@
(в моделях грань длиннее 16 единиц тянет всю текстуру), картина заранее сжата, чтобы пятна камуфляжа не вытягивались.
"""
import random
import os
import zlib
from PIL import Image
def write_block_textures(asset_root, textures, variants, stretch_functions):
"""Render the palette's block textures into a staged `assets/<namespace>` tree."""
block_dir = os.path.join(asset_root, "textures", "block")
os.makedirs(block_dir, exist_ok=True)
for name, render in textures.items():
render().save(os.path.join(block_dir, name + ".png"))
for name, (base, qx, qy, burnt) in variants.items():
image = (stretch_functions[base](qx, qy)
if base in stretch_functions and (qx > 1 or qy > 1)
else textures[base]())
if burnt:
image = burn(image, zlib.crc32(name.encode()), "glass" if base.startswith("glass") else "paint")
image.save(os.path.join(block_dir, name + ".png"))
def write_item_icon(asset_root, name, image):
"""Write one generated item icon under a staged assets namespace."""
item_dir = os.path.join(asset_root, "textures", "item")
os.makedirs(item_dir, exist_ok=True)
image.save(os.path.join(item_dir, name + ".png"))
# ------------------------------------------------------------------ палитра
PAL = {
"nato_green": [(70, 80, 54), (86, 74, 50), (34, 38, 30)], # NATO: зелёный, коричневый, чёрный