@motion-script/core / serializeScenePrecomp
Function: serializeScenePrecomp()
serializeScenePrecomp(
precomp):SerializedScenePrecomp|null
Defined in: runtime/precomp-cache.ts:84
Reduce a scene's pass to JSON-safe values, or return null if it holds
something that cannot survive the round trip.
Returning null rather than a lossy entry is the whole safety story here: a
cache that silently drops an asset reference or an audio automation curve would
produce a subtly wrong timeline on the next run, which is far worse than simply
measuring the scene again. Callers treat null as "this scene is not
cacheable" and fall back to a real pass.
Two things trigger it:
- A loader record.
LoaderRecord.loadis a live closure owned by the requesting package, and a function cannot be revived from JSON. (No built-in path produces one today — the sole caller is gated behind a View3D resource loader that nothing registers — so this is a guard against a future regression, not a common case.) - A curve-valued audio filter param.
Curveis a class whose segments carryEasingFunctions; reviving one would need an easing registry keyed by name. Detected viafiltersKey, which already has to enumerate every param of every filter type for playback identity — so this check cannot drift out of sync as filter types are added.
Parameters
precomp
Returns
SerializedScenePrecomp | null