Optimize a .riv file (lossless)
riv_optimizeShrink a .riv file without changing visual output by removing unreferenced objects and thinning redundant keyframes on linear-only tracks, with dry-run planning.
Instructions
Shrink a .riv without changing its visual output: remove unreferenced objects (dangling easing interpolators, fired-events nothing points to, empty keyframe tracks left over from prior edits) and thin redundant keyframes on strictly-linear-interpolation runs within a tolerance. Only runs where every segment is linear are touched — any run touching hold/cubic easing is left alone, so no easing gets shifted (see keyed_property.cpp semantics: a KeyFrame's interpolationType applies to the segment going INTO the next frame). Colors and id-keyframes (soloActive) are never thinned, only numeric (KeyFrameDouble) tracks. Each step is a boolean that is on by default (set it to false to skip that step), and the run is idempotent/safe to repeat. Use dryRun=true to see the removal/thinning plan without writing anything. Run riv_lint afterwards if in doubt.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "riv_optimize"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Source .riv path | |
| dryRun | No | Report the plan only; don't write anything (default false) | |
| outPath | No | Output path (default: overwrite source) | |
| tolerance | No | Thinning tolerance as a ratio of each track's own value range (default 0.01 = 1%, conservative) | |
| thinKeyframes | No | Douglas-Peucker thin redundant keyframes on linear-only runs (default true) | |
| removeUnreferenced | No | Remove unreferenced interpolators/events/empty tracks (default true) |