CR 23: Asset-Grundausstattung importiert und Pipeline verifiziert

Fuenf CC0-Packs von Quaternius entpackt, sortiert und in Godot importiert.
Alle fuenf License_Standard.txt bestaetigen CC0 1.0 — CREDITS.md fuehrt sie
mit Quelle, Lizenz und Zielordner.

296 Modelle als glTF unter assets/models/: characters/basis (2) und
characters/haare (8), characters/animations (2 glb mit 43 Animationen, mit
und ohne Root Motion), outfits/komplett (4) und outfits/teile (20), props
(94, thematisch sortiert), environment (166, nach Bauteil-Art). Zehn
redundante Dach-Groessenvarianten blieben draussen; 4x4, 6x6 und 8x8 stehen
stellvertretend.

tools/import_quaternius.py macht den Vorgang reproduzierbar: es entpackt
selektiv die glTF-Zweige, bringt Dateinamen auf snake_case und schreibt
dabei die relativen URIs in den .gltf-Dateien mit — ohne das waeren Buffer-
und Texturverweise nach dem Umbenennen tot. Texturen liegen einmal pro Pack
unter <pack>/textures/. Zwei kaputte Verweise im Quell-Pack korrigiert:
T_Hair_1_Normal_png.png und T_Eye_Normal_png.png existieren bei Quaternius
nicht, dort fehlt das _png.

Der eigentliche Punkt ist die Rig-Kompatibilitaet: Basis-Charaktere, Outfits
und Animationsbibliothek liefern dasselbe 65-Knochen-Skelett im
Unreal-Namensschema, Knochenliste identisch. scenes/test/asset_pipeline_test
legt darum Koerper, Ranger-Outfit und Frisur auf das Skelett der Animation
Library — 13 Meshes auf 65 Knochen — und spielt elf Schau-Animationen ab.

Keine bestehende Szene angefasst: der Primitiven-Austausch ist laut CR 23
ausdruecklich ein eigener Folge-Schritt und steht jetzt als CR 24 in
CHANGEREQUESTS.md, zusammen mit dem noetigen Trimmen der Basis-Koerper und
der offenen Entscheidung ueber die 4K-Outfit-Texturen.

Verifiziert mit dev_cr23_probe (25/25) und einem Boot-Check ueber zwoelf
Szenen — Hof, Sparringshalle, Aula, Schlafsaal, Gauntlet, Viadukt und
Kampf-Testground alle unveraendert lauffaehig. Sonden vor dem Commit
geloescht.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
danny 2026-07-21 18:00:57 +02:00
parent adf9fb706f
commit b911f243be
1021 changed files with 152674 additions and 73 deletions

236
tools/import_quaternius.py Normal file
View file

@ -0,0 +1,236 @@
# -*- coding: utf-8 -*-
"""Einmal-Werkzeug fuer CR 23: entpackt die Quaternius-CC0-Packs aus
assets/_staging/ nach assets/models/, bringt alle Dateinamen auf
snake_case und schreibt die relativen URIs in den glTF-Dateien mit.
Texturen liegen pro Pack einmal unter <pack>/textures/; die Modelle
liegen in thematischen Unterordnern und referenzieren sie relativ.
"""
import io, json, os, re, shutil, sys, zipfile
STAGING = "assets/_staging"
OUT = "assets/models"
def to_snake(name):
name = name.replace(" ", "_").replace("-", "_")
name = re.sub(r"(?<=[a-z0-9])(?=[A-Z])", "_", name)
name = re.sub(r"(?<=[A-Z])(?=[A-Z][a-z])", "_", name)
name = re.sub(r"_+", "_", name)
return name.lower().strip("_")
def snake_file(filename):
stem, ext = os.path.splitext(filename)
return to_snake(stem) + ext.lower()
class Pack:
def __init__(self, zip_name):
self.zip = zipfile.ZipFile(os.path.join(STAGING, zip_name))
self.names = self.zip.namelist()
def find(self, suffix):
return [n for n in self.names if n.endswith(suffix)]
def in_dir(self, directory, ext):
return sorted(n for n in self.names
if os.path.dirname(n) == directory and n.lower().endswith(ext))
def resolve_uri(pack, source_dir, uri):
"""Findet die Quelldatei zu einer glTF-URI. Faengt den Quaternius-
Namensfehler ab, bei dem Texturen als '<name>_png.png' referenziert
werden, aber als '<name>.png' im Pack liegen."""
candidate = source_dir + "/" + uri
if candidate in pack.names:
return candidate, False
stem, ext = os.path.splitext(uri)
if stem.endswith("_png"):
repaired = source_dir + "/" + stem[:-4] + ext
if repaired in pack.names:
return repaired, True
return None, False
def write_gltf(pack, source, target_dir, texture_dir_rel, texture_out_dir, stats):
"""Schreibt eine glTF samt .bin und Texturen um."""
source_dir = os.path.dirname(source)
data = json.loads(pack.zip.read(source))
for buffer in data.get("buffers", []):
uri = buffer.get("uri")
if not uri:
continue
found, _ = resolve_uri(pack, source_dir, uri)
if found is None:
stats["missing"].append(source + " -> " + uri)
continue
new_name = snake_file(os.path.basename(uri))
os.makedirs(target_dir, exist_ok=True)
with open(os.path.join(target_dir, new_name), "wb") as out:
out.write(pack.zip.read(found))
buffer["uri"] = new_name
for image in data.get("images", []):
uri = image.get("uri")
if not uri:
continue
found, was_repaired = resolve_uri(pack, source_dir, uri)
if found is None:
stats["missing"].append(source + " -> " + uri)
continue
if was_repaired:
stats["repaired"].add(uri)
new_name = snake_file(os.path.basename(found))
os.makedirs(texture_out_dir, exist_ok=True)
texture_path = os.path.join(texture_out_dir, new_name)
if not os.path.exists(texture_path):
with open(texture_path, "wb") as out:
out.write(pack.zip.read(found))
stats["textures"] += 1
image["uri"] = texture_dir_rel + new_name
os.makedirs(target_dir, exist_ok=True)
target = os.path.join(target_dir, snake_file(os.path.basename(source)))
with io.open(target, "w", encoding="utf-8", newline="\n") as out:
json.dump(data, out, ensure_ascii=False, indent="\t")
stats["models"] += 1
return target
def copy_raw(pack, source, target_dir, stats):
os.makedirs(target_dir, exist_ok=True)
target = os.path.join(target_dir, snake_file(os.path.basename(source)))
with open(target, "wb") as out:
out.write(pack.zip.read(source))
stats["models"] += 1
return target
PROP_CATEGORIES = [
("moebel", ("Bed_", "Bench", "Bookcase", "Cabinet", "Chair", "Nightstand",
"Shelf", "Stool", "Table_Large", "Workbench", "Peg_Rack",
"BookStand", "WeaponStand")),
("buecher", ("Book", "Scroll")),
("behaelter", ("Barrel", "Bag", "Bucket", "Cage", "Chest", "Crate",
"FarmCrate", "Pouch", "Pot_")),
("licht", ("Candle", "Chandelier", "Lantern", "Torch")),
("kueche", ("Cauldron", "Chalice", "Mug", "Bottle", "SmallBottle", "Vase",
"Potion", "Table_", "Carrot")),
("waffen", ("Axe", "Sword", "Pickaxe", "Shield", "Anvil", "Whetstone",
"Dummy")),
]
ENVIRONMENT_CATEGORIES = [
("waende", ("Wall_",)),
("tueren", ("Door_", "DoorFrame_")),
("fenster", ("Window", "WindowShutters_")),
("boeden", ("Floor_",)),
("daecher", ("Roof_",)),
("treppen", ("Stair_", "Stairs_")),
("balkone", ("Balcony_",)),
("ecken", ("Corner_",)),
("vorspruenge", ("Overhang_",)),
("bauteile", ("Prop_", "HoleCover_")),
]
## Redundante Dach-Groessenvarianten: 4x4, 6x6 und 8x8 bleiben als
## Stellvertreter, der Rest der Matrix waere nur Ballast im Browser.
ENVIRONMENT_SKIP = {
"Roof_RoundTiles_4x6", "Roof_RoundTiles_4x8", "Roof_RoundTiles_6x4",
"Roof_RoundTiles_6x8", "Roof_RoundTiles_6x10", "Roof_RoundTiles_6x12",
"Roof_RoundTiles_6x14", "Roof_RoundTiles_8x10", "Roof_RoundTiles_8x12",
"Roof_RoundTiles_8x14",
}
def categorize(stem, categories):
for folder, prefixes in categories:
for prefix in prefixes:
if stem.startswith(prefix):
return folder
return "sonstiges"
def new_stats():
return {"models": 0, "textures": 0, "missing": [], "repaired": set()}
def report(label, stats):
print(" %-26s %3d Modelle, %2d Texturen" % (label, stats["models"], stats["textures"]))
for uri in sorted(stats["repaired"]):
print(" URI repariert: %s" % uri)
for miss in stats["missing"]:
print(" FEHLT: %s" % miss)
def main():
total = new_stats()
# --- Universal Base Characters -------------------------------------
pack = Pack("Universal Base Characters[Standard].zip")
stats = new_stats()
base_dir = "Universal Base Characters[Standard]/Base Characters/Godot - UE"
for model in pack.in_dir(base_dir, ".gltf"):
write_gltf(pack, model, OUT + "/characters/basis",
"../textures/", OUT + "/characters/textures", stats)
hair_dir = ("Universal Base Characters[Standard]/Hairstyles/"
"Rigged to Head Bone/glTF (Godot -Unreal)")
for model in pack.in_dir(hair_dir, ".gltf"):
write_gltf(pack, model, OUT + "/characters/haare",
"../textures/", OUT + "/characters/textures", stats)
report("characters", stats)
# --- Universal Animation Library ------------------------------------
pack = Pack("Universal Animation Library[Standard].zip")
stats = new_stats()
for model in pack.find(".glb"):
if "/Unreal-Godot/" in model:
copy_raw(pack, model, OUT + "/characters/animations", stats)
report("characters/animations", stats)
# --- Modular Character Outfits - Fantasy ----------------------------
pack = Pack("Modular Character Outfits - Fantasy[Standard].zip")
stats = new_stats()
root = "Modular Character Outfits - Fantasy[Standard]/Exports/glTF (Godot-Unreal)"
for model in pack.in_dir(root + "/Outfits", ".gltf"):
write_gltf(pack, model, OUT + "/outfits/komplett",
"../textures/", OUT + "/outfits/textures", stats)
for model in pack.in_dir(root + "/Modular Parts", ".gltf"):
write_gltf(pack, model, OUT + "/outfits/teile",
"../textures/", OUT + "/outfits/textures", stats)
report("outfits", stats)
# --- Fantasy Props MegaKit ------------------------------------------
pack = Pack("Fantasy Props MegaKit[Standard].zip")
stats = new_stats()
for model in pack.in_dir("Exports/glTF", ".gltf"):
stem = os.path.splitext(os.path.basename(model))[0]
folder = categorize(stem, PROP_CATEGORIES)
write_gltf(pack, model, OUT + "/props/" + folder,
"../textures/", OUT + "/props/textures", stats)
report("props", stats)
# --- Medieval Village MegaKit ---------------------------------------
pack = Pack("Medieval Village MegaKit[Standard].zip")
stats = new_stats()
village_dir = "Medieval Village MegaKit[Standard]/glTF"
skipped = 0
for model in pack.in_dir(village_dir, ".gltf"):
stem = os.path.splitext(os.path.basename(model))[0]
if stem in ENVIRONMENT_SKIP:
skipped += 1
continue
folder = categorize(stem, ENVIRONMENT_CATEGORIES)
write_gltf(pack, model, OUT + "/environment/" + folder,
"../textures/", OUT + "/environment/textures", stats)
report("environment", stats)
print(" (%d redundante Dach-Groessenvarianten uebersprungen)" % skipped)
for stats_done in []:
pass
if __name__ == "__main__":
main()