Skip to content

Official Codebase of 3DCodeVerse

Python

scene lib: the docs teach one per-frame hook, userData.update; the tick aliases stay for recorded code

gaoypengcde4caccf930
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/atmosphere.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/atmosphere.js
index 2b7a9944..87c2649a 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/atmosphere.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/atmosphere.js
@@ -400,7 +400,7 @@ function fogSheets(extent, top, heightAt) {
* light itself); `heightAt` (x, z) => y to follow terrain —
* omit it and the bank is flat and costs 20 quads; `seed` noise
* offset.
- * @returns {THREE.Group} Named `HeightFog`, with `userData.tick(t)`
+ * @returns {THREE.Group} Named `HeightFog`, with `userData.update(t)`
* driving the drift. Move the group to move the bank: the soft rim
* is inscribed in `extent`, so it never shows a boundary of its own.
* Retune later through `uniforms.uColor` / `uDensity` / `uSunAmt`.
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/canopy.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/canopy.js
index 2d9c85f9..0b9f1855 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/canopy.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/canopy.js
@@ -42,7 +42,7 @@ const LOCAL_DIR = glslLocalDir('leafLocalDir');
* Build the leaf mass for one or more crowns.
*
* Deterministic in `seed`: same seed, same leaves. Drive it from your
- * `tick()` — `canopy.userData.tick(t)` — or nothing moves.
+ * `update` — `canopy.userData.update(t)` — or nothing moves.
*
* @param {object} [opts]
* `crowns` array of `{position: [x, y, z], radius, height?, seed?}`,
@@ -77,7 +77,7 @@ const LOCAL_DIR = glslLocalDir('leafLocalDir');
* default the same way). `seed` PRNG seed (default 7). `name` group
* name.
* @returns {THREE.Group} Named `Canopy`, holding one `Leaves` mesh,
- * with `userData.tick(t)`.
+ * with `userData.update(t)`.
*/
export function makeCanopy(opts = {}) {
const crowns = crownList(opts);
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/celestial.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/celestial.js
index 05a08ff7..3ee20ccd 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/celestial.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/celestial.js
@@ -173,7 +173,7 @@ function frameGrabber(mat) {
* an engine's slow roll, more is a fire's boil); `seed` PRNG seed
* (default 5).
* @returns {THREE.Group} Named `HeatShimmer`, resting on y = 0, with
- * `userData.tick(t)`. No `ambient` escape and none needed: a
+ * `userData.update(t)`. No `ambient` escape and none needed: a
* material whose output IS the backdrop cannot brighten a frame it
* never adds to.
*/
@@ -351,7 +351,7 @@ function shimmerMaterial(strength, speed, cells, aspect, height, phase) {
* switches from ADDING to a plain blend that cannot clip; pass
* `ambient: 0.9` when the sky behind is genuinely bright.
* @returns {THREE.Group} Named `Stars`, centred on the camera's world
- * — put it at the origin — with `userData.tick(t)`.
+ * — put it at the origin — with `userData.update(t)`.
*/
export function makeStars(opts = {}) {
const count = Math.max(1, Math.round(
@@ -630,7 +630,7 @@ function auroraGlow(v) {
* The curtains are laid one per equal slice of the compass, jittered
* inside it, so a display always crosses whatever the camera is looking
* at — n independent draws leave holes a hundred degrees wide.
- * @returns {THREE.Group} Named `Aurora`, with `userData.tick(t)`.
+ * @returns {THREE.Group} Named `Aurora`, with `userData.update(t)`.
*/
export function makeAurora(opts = {}) {
const radius = opts.radius === undefined ? 1400 : opts.radius;
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/cloth.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/cloth.js
index b7e66233..238d774f 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/cloth.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/cloth.js
@@ -36,7 +36,7 @@
* All three take grass.js's `wind` (its `windOf` is imported, never
* re-read), so one scene's meadow, its wheat and its flags move as one
* wind. All three are deterministic in `seed`, and all three need
- * driving from your `tick()` — `obj.userData.tick(t)` — or the wind
+ * driving from your zone's `update` — `obj.userData.update(t)` — or the wind
* never blows.
*/
@@ -105,7 +105,7 @@ function yawToZ(dir) {
* `name` group name.
* @returns {THREE.Group} Named `Flag`, resting on y = 0, holding
* `Mast` and a `FlagSheet` whose ripple is one patched material,
- * with `userData.tick(t)` driving it.
+ * with `userData.update(t)` driving it.
*/
export function makeFlag(opts = {}) {
const width = opts.width === undefined ? 1.6 : opts.width;
@@ -365,7 +365,7 @@ const FLAG_FRAGMENT = [
* (default true); `folds` how many fold lines across the width
* (default 5); `name` group name.
* @returns {THREE.Group} Named `Banner`, holding `BannerCloth` and
- * (unless declined) `BannerRod`, with `userData.tick(t)` driving the
+ * (unless declined) `BannerRod`, with `userData.update(t)` driving the
* swing.
*/
export function makeBanner(opts = {}) {
@@ -660,7 +660,7 @@ const BANNER_FRAGMENT = [
* `name` group name.
* @returns {THREE.Group} Named `Wheat`, resting on y = 0 (or on
* `heightAt`), holding `Stalks` — ONE draw call — with
- * `userData.tick(t)` driving the wave.
+ * `userData.update(t)` driving the wave.
*/
export function makeWheatField(opts = {}) {
const extent = opts.extent === undefined ? 30 : opts.extent;
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/clouds.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/clouds.js
index a2ccd903..fd02c419 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/clouds.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/clouds.js
@@ -143,7 +143,7 @@ function cloudAtlas(seed, cirrus = false) {
* sunColor, shadeColor, alpha, wind (m/s along +x), rim (silver-lining
* strength, 0.55), haze (how far the deck may recede into scene.fog,
* 0.22 — the fog COLOUR is always the scene's), hueVariance (0.13).
- * Animate cloud drift from tick(): `layer.userData.update(t)`.
+ * Animate cloud drift from your update: `layer.userData.update(t)`.
*/
export function makeClouds(opts = {}) {
const p = PRESETS[opts.preset || 'day'] || PRESETS.day;
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flock.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flock.js
index e9747ed8..42337345 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flock.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flock.js
@@ -104,7 +104,7 @@ function _defaultPath(extent, height) {
* ([x,y,z] or Vector3) of a CLOSED loop replacing the default one;
* `size` wingspan in metres (default extent/20, clamped 0.35..2.4).
* @returns {THREE.Group} Named `Flock`, holding ONE instanced mesh,
- * with `userData.tick(t)` advancing the only thing that changes.
+ * with `userData.update(t)` advancing the only thing that changes.
* `userData.samplePath(t)` returns the local centreline point at absolute
* seconds; lateral formation offsets and individual bobbing are additional.
*/
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flowers.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flowers.js
index c68eaff2..52d86588 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flowers.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/flowers.js
@@ -21,7 +21,7 @@
*
* Both are ONE draw call whose every moving part lives in the vertex
* shader, both are deterministic in `seed`, and both need driving from
- * your `tick()` — `obj.userData.tick(t)` — or nothing moves.
+ * your zone's `update` — `obj.userData.update(t)` — or nothing moves.
*/
import * as THREE from 'three';
@@ -140,7 +140,7 @@ function siblingOf(color, kind) {
* `name` group name.
* @returns {THREE.Group} Named `Flowers`, holding ONE instanced mesh
* `Plants` whose stated box is the box it occupies at any bend, with
- * `userData.tick(t)` driving the wind.
+ * `userData.update(t)` driving the wind.
*/
export function makeFlowers(opts = {}) {
const kind = _KINDS[opts.kind] || _KINDS.daisy;
@@ -680,7 +680,7 @@ function _wrap(v, lim) {
* THROUGH a piece is read from the scene's OWN lights, so there is no
* sun to state and nothing to keep in step.
* @returns {THREE.Group} Named `Falling`, holding ONE instanced mesh
- * `Drift`, with `userData.tick(t)` advancing the fall and
+ * `Drift`, with `userData.update(t)` advancing the fall and
* `userData.sample(i, t)` giving piece i's group-local position — the
* CPU mirror of the vertex shader.
*/
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/godrays.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/godrays.js
index 9a81045b..ee2c22e1 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/godrays.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/godrays.js
@@ -73,7 +73,7 @@ const _UP = new THREE.Vector3(0, 1, 0);
* `softness` 0..1 how far the edge feathers into the air (default
* 0.55); `seed` PRNG seed (default 11).
* @returns {THREE.Group} Named `GodRays`, resting on y = 0, with
- * `userData.tick(t)` driving every shader in it.
+ * `userData.update(t)` driving every shader in it.
*/
export function makeGodRays(opts = {}) {
const count = Math.max(1, Math.round(
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/grass.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/grass.js
index 31e33cbd..cfebed4c 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/grass.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/grass.js
@@ -42,7 +42,7 @@ const LOCAL_DIR = glslLocalDir('grassLocalDir');
* Cover a patch of ground in grass.
*
* The whole field is deterministic in `seed`: same seed, same blades.
- * Drive it from your `tick()` — `grass.userData.tick(t)` — or the wind
+ * Drive it from your zone's `update` — `grass.userData.update(t)` — or the wind
* never blows.
*
* @param {object} [opts]
@@ -66,7 +66,7 @@ const LOCAL_DIR = glslLocalDir('grassLocalDir');
* default); `name` group name.
* @returns {THREE.Group} Named `Grass`, resting on y = 0 (or on
* `heightAt`), holding `Blades` (one draw call) and `Sward`, with
- * `userData.tick(t)` driving both.
+ * `userData.update(t)` driving both.
*/
export function makeGrass(opts = {}) {
const extent = opts.extent === undefined ? 24 : opts.extent;
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/merge.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/merge.js
index 9af725a4..b621e833 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/merge.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/merge.js
@@ -2,7 +2,7 @@
* Draw-call collapse for static props: many positioned meshes in, ONE
* mesh out. Software GL is DRAW-CALL-bound, making this the biggest
* SwiftShader perf lever. Never
- * merge anything tick() animates or a fix round must retarget alone.
+ * merge anything update animates or a fix round must retarget alone.
*
* The merge is also where a batch stops looking like a batch: 40 stones
* cut from one material arrive as ONE albedo, and a wall of one albedo
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/neon.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/neon.js
index b278f90d..a61e7f8c 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/neon.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/neon.js
@@ -367,7 +367,7 @@ function tubeMaterial(name, color, gain, core, hot, flicker, key, hazy,
* @returns {THREE.Group} Named `NeonTube`, guarded by
* `keepOutOfDepthPasses` (a glow card is a solid wall to the GTAO
* override pass, and a light source must cast no shadow), with
- * `userData.tick(t)` and `userData.spillSources()` — the world points
+ * `userData.update(t)` and `userData.spillSources()` — the world points
* to hand straight to `patchNeonSpill`.
*/
export function makeNeonTube(opts = {}) {
@@ -732,7 +732,7 @@ function trailMaterial(name, color, dir, count, rate, gain, hot, fore,
* @returns {THREE.Group} Named `LightTrails`, holding `TrailsWarm` and
* `TrailsCool`, guarded by `keepOutOfDepthPasses` (an additive card
* is an opaque wall to the GTAO override pass, and a moving light
- * must cast no shadow), with `userData.tick(t)`.
+ * must cast no shadow), with `userData.update(t)`.
*/
export function makeLightTrails(opts = {}) {
const strokes = toStrokes(opts.path && opts.path.length ? opts.path
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/shader.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/shader.js
index 22ee7e7d..e29eb6ed 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/shader.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/shader.js
@@ -1113,7 +1113,7 @@ export function towardRoughness(material, target, blend) {
/**
- * Drive every astra shader under `root` from one call in `tick()`.
+ * Drive every astra shader under `root` from one call in `update`.
*
* @param {THREE.Object3D} root Scene or group to walk.
* @param {number} t Scene time in seconds.
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/smalllife.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/smalllife.js
index 74cec94e..599aa37b 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/smalllife.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/smalllife.js
@@ -123,7 +123,7 @@ function sceneLight(obj, out) {
* Buys the midges over a pond at dusk, the butterflies over a meadow,
* the fireflies after dark — at one draw call and one float per frame,
* so the count can be what a real swarm is. Drive it from your
- * `tick()` — `insects.userData.tick(t)` — or nothing moves.
+ * `update` — `insects.userData.update(t)` — or nothing moves.
*
* The constraint: every insect, quad and all, stays inside the volume
* this advertises (`center` +- (`extent`, `height`/2, `extent`)), which
@@ -142,7 +142,7 @@ function sceneLight(obj, out) {
* `color` body or glow colour; `seed` PRNG seed (default 11); `name`
* group name.
* @returns {THREE.Group} Named `Insects`, holding ONE instanced mesh,
- * with `userData.tick(t)` advancing the only thing that changes.
+ * with `userData.update(t)` advancing the only thing that changes.
*/
export function makeInsects(opts = {}) {
const kind = _KINDS[opts.kind] || _KINDS.midge;
@@ -431,8 +431,8 @@ function insectMaterial(kind, size, drift, color) {
* because water damps what it holds.
*
* Deterministic in `seed`, one draw call at any count, and every
- * moving part in the vertex shader. Drive it from your `tick()` —
- * `reeds.userData.tick(t)` — or the wind never blows.
+ * moving part in the vertex shader. Drive it from your zone's `update` —
+ * `reeds.userData.update(t)` — or the wind never blows.
*
* @param {object} [opts]
* `extent` metres of the square patch's side (default 12, centred on
@@ -451,7 +451,7 @@ function insectMaterial(kind, size, drift, color) {
* `stemMesh`); `underwaterDistortion` enables a small approximate image distortion
* (default false; leave off with a refracting water surface); `seed` seed (default 11); `name` group name.
* @returns {THREE.Group} Named `Reeds`, holding ONE instanced mesh
- * `Stems`, with `userData.tick(t)` driving the wind.
+ * `Stems`, with `userData.update(t)` driving the wind.
*/
export function makeReeds(opts = {}) {
const extent = opts.extent === undefined ? 12 : opts.extent;
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/urban.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/urban.js
index b3532d55..5e9f5508 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/urban.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/urban.js
@@ -573,7 +573,7 @@ function resample(points, spans) {
* wind swing at midspan, driven by `tick` (default 0.05); `seed`
* detunes each conductor's sag and swing (default 1).
* @returns {THREE.Group} Named `PowerLines`, resting on the y of its
- * points, with `userData.tick(t)` (the sway), `userData.setViewport(px)`
+ * points, with `userData.update(t)` (the sway), `userData.setViewport(px)`
* and `userData.spans` — the measured span lengths. The cable mesh is
* guarded by `keepOutOfDepthPasses`: a transparent ribbon is a solid
* wall to the GTAO override pass.
@@ -892,7 +892,7 @@ function posterTexture(color, seed, lit) {
* points, read through the group's CURRENT matrix),
* `userData.relight()` — call it after MOVING a lit sign, since the
* spill on its own structure was aimed where it was built — and
- * `userData.tick(t)`. The halo is guarded by `keepOutOfDepthPasses`.
+ * `userData.update(t)`. The halo is guarded by `keepOutOfDepthPasses`.
*/
export function makeBillboard(opts = {}) {
const w = Math.max(0.5, opts.width === undefined ? 6 : opts.width);
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/veils.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/veils.js
index 8ef120ff..b00c6c70 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/veils.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/veils.js
@@ -237,7 +237,7 @@ function _litByScene(mesh, autoTint) {
* front of the weather; pass a colour to keep that from happening);
* `seed` PRNG seed (default 7).
* @returns {THREE.Group} Named `RainVeil`, centred on its own origin
- * with the sheets' feet at y ~ 0, with `userData.tick(t)`,
+ * with the sheets' feet at y ~ 0, with `userData.update(t)`,
* `userData.sample(i, t)` giving sheet i's foot and `userData.axis`
* the shared fall direction. Move the group to place the field.
*/
@@ -477,7 +477,7 @@ function veilMaterial(cfg) {
* hex, the flake albedo the scene's light multiplies (default a cold
* white that takes the fog's hue); `seed` PRNG seed (default 9).
* @returns {THREE.Group} Named `Snowfall`, its foot on y = 0, with
- * `userData.tick(t)` and `userData.sample(i, t)` returning flake i's
+ * `userData.update(t)` and `userData.sample(i, t)` returning flake i's
* group-local position — the CPU mirror of the vertex shader.
*/
export function makeSnowfall(opts = {}) {
@@ -671,7 +671,7 @@ function snowMaterial(cfg) {
* reaching the volume, lamps included); `seed` PRNG seed
* (default 13).
* @returns {THREE.Group} Named `Motes`, its foot on y = 0, with
- * `userData.tick(t)`, `userData.sample(i, t)` giving speck i's
+ * `userData.update(t)`, `userData.sample(i, t)` giving speck i's
* group-local position and `userData.volume` the box it stays in.
*/
export function makeMotes(opts = {}) {
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/waterfall.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/waterfall.js
index fb6dc57f..f614ea7c 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/waterfall.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/waterfall.js
@@ -189,7 +189,7 @@ export function makeWaterfall(opts = {}) {
if(!Number.isFinite(t)) throw new RangeError('Waterfall.update: time must be finite');
material.userData.uniforms.uTime.value=t;
if(foamMaterial) foamMaterial.userData.uniforms.uTime.value=t;
- if(spray) (spray.userData.update??spray.userData.tick)(t);
+ if(spray) spray.userData.update(t);
};
group.userData.sample=(u,lateral=0,t=material.userData.uniforms.uTime.value)=>{
if(![u,lateral,t].every(Number.isFinite)) throw new RangeError('Waterfall.sample: inputs must be finite');
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/woodland.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/woodland.js
index 0d45fe67..7ef6b5ed 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/woodland.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/woodland.js
@@ -457,7 +457,7 @@ function rigLight(rig) {
* renderer's own daylight rig); `wind` as `grass.js`'s `windOf` reads
* it; `name` group name.
* @returns {THREE.Group} Named `Imposters`, resting on the ground,
- * holding ONE mesh, with `userData.tick(t)` driving the lean. Add it
+ * holding ONE mesh, with `userData.update(t)` driving the lean. Add it
* at the scene ROOT: the cards billboard against WORLD axes.
*/
export function makeImposters(opts = {}) {
diff --git a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
index 35254577..f85eb08d 100644
--- a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
+++ b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
@@ -100,9 +100,8 @@ and JSON-copies typed uniforms. The library helper replays its registered chain,
copies vector/colour/matrix uniforms and borrows texture references. Custom
external `onBeforeCompile` wrappers must still be reapplied by their owner.
-**2. Moving factories carry a per-frame hook.** Prefer `userData.update(t, dt)`;
-some older factories use `userData.tick(t, dt)`. Read the factory JSDoc or select
-`effect.userData.update ?? effect.userData.tick`, then call that hook exactly once.
+**2. Moving factories carry a per-frame hook: `userData.update(t, dt)`.** Call it
+exactly once per frame.
The host drives the scene's `update(t, dt)`. Fan out in `scene.js`:
```js
diff --git a/harness/tests/scene_runtime/lib/test_library.py b/harness/tests/scene_runtime/lib/test_library.py
index bda56289..b243b779 100644
--- a/harness/tests/scene_runtime/lib/test_library.py
+++ b/harness/tests/scene_runtime/lib/test_library.py
@@ -17,7 +17,7 @@ import pytest
from codeverse3d.languages.scene_threejs import lib_files
from codeverse3d.prompts import PROMPTS_DIR
-from tests.scene_runtime.lib._probe import compile_scene, measure
+from tests.scene_runtime.lib._probe import LIB_DIR, compile_scene, measure
from tests.scene_runtime.lib.test_patch_union import LIBRARIES as PATCH_UNION
pytestmark = pytest.mark.node
@@ -364,3 +364,18 @@ export function createScene({ renderer }) {
}
""", ("firefield.js",), audit_module="src/scene.js")
assert code == 0, out
+
+
+def test_the_per_frame_hook_is_taught_as_update_only():
+ """Every moving factory sets `userData.update` (and keeps a `tick` alias, which 72
+ recorded zone/env files call); the docs used to teach `tick` while the cookbook
+ calls a hook named `tick` the `nothing_moves` cause. The docs say `update`."""
+ taught, unaliased = [], []
+ for p in sorted(LIB_DIR.glob("*.js")):
+ src = p.read_text(encoding="utf-8")
+ taught += [f"{p.name}: {ln.strip()}" for ln in src.splitlines()
+ if re.match(r"\s*(\*|//)", ln) and "userData.tick" in ln]
+ if "userData.tick =" in src and "userData.update" not in src:
+ unaliased.append(p.name)
+ catalog = (PROMPTS_DIR / "scene_threejs" / "effects_catalog.md").read_text(encoding="utf-8")
+ assert not taught and not unaliased and "userData.tick" not in catalog, (taught, unaliased)