Skip to content

Official Codebase of 3DCodeVerse

Python

scene heroes: a keyframed Blender part reaches the scene as a clip; the fix pass climbs the cheap rung; hero ground tolerance

gaoypeng322dea30c204
diff --git a/harness/codeverse/languages/blender/__init__.py b/harness/codeverse/languages/blender/__init__.py
index 2ca56509..ef8035e2 100644
--- a/harness/codeverse/languages/blender/__init__.py
+++ b/harness/codeverse/languages/blender/__init__.py
@@ -529,7 +529,7 @@ def _selfcheck():
for o in meshes:
assert "." not in o.name, f"auto-suffixed name {o.name!r}: give every instance its own name"
z_min = min((o.matrix_world @ Vector(c)).z for o in meshes for c in o.bound_box)
- assert abs(z_min) < 0.002, f"lowest point z={z_min:.4f}: the object must stand on z=0"
+ assert abs(z_min) < __GROUND_TOL__, f"lowest point z={z_min:.4f}: the object must stand on z=0"
print(f"[selfcheck] {len(meshes)} mesh objects, z_min={z_min:.4f}")
'''
@@ -646,7 +646,12 @@ def part_file_source(p: PartPlan) -> str:
return doc + IMPORTS + "\n" + _constants(p) + HELPERS + "\n# ----------------------------------------------------------------------------- part\n" + _part_function(p)
-def model_file_source(plan: StaticPlan) -> str:
+def selfcheck_source(ground_tol_m: float = 0.002) -> str:
+ """The entry's self-check with its "stands on z=0" tolerance filled in."""
+ return SELFCHECK.replace("__GROUND_TOL__", f"{ground_tol_m:g}")
+
+
+def model_file_source(plan: StaticPlan, *, ground_tol_m: float = 0.002) -> str:
"""Complete multi-file entry ``src/model.py``: imports, ordered calls, self-check."""
imports = "\n".join(f"from {PARTS_DIR}.{to_snake(p.name)} import {build_fn_name(p.name)}" for p in plan.parts)
calls = "\n".join(f" {build_fn_name(p.name)}()" for p in plan.parts)
@@ -654,32 +659,37 @@ def model_file_source(plan: StaticPlan) -> str:
_plan_header(plan, multi_file=True)
+ "import bpy\nfrom mathutils import Vector\n\n"
+ imports + "\n\n"
- + SELFCHECK
+ + selfcheck_source(ground_tol_m)
+ "\ndef main():\n # build every part (order = plan order); parts are placed at world pose by their builders\n"
+ calls + "\n _selfcheck()\n\n\nmain()\n"
)
-def blender_skeleton_source(plan: StaticPlan) -> str:
+def blender_skeleton_source(plan: StaticPlan, *, ground_tol_m: float = 0.002) -> str:
"""The same model as ONE ``src/model.py`` (small objects may use a single file)."""
body = "\n# ----------------------------------------------------------------------------- parts\n"
for p in plan.parts:
body += _constants(p) + "\n\n" + _part_function(p) + "\n\n"
calls = "\n".join(f" {build_fn_name(p.name)}()" for p in plan.parts)
return (
- _plan_header(plan, multi_file=False) + IMPORTS + HELPERS + body + SELFCHECK
+ _plan_header(plan, multi_file=False) + IMPORTS + HELPERS + body + selfcheck_source(ground_tol_m)
+ "\ndef main():\n" + calls + "\n _selfcheck()\n\n\nmain()\n"
)
-def write_blender_skeleton(ws: Workspace, plan: StaticPlan, *, multi_file: bool = True) -> list[Path]:
- """Write the starter files (overwrites) and return the written paths (entry first)."""
+def write_blender_skeleton(ws: Workspace, plan: StaticPlan, *, multi_file: bool = True,
+ ground_tol_m: float = 0.002) -> list[Path]:
+ """Write the starter files (overwrites) and return the written paths (entry first).
+
+ ``ground_tol_m`` is the self-check's "stands on z=0" tolerance: 2 mm for an object
+ (the contract's ±1 mm, measured by check_contract), looser for a scene hero, which
+ the scene seats anyway (`lib/place.js seat`) and whose module twin is allowed 20 mm."""
ws.src.mkdir(parents=True, exist_ok=True)
entry = ws.src / "model.py"
if not multi_file:
- entry.write_text(blender_skeleton_source(plan))
+ entry.write_text(blender_skeleton_source(plan, ground_tol_m=ground_tol_m))
return [entry]
- entry.write_text(model_file_source(plan))
+ entry.write_text(model_file_source(plan, ground_tol_m=ground_tol_m))
written = [entry]
for p in plan.parts:
path = ws.root / part_file_rel(p.name)
diff --git a/harness/codeverse/languages/blender/wrappers/run_bpy.py b/harness/codeverse/languages/blender/wrappers/run_bpy.py
index 5c3223f2..8ddb76cb 100644
--- a/harness/codeverse/languages/blender/wrappers/run_bpy.py
+++ b/harness/codeverse/languages/blender/wrappers/run_bpy.py
@@ -246,7 +246,10 @@ def export_glb(bpy: Any, path: str) -> None:
export_image_format="AUTO",
export_cameras=False,
export_lights=False,
- export_animations=False,
+ # a keyframed object becomes a glTF clip the scene loops (scene heroes, 2026-09-07);
+ # an object nobody keyframed exports exactly as before
+ export_animations=True,
+ export_frame_range=True,
export_extras=False,
export_normals=True,
export_texcoords=True,
diff --git a/harness/codeverse/languages/scene_threejs/__init__.py b/harness/codeverse/languages/scene_threejs/__init__.py
index 535fcf95..3d4b8579 100644
--- a/harness/codeverse/languages/scene_threejs/__init__.py
+++ b/harness/codeverse/languages/scene_threejs/__init__.py
@@ -408,7 +408,9 @@ def _glb_preload_js(glbs: list[str], *, target: str, on_error: str, indent: str
f"const assetFiles = {{ {files} }};",
"for (const [key, a] of Object.entries(assetFiles)) {",
" try {",
- " const root = (await loaders.gltf.loadAsync(a.url)).scene;",
+ " const gltf = await loaders.gltf.loadAsync(a.url);",
+ " const root = gltf.scene;",
+ " root.animations = gltf.animations || []; // a keyframed Blender part is a clip; .clone() keeps it (lib/place.js clipPlayer)",
" root.name = a.name; // a glTF root is called 'Scene' until someone names it",
# what every procedural asset sets on its meshes; GLTFLoader leaves both false, so a
# hero neither cast nor received a shadow in any recorded scene (8/8 GLBs, 2026-09-07)
diff --git a/harness/codeverse/languages/scene_threejs/starter/src/lib/place.js b/harness/codeverse/languages/scene_threejs/starter/src/lib/place.js
index 8769ded2..ae9b9864 100644
--- a/harness/codeverse/languages/scene_threejs/starter/src/lib/place.js
+++ b/harness/codeverse/languages/scene_threejs/starter/src/lib/place.js
@@ -16,6 +16,23 @@ const _v = new THREE.Vector3();
const _t = new THREE.Vector3();
const DEG = Math.PI / 180;
+/**
+ * Play the clips a Blender hero carries (`obj.animations`, exported from its
+ * keyframes and kept by `.clone()`). Returns `tick(t)` for the zone's `update(t)`,
+ * or null when the object has no clip. The mixer is set to ABSOLUTE time, so the
+ * same t always gives the same pose (the harness samples t = 0 and 1.5 s).
+ * const cart = ctx.assets.donkey_cart.clone(); const tick = clipPlayer(cart, { offset: 0.7 });
+ * zone.userData.update = (t) => { if (tick) tick(t); };
+ */
+export function clipPlayer(obj, opts = {}) {
+ const clips = obj.animations || [];
+ if (!clips.length) return null;
+ const mixer = new THREE.AnimationMixer(obj);
+ for (const c of clips) mixer.clipAction(c).play();
+ const speed = opts.speed ?? 1, offset = opts.offset ?? 0;
+ return (t) => { mixer.setTime((t + offset) * speed); };
+}
+
/** Unit vector for a `forward` string as reported by assets_api.json. */
function fwdVec(forward) {
switch (forward) {
diff --git a/harness/codeverse/prompts/scene_threejs/effects_catalog.md b/harness/codeverse/prompts/scene_threejs/effects_catalog.md
index 870e165e..930e8fa8 100644
--- a/harness/codeverse/prompts/scene_threejs/effects_catalog.md
+++ b/harness/codeverse/prompts/scene_threejs/effects_catalog.md
@@ -39,6 +39,7 @@ says `import { makeGrass } from '../lib/grass.js';`, `src/scene.js` says
| placing a camera or a prop by intent | `seat` · `establishingShot` · `faceToward` · `alongPath` · `crowdOn` — `lib/place.js` |
| a cliff that reads as rock | `patchRockStrata` · `patchErosionStreaks` — `lib/strata.js`; bedding by world altitude, so every cliff in a scene shares one bedding plane |
| the land between the content and the horizon | `makeOutskirts({ inner, baseY, heightAt, shellRadius, colors, seed })` — `lib/environment.js`; seam-matched relief, field patchwork and wooded clusters. A bare oversized ground plane measured as "a diorama on a vast, empty flat plane" |
+| a Blender hero's own keyframed motion (the GLB carries a clip) | `clipPlayer(clone, { offset })` — `lib/place.js`; returns `tick(t)`, call it from the zone's `update(t)` |
| the sun, the fill and the baked environment | `sunRig({ azimuth, elevation })` — `lib/environment.js`; returns `{ sun, fill, sunDisc, envTex, sunDir }`. Add the lights, assign `scene.environment = rig.envTex` |
| the sky itself | `makeSky(scene, { rig })` — `lib/sky.js`; the dome IS the backdrop, so `scene.background` stays null |
| cloud, cirrus | `makeClouds({ preset, sunDir })` · `makeCirrus()` — `lib/clouds.js` |
diff --git a/harness/codeverse/prompts/tracks/plan_scene.j2 b/harness/codeverse/prompts/tracks/plan_scene.j2
index 7081853c..0d43b4a0 100644
--- a/harness/codeverse/prompts/tracks/plan_scene.j2
+++ b/harness/codeverse/prompts/tracks/plan_scene.j2
@@ -53,7 +53,8 @@ WHAT TO PRODUCE (JSON, fields: {{ schema_fields }}):
+/-30 % scale jitter and +/-0.03 hue jitter — never one shape stamped in a ring or grid.
5. `assets` — 4 to 8 reusable things placed in zones. PascalCase `name`; `kind` = `threejs` for
procedural shapes (fences, lanterns, rocks, benches, trees, boats) or `blender_glb` ONLY for
- 1-2 hero objects that need sculpted/bevelled detail; `description` with construction numbers
+ 1-2 hero objects that need sculpted/bevelled detail (a hero may also carry ONE 2 s keyframed
+ motion — a swinging lamp, a turning wheel — say so in its description); `description` with construction numbers
and colours; `approx_size_m` = width x height x depth in meters (a stone lantern
0.5 x 1.6 x 0.5; a bench 1.6 x 0.9 x 0.6; a pine 3 x 7 x 3); `instances_hint` = how many
appear in total. Prefer FEWER asset modules with a `variant` range (say "5 variants via
diff --git a/harness/codeverse/prompts/tracks/scene_asset.j2 b/harness/codeverse/prompts/tracks/scene_asset.j2
index 69b76c48..2e115051 100644
--- a/harness/codeverse/prompts/tracks/scene_asset.j2
+++ b/harness/codeverse/prompts/tracks/scene_asset.j2
@@ -24,6 +24,10 @@ Scene: {{ spec_prompt }}
material per material class (wood / iron / cloth …), never one vertex-painted mesh.
{{ detail_budget }}
- No camera/light/render/export calls.
+- MOTION (only when the description names a moving part — a swinging lamp, a turning wheel, a lid
+ that rocks): keyframe that object's OWN rotation/location over frames 1-48 (24 fps = a 2 s loop,
+ ends where it starts; put the object's origin at its pivot; no Empties). The harness exports the
+ clip and the scene loops it. Amplitude must read at scene distance (>= 0.15 rad or >= 0.05 m).
{% if asset_files is defined and asset_files|length > 1 %}
- Files you must produce: {% for f in asset_files %}`{{ f }}`{% if not loop.last %}, {% endif %}{% endfor %}
(the skeleton's layout: `src/model.py` is the entry, one part per `src/parts/*.py`).
diff --git a/harness/codeverse/prompts/tracks/scene_zone.j2 b/harness/codeverse/prompts/tracks/scene_zone.j2
index 7f74d372..01b7fddb 100644
--- a/harness/codeverse/prompts/tracks/scene_zone.j2
+++ b/harness/codeverse/prompts/tracks/scene_zone.j2
@@ -25,7 +25,8 @@ Those paths are written relative to `src/`; **from `src/zones/` prefix them with
(`import { buildStoneLantern } from '../assets/stone_lantern.js';`). Shared materials and the
terrain come from the environment: `import { MATS, heightAt } from '../env.js';` (or use
`ctx.heightAt`). A GLB asset is already loaded for you at `ctx.assets['<snake_name>']` — add
-`.clone()` of it, never `loaders.gltf` again. There is no `ctx.rand` and no `ctx.MATS`.
+`.clone()` of it, never `loaders.gltf` again. A clone that carries clips (`clone.animations.length`) is
+played with `clipPlayer(clone)` from '../lib/place.js': call the returned `tick(t)` from this zone's `update(t)`. There is no `ctx.rand` and no `ctx.MATS`.
## Contract
{{ frame_doc }}
diff --git a/harness/codeverse/tracks/scene_assets.py b/harness/codeverse/tracks/scene_assets.py
index fd2a9d00..25e53b29 100644
--- a/harness/codeverse/tracks/scene_assets.py
+++ b/harness/codeverse/tracks/scene_assets.py
@@ -21,6 +21,7 @@ import hashlib
import json
import logging
import shutil
+import struct
from collections.abc import Callable
from dataclasses import replace
from pathlib import Path
@@ -86,6 +87,7 @@ class AssetResult(BaseModel):
strategy: str = Field(default="", description="single-shot | single-shot+repair | agent | escalated")
judged: bool = Field(default=False, description="a non-degraded verdict was recorded in `score`")
score_before: float | None = Field(default=None, description="the verdict the fix pass improved on (score = after)")
+ clips: int = Field(default=0, description="glTF animation clips the hero GLB carries (a keyframed Blender part)")
def is_model_outage(e: BaseException) -> bool:
@@ -126,7 +128,9 @@ def asset_api_summary(plan: ScenePlan, results: dict[str, AssetResult], alias: d
elif a.kind == "threejs":
lines.append(f"- {a.name}: `import {{ build{to_pascal(a.name)} }} from './assets/{to_snake(a.name)}.js'` → Group, base at y=0, {s}{status}")
else:
- lines.append(f"- {a.name}: GLB at `public/assets/{to_snake(a.name)}.glb` (load via loaders.gltf), base at y=0, {s}{status}")
+ motion = f", carries {r.clips} motion clip(s): `clipPlayer(clone)` from '../lib/place.js' in the zone's update" if r and r.clips else ""
+ lines.append(f"- {a.name}: preloaded at `ctx.assets['{to_snake(a.name)}']` (clone it; GLB public/assets/{to_snake(a.name)}.glb), "
+ f"base at y=0, {s}{motion}{status}")
return "\n".join(lines) or "(no assets)"
@@ -238,7 +242,7 @@ def build_threejs_asset(ctx: RunContext, asset: AssetPlan, *, judge: bool) -> As
errors=(chk.errors[:2] if chk and not chk.ok else []))
render_asset = getattr(ctx.runtime, "render_asset", None)
if ok and callable(render_asset) and _judge_wanted(ctx, asset, chk, judge=judge):
- def _after_fix() -> bool:
+ def _after_fix(gen: RunContext) -> bool:
# a fix that breaks the module makes it NOT AVAILABLE — the zones must not import it
c = check(ctx)
if c.ran and c.fatal:
@@ -337,6 +341,7 @@ def _current_files_block(ws: Workspace, files: list[str], limit: int = 24_000) -
#: a hero may spend more triangles than an instanced prop (the number the prompt states)
HERO_MAX_TRIS = 40_000
HERO_ENTRY = "src/model.py"
+HERO_GROUND_TOL_M = 0.02
def build_blender_asset(ctx: RunContext, asset: AssetPlan, *, judge: bool) -> AssetResult:
@@ -380,7 +385,12 @@ def build_blender_asset(ctx: RunContext, asset: AssetPlan, *, judge: bool) -> As
sub.plan = hero_plan(sub, asset)
sub_ws.write_json(sub_ws.plan_path, sub.plan) # the sub-run's plan.json IS this plan (tools, contract gate, build)
if not (sub_ws.root / HERO_ENTRY).is_file(): # a re-entry keeps the previous session's work
- runtime.skeleton(sub_ws, sub.plan)
+ from codeverse.languages.blender import write_blender_skeleton
+
+ # the object skeleton with the hero's ground tolerance: the scene seats every clone,
+ # and 20 mm is the sink rule its module twin gets (measured 2026-09-07: 2.9 mm and
+ # 4.0 mm cost two single-shot rungs and an agent escalation each)
+ write_blender_skeleton(sub_ws, sub.plan, ground_tol_m=HERO_GROUND_TOL_M)
sub_ws.commit("skeleton")
if not ctx.single_shot:
ctx.services.materialize(sub_ws, agent_kind=ctx.agent_kind, contract_md=sub.contract_text, cookbook_rel=sub.cookbook_rel,
@@ -405,19 +415,21 @@ def build_blender_asset(ctx: RunContext, asset: AssetPlan, *, judge: bool) -> As
sub_ws.commit("asset built")
rel = asset_file(asset)
dest = _copy_glb(ctx.ws, Path(chk.glb), rel)
- result = AssetResult(name=asset.name, kind=asset.kind, ok=True, path=rel, size_m=chk.size_m, strategy=strategy, notes=notes)
+ result = AssetResult(name=asset.name, kind=asset.kind, ok=True, path=rel, size_m=chk.size_m, strategy=strategy, notes=notes,
+ clips=glb_clip_count(dest))
if _judge_wanted(ctx, asset, chk, judge=judge):
def _render(out_dir: Path):
return ctx.services.render_object(dest, out_dir, views=OBJECT_VIEWS_QUICK, width=512, height=512)
- def _after_fix() -> bool:
- oc = build_with_repair(sub, round_index=1, label=f"{label}_fix", files_hint=files, max_attempts=1,
- timeout_s=timeout_s)
+ def _after_fix(gen: RunContext) -> bool:
+ oc = build_with_repair(gen, round_index=1, label=f"{label}_fix", files_hint=files,
+ max_attempts=0 if gen.single_shot else 1, timeout_s=timeout_s)
if not (oc.build.ok and oc.build.glb_path):
return False
_copy_glb(ctx.ws, Path(oc.build.glb_path), rel)
sub_ws.commit("asset fix")
result.size_m = _measure_size(ctx, dest) or result.size_m
+ result.clips = glb_clip_count(dest)
return True
result = _judge_and_fix(sub, asset, result, _render, files=files, language=Language.BLENDER, after_fix=_after_fix)
@@ -521,10 +533,12 @@ def _volume_fraction(ctx: RunContext, asset: AssetPlan) -> float:
def _judge_and_fix(ctx: RunContext, asset: AssetPlan, result: AssetResult, render_fn: Any, *, files: list[str],
- language: Language, after_fix: Callable[[], bool] | None = None) -> AssetResult:
+ language: Language, after_fix: Callable[[RunContext], bool] | None = None) -> AssetResult:
"""Quick-sheet judge with asset_v1 (n_samples=1); ONE fix pass when below threshold,
- then the fix is checked (``after_fix``) and JUDGED AGAIN — ``score`` describes the
- asset that ships, ``score_before`` the one that was fixed."""
+ then the fix is checked (``after_fix(gen_ctx)``) and JUDGED AGAIN — ``score`` describes
+ the asset that ships, ``score_before`` the one that was fixed. The fix climbs the
+ same cheap rung as the generation: one chat call when the run has a chat model
+ (measured 2026-09-07: an agent fix session for a single-shot hero timed out at $0)."""
from codeverse.judges.base import JudgeInput
events = ctx.events
@@ -567,19 +581,20 @@ def _judge_and_fix(ctx: RunContext, asset: AssetPlan, result: AssetResult, rende
if verdict.passed or not verdict.improvement_plan:
return result
instructions = [f"- {i.target}: {i.instruction}" for i in verdict.improvement_plan[:4]]
- current = "\n\n".join(f"--- {f} ---\n{_read(ctx.ws, f)}" for f in files if _read(ctx.ws, f)) if ctx.single_shot else ""
+ gen = single_shot_ctx(ctx) or ctx
+ current = "\n\n".join(f"--- {f} ---\n{_read(ctx.ws, f)}" for f in files if _read(ctx.ws, f)) if gen.single_shot else ""
prompt = render("tracks/scene_asset.j2", **base_prompt_context(
- ctx, asset_name=asset.name, asset_kind=asset.kind, asset_description=asset.description,
+ gen, asset_name=asset.name, asset_kind=asset.kind, asset_description=asset.description,
asset_size=asset.approx_size_m, asset_file=files[0], asset_files=files, asset_language=language.value,
fix_instructions=instructions, current_code=current, skeleton_files={}, **_scene_context(ctx)))
- task = GenerationTask(label=f"asset_{to_snake(asset.name)}_fix", prompt=prompt, system=_asset_system(ctx, language),
+ task = GenerationTask(label=f"asset_{to_snake(asset.name)}_fix", prompt=prompt, system=_asset_system(gen, language),
files_hint=files, round=1, kind="asset_fix", temperature=0.4,
edit_only=language is Language.SCENE_THREEJS, timeout_s=asset_timeout_s(ctx, 120))
- res = generate(ctx.ws, agent_id=ctx.agent_id, task=task, agent=ctx.agent, model=ctx.model, settings=ctx.settings,
- budget=ctx.budget, events=ctx.events)
+ res = generate(gen.ws, agent_id=gen.agent_id, task=task, agent=gen.agent, model=gen.model, settings=gen.settings,
+ budget=gen.budget, events=gen.events)
if not res.ok:
return result
- result.fixed = after_fix() if after_fix is not None else True
+ result.fixed = after_fix(gen) if after_fix is not None else True
if not result.fixed:
return result
again = _verdict(1)
@@ -629,6 +644,18 @@ def _asset_prompt(ctx: RunContext, asset: AssetPlan, rel: str, *, language: Lang
return prompt
+def glb_clip_count(glb: Path) -> int:
+ """How many animation clips a GLB carries (its JSON chunk; no loader needed)."""
+ try:
+ b = glb.read_bytes()
+ if b[:4] != b"glTF":
+ return 0
+ (ln,) = struct.unpack_from("<I", b, 12)
+ return len(json.loads(b[20:20 + ln]).get("animations") or [])
+ except (OSError, ValueError, struct.error):
+ return 0
+
+
def _copy_glb(ws: Workspace, src: Path, rel: str) -> Path:
dest = ws.root / rel
dest.parent.mkdir(parents=True, exist_ok=True)
diff --git a/harness/tests/scene_runtime/lib/test_place_clips.py b/harness/tests/scene_runtime/lib/test_place_clips.py
new file mode 100644
index 00000000..ece96e41
--- /dev/null
+++ b/harness/tests/scene_runtime/lib/test_place_clips.py
@@ -0,0 +1,39 @@
+"""place.js clipPlayer — a Blender hero's keyframed motion reaches the scene (2026-09-07).
+
+The Blender wrapper exports keyframes as a glTF clip, the preload keeps it on the root
+(`root.animations`), `.clone()` copies it, and `clipPlayer` drives a mixer by ABSOLUTE time
+so the harness's t = 0 / 1.5 s frames are deterministic. Proven here without Blender: a
+synthetic clip (a 2 s rotation loop) on a cloned group.
+"""
+from __future__ import annotations
+
+import pytest
+from _probe import measure
+
+pytestmark = pytest.mark.node
+
+PROBE = r"""
+import * as THREE from 'three';
+import { clipPlayer } from './lib/place.js';
+const root = new THREE.Group(); root.name = 'Lantern';
+const lamp = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.3, 0.3), new THREE.MeshStandardMaterial()); lamp.name = 'Lamp';
+root.add(lamp);
+const track = new THREE.NumberKeyframeTrack('Lamp.rotation[x]', [0, 1, 2], [-0.35, 0.35, -0.35]);
+root.animations = [new THREE.AnimationClip('Swing', 2, [track])];
+const clone = root.clone();
+const tick = clipPlayer(clone, { offset: 0 });
+const lampC = clone.getObjectByName('Lamp');
+const at = (t) => { tick(t); return +lampC.rotation.x.toFixed(3); };
+const a0 = at(0), a1 = at(1.0), a15 = at(1.5), again0 = at(0), a4 = at(4.0);
+const none = clipPlayer(new THREE.Group());
+console.log(JSON.stringify({ kept: clone.animations.length, a0, a1, a15, again0, a4, none: none === null }));
+"""
+
+
+def test_a_clone_keeps_the_clip_and_the_player_is_deterministic_in_t():
+ m = measure(PROBE, libs=("place.js",))
+ assert m["kept"] == 1 and m["none"] is True, m
+ assert m["a0"] == pytest.approx(-0.35, abs=0.02) and m["a1"] == pytest.approx(0.35, abs=0.02), m
+ assert abs(m["a15"] - m["a0"]) > 0.15, "the harness's second sample (1.5 s) must differ from t=0"
+ assert m["again0"] == m["a0"], "absolute time: the same t gives the same pose"
+ assert m["a4"] == pytest.approx(m["a0"], abs=0.02), "a 2 s clip loops"