"""Door robot arm, red look (2026-10-19): three Cycles stills to hold beside ref8 (nothing is saved in the .blend). blender -b --python build/dra_look_render.py -- [samples] [scale] [which,which] which: show (the showroom at ref2's angle, both versions), elbow (ref5's close-up: the elbow, the upper arm, the cables), wrist (ref6B's close-up: version B's wrist and plate). Into previews/red_look/. """ import os import sys import math import bpy HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(HERE) if HERE not in sys.path: sys.path.insert(0, HERE) import dra_cycles as C # noqa: E402 import dra_preview as P # noqa: E402 argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [] samples = int(argv[0]) if len(argv) > 0 else 128 scale = float(argv[1]) if len(argv) > 1 else 1.0 which = argv[2].split(",") if len(argv) > 2 else ["show", "elbow", "wrist"] out = os.path.join(ROOT, "previews", "red_look") os.makedirs(out, exist_ok=True) sc = bpy.data.scenes["DoorArm | Showroom"] wm = bpy.context.window_manager if wm.windows: wm.windows[0].scene = sc C.gpu(sc, samples) C.studio(sc) cyc = bpy.data.objects.get("Showroom | cyclorama") done = [] def res(w, h): return (int(w * scale), int(h * scale)) if "show" in which: P.show_only(None) cam = P.camera_for("ref2", sc) bpy.context.view_layer.update() # matrix_world is stale until the update direction = cam.matrix_world.to_3x3().col[2] C.fit_along(sc, cam, C.arm_points(sc, "A") + C.arm_points(sc, "B"), direction, (1920, 1080)) sc.camera = cam if cyc: cyc.hide_render = cam.location.y < -2.5 p = os.path.join(out, "red_ref2_both.png") C.shot(sc, p, res(1920, 1080)) done.append(p) for key, ref, ver in (("elbow", "ref5", "A"), ("wrist", "ref6B", "B")): if key not in which: continue P.show_only(ver) cam = P.camera_for(ref, sc) sc.camera = cam if cyc: cyc.hide_render = cam.location.y < -2.5 p = os.path.join(out, "red_close_%s.png" % key) C.shot(sc, p, res(1400, 1400)) done.append(p) P.show_only(None) print("[dra] rendered", done, flush=True)