#!/usr/bin/env python3 """Export convention-named terrain chunk collections to individual GLBs. Run through Blender rather than a standalone Python interpreter: blender --background terrain_chunks.blend \ --python tools/blender/export_terrain_chunks.py -- \ --output /path/to/terrain_chunks Collections use ``chunk_####_description`` and contain one primary terrain mesh named ``chunk_####``. Additional production objects may live in the same collection; unrelated collections are ignored. """ from __future__ import annotations import argparse import hashlib import json import math import re import struct import sys from dataclasses import dataclass from pathlib import Path from typing import Iterable import bpy from mathutils import Vector CHUNK_SIZE_METERS = 10.0 DEFAULT_TOLERANCE = 0.001 COLLECTION_PATTERN = re.compile( r"^chunk_(?P\d{4})(?:_(?P