mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-21 11:13:40 -05:00
A path's vertices and its two tangent arrays deserialize independently, and nothing on load makes them agree. mask.new pads them, but a path read from a project file may carry fewer tangents than vertices. mask.addVertex checked its index against the vertices only and then inserted into both tangent arrays, and mask.setVertex indexed the tangent arrays after the same check, so either command panicked on such a path (Vec insert/index out of bounds). ShapePath::fit_tangents gives both arrays one entry per vertex (missing tangents become corners, extras are dropped), and edit_path_counted calls it on the value it edits, so every mask/shape-path vertex command works on a consistent path. Other keyframes of an animated path were already padded by apply_count_op when the vertex count changes. Tests: two regression tests save a project, cut every mask path's tangent arrays to one entry (static value and keyframes), reopen it through Project::from_json and run setVertex and addVertex. Both panic at mask.rs:209 without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>