"""Study only: what a white car, the cube and the hall are made of, in their own frames. blender -b --factory-startup --python build/study_car.py """ import json import math import os import sys sys.dont_write_bytecode = True HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) from cars import Engineer # noqa: E402 from hall import build_hall # noqa: E402 from units import Demo # noqa: E402 demo = Demo("ModSci_Engineer__Example_Dynamic_White") eng = Engineer(demo) out = {} def dump(unit): rows = [] for it in unit.items: e = it.m.to_euler() rows.append([it.kind, it.name if it.kind == "mesh" else it.key.split("/")[-1][:28], [round(v, 2) for v in it.m.translation], round(math.degrees(e.z), 1), [round(v, 2) for v in it.center], [round(v, 2) for v in it.m.to_scale()], {str(k): v.split("/")[-1] for k, v in it.data.items()} if it.kind == "mesh" else ""]) rows.sort(key=lambda r: (r[0], r[1], r[2])) return rows for kind in ("white", "gold", "blue"): out["car " + kind] = dump(eng._src_car(kind)) out["cube base"] = dump(eng.cube_base) out["conn"] = dump(eng.conn) out["hall"] = dump(build_hall(demo, props="bare")) with open(os.path.join(HERE, "study_car.json"), "w", encoding="utf-8") as f: json.dump(out, f) print("STUDY written")