* feat(engine): reload external .ecproj edits into the live session
Adds a project-file watcher on a worker thread (size + mtime stamps,
250 ms debounce, 1 s focused / 5 s unfocused) that wakes the UI only when
the open project's file changed. The UI applies the change on its own thread
through the existing file.revert -> replace_project path, so CLI/MCP edits
show in the running window without a restart.
Session.project_stamp is recorded on open/save so the app's own writes do
not reload themselves. A dirty session, active script or render job holds
the change and surfaces a status instead of discarding work; autosave is
paused while a change is pending.
Closes#4168
* fix(engine): close stamp races and correct reload guidance
- record the stamp only when the saved bytes are still on disk, so a
concurrent external write is not mistaken for our own save
- read the project and its stamp as one observation when opening, retrying
if the file changes mid-read
- install the watcher baseline with the loaded session stamp under one lock,
and advance it only after the debounced change is published
- add tests for self-save acknowledgement, dirty guard and autosave pause
- replace the misleading Save-before-Revert status with Save a Copy guidance
Addresses CodeRabbit review on PR #4170
* fix(engine): handle unverified saves and stale reload reports
A save whose post-write byte check fails is marked unverified so the watcher
reports the first stamp of that path as an external edit instead of adopting
it as a baseline. Before reverting, compare the on-disk stamp with the
session stamp so a completed self-save does not discard undo history. Defer
reload while a script is waiting on a file dialog. Drop a failed reload
observation so it is retried only after a new stamp, not every frame.
Addresses the second CodeRabbit review on PR #4170
* fix(engine): require known stamp for reload shortcut and cache disk stamp
The stamp-matching shortcut only applies when the session stamp is known;
an unknown stamp keeps the observation pending. The on-disk stamp is read
once when a watcher observation is taken and carried through deferral,
avoiding file I/O on every frame.
Addresses the final CodeRabbit review on PR #4170
* fix(ui): keep recovery auto-saves while an external edit is pending
Auto-save writes recovery copies to their own files, never the project
file, so pausing it while a reload was pending only removed crash
recovery for unsaved local work. Keep it running, and hold it only when
the recovery target would alias the open project file.
Adds a regression proving the external project and the local recovery
copy both survive, and corrects the spec's wrong premise.
* fix(ui): check the autosave alias only on a due write; test every reload guard
Move the project-alias check into the engine write path
(autosave_tick_guarded) so it runs on the final WritePlan only when
auto-save is enabled and a write is due; idle frames do no file-system
work. Add regressions holding a pending external change for an active
script render, an open script file dialog and an active render job.
* test: add ignored measurement benches for the #4168 budgets
frame_tick_cost_of_project_reload: per-frame A/B of the UI tick with and
without tick_project_reload (p50/p95/p99/max over 100k ticks).
watcher_idle_cpu_and_reload_memory: watcher-only idle CPU (focused and
background), write->detect latency and RSS over 100 external saves.
* fix: rustfmt and strict clippy on the project reload watcher
Rewrite the watcher's recv loop as a while condition (clippy::while_let_loop)
with unchanged behaviour: a wake or a poll timeout runs one check, a dropped
Watcher (channel disconnected) ends the thread. Collapse the pending-change
if into its let chain, keep unwrap() inside test functions only, format both
files, and normalise project_reload.rs to LF like the rest of the tree.
---------
Co-authored-by: matthewdonsemail-lab <matthewdonsemail-lab@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* Effect Controls: edit Dropdown Menu Control items (#3645)
* Keep text undo with its dropdown item after reordering (#3645)
* fix(ui-egui): name Dropdown editor row actions by item
The string-list editor's up/down/remove buttons exposed only their glyphs
(↑ ↓ −) as AccessKit names, so a screen reader announced identical actions
on every row. Name them "<glyph> <action>, item N" (glyph first, translated)
and name each text field "Item N".
Adds a headless test that reads the accessibility tree with two items.
* test(ui-egui): install the headless runtime in the Dropdown editor tests
main now requires the runtime plugin in every test harness (e34fc9ec), so
the three Dropdown editor tests failed while building the app, before any
assertion ran. Install it the way the other Effect Controls tests do. The
assertions are unchanged.
---------
Co-authored-by: WillPastor <47420496+WillPastor@users.noreply.github.com>
* feat(i18n): add Arabic (ar) UI localization and RTL support
* fix(i18n): correct hideOthers label and avoid auto-selecting Arabic without bundled font
* fix(i18n): allow explicit requested ?lang=ar while preserving auto-selection exclusion
* refactor(i18n): separate catalog to craft-i18n and keep RTL wiring in app
* fix(i18n): gate native Arabic on catalog loading and fallback Web stored preference
- Gate native Arabic availability in Settings and language() on loading the catalog
- Keep Arabic out of the Web picker and fall back stored 'ar' preferences to English on Web
- Add tests verifying the Web preference fallback and real Arabic translation on native
* fix(i18n): remove literal Arabic Services label (AGENTS.md §16) and isolate test fixture
* test(i18n): require catalogs for all shipped languages (AGENTS.md §31)
* Render log: say why a GPU project renders on the CPU, and name the GPU adapter (#3727)
* WebM: the header, the size patch and delivering the file count as writing time; last_timing says whose it is (#3732 review)
* Export timing: label the initial compositor and attached GPU adapter, count frames that fell back to the CPU later
The timing line says "Initial compositor" and "attached GPU adapter" for the choice made at the
start. A frame asked of the GPU that ends with the GPU unavailable is counted in the new
gpu_fallback_frames, and the line reports it as "Later GPU fallback: N of M frames rendered on
the CPU after the GPU became unavailable". New test:
a_gpu_lost_after_the_start_is_reported_apart_from_the_initial_choice.
* Export timing: frames the probe drops do not count as a later GPU fallback
A device lost while Auto measures makes the job pick the CPU and drop the GPU's measured
frames, so only frames of a job that chose the GPU are counted.
* Export timing: count a GPU fallback when the frame is rendered, not from the adapter afterwards
The renderer now notes per frame whether the accelerator declined it while unavailable
(Renderer::comp_frame_noting_gpu_loss, passes::comp_frame_noting_gpu_loss), and the export
counts that. A frame the GPU rendered no longer counts when another frame in flight loses the
device before it is counted. The test renders two frames at once: frame 0 on the GPU while
frame 1 loses the device.
* Deferred readbacks: a frame that goes to the CPU after missed passes says whether the device was lost
in_passes records why it renders the frame without the accelerator (Passed::gpu_lost: the
device is no longer available, not passes run out on a healthy one), and
passes::comp_frame_noting_gpu_loss passes that on instead of dropping it with .value. New test:
a_deferred_frame_on_the_cpu_says_whether_the_device_was_lost.
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* Text: Character and Paragraph changes reach all selected text layers (#2862)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Text: `layer.setText` reaches several layers through `selected` alone (#2862)
Drops the `layers` param, its docs/agents.md note and the tests that covered
only it or the merge key. The panels' behaviour is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Text: the layer-wide stroke order leaves a locked shown layer alone (#2862)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Text: `selected` with no layer to change is a no-op, and a per-character order resets them all (#2862)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Text: the panels show the first unlocked selected layer, not a locked one above it (#2862)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Properties: text rows change the edited layer's characters when another layer is first selected (#2862)
While a text layer was edited in the viewer and another layer was first in
the selection, the Properties text and paragraph rows dropped the edit's
range and changed the first layer's whole text instead. They now follow the
edited characters, as the Character panel does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2862: the text eyedropper writes to the layers that armed it
A whole-layer Fill or Stroke pick sent `selected: true` when it sampled, so
it reached the selection at the click, not the layers selected when it was
armed: with A+B armed and the selection changed to A+C, C took the colour.
The pick now captures the selected text layers when armed, and the viewer
sends them as `layer.setText {layers}`, skipping any that were deleted and
cancelling when none is left. `layer.setText` takes an explicit `layers`
list: the unlocked text layers in it change, whatever is selected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2862: the new text tests install the headless runtime like main's harnesses
Main's craft-libs runtime now refuses frames from a harness without its plugin (e34fc9ec), so the eight new Character tests build their harness with `framework::install_headless` too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2862: layer.setText refuses an explicit target it can't honour
A `layers` value that isn't a list, or a list given with a `range`, fell through to the layer and selection path and could edit a layer the caller didn't name. Both are now an error before anything changes. Without `layers`, the named layer (or the selection with `selected`) is still the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: a mesh that spreads a pin's pull and keeps its area (#2866)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: adding a pin and solving agree on what the pin holds (#2866)
`puppet.addPin` chose a new pin's position by whether the click was on the deformed mesh, while the solve
chooses what the pin holds by whether its rest point is on the rest mesh. On a turned mesh a click just
off the outline unmaps to a rest point on the mesh: the pin held that point, but at the click, which
pulled the mesh over (6 px at a third of a turn).
Both now use `puppet::held_point`, and a pin that holds a point goes where that point is now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tests: the off-mesh pin test checks a pin was added (#2866)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: a solve that fits a frame, shared by drawing and the overlay (#2866)
The solve was redone for the overlay after drawing, ran every refinement round however little they
moved, and built a fresh banded factor for each of up to five sets of stiffened weights, with room
for one of 320 MB.
- A round that moves no vertex 1e-4 px ends the refinement. On the far drags, the push, the cross
and the S curve that changes no vertex by 1e-4 px, at 40 rounds or 200.
- Stiffened weights refactor into the same storage in the same order, and the factor's inner loops
run over slices (same sums in the same order, so the same numbers).
- The factor is capped at 8 million values (64 MB). The densest mesh the tool builds (a target of
20,000 triangles) needs 4.7 million; past the cap conjugate gradients solve the same system.
- Drawing and the overlay (`puppet.info`, adding a pin, the Puppet tools) share one cached solve.
On a 1280x720 solid with a far drag: 20,000 triangles 15.3 s to about 2.7 s, 10,000 2.2 s to about
0.8 s; with the pins at rest, 5.4 s to about 1 s.
The module doc now describes point pins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tests: pin edge cases, the refinement mapping and smoothing (#2866)
- Mesh Rotation Refinement to rounds: the default (40), 0, negative, past the maximum, NaN and
infinities.
- A pin on a vertex holds that vertex; one on an edge between two triangles holds the same point
through either; one off the outline by round-off holds the point on it, and one further off its
nearest vertex at the same offset; a Bend pin alone keeps its vertex in place.
- Smoothing falls back to the solve when the vertices don't match the mesh or no split is worth it,
and every small triangle lies in the triangle its `parent` names.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: the drawing keeps pins on their points and overlapping sheets apart (#2866)
- Smoothing bent the drawn mesh away from the points pins hold inside triangles: on the far drags
and the S curve the image under a pin landed up to 10 px from it. The vertex gradients the
smoothing uses now take the least change that puts each held point where the solve did (a few
sweeps for pins sharing a vertex); edges still depend only on their two vertices, so no cracks.
- A 2x2 sample cell shared by two overlapping sheets coloured all its samples with the first
sheet's read. A sheet whose source disagrees with the first's by more than 2 px now reads its own
colour at its own first sample, weighted by its own samples; one sheet's cells read as before.
- The solver comparisons check both solves are the same length and finite before measuring how far
apart they are (`f64::max` skips a NaN).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: held pins stay on their points together, and a narrow sheet in a pixel keeps its colour (#2866)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Puppet: the solve follows pins smoothly past what the mesh can give (#2866)
Stiffening triangles from the last solve's shape swung from pass to pass when
pins asked for more than the mesh could give, so half a pixel of drag moved
it hundreds of pixels. The stage is removed; the stress tests' limits are
set to what the solve now gives.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2866: bound the Puppet solver's pin system and keep saved rigs' look
The drawing's hold on pinned points solved one dense system over every
held pin: n x (n + 2) values and O(n^3) elimination per render, with n
uncapped. Points only meet through shared mesh vertices, so the system
now splits into groups of linked points; a group of up to 128 points is
solved exactly as before, a larger one by 32 passes of cyclic
projection, so memory and work grow linearly with the pin count.
Rigs saved before this change keep their look: a hidden Solver Version
parameter defaults to the current solve for new instances, and
migrate::legacy_default gives instances saved without it the first
solve, which renders through puppet/legacy.rs (main's solve and
drawing, bit-identical on four test rigs). The overlay and addPin's
placement follow the rig's version.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* Reversed keyframes keep the shape of manually eased value curves
Time-Reverse Keyframes and Paste Reversed Keyframes swapped the ease sides
but kept the signs of numeric component speeds, which are signed value
slopes. Mirror them now, while spatial and Orientation speeds along the
path or arc and progress eases of paths stay positive.
Fixes#4273
* Paste Reversed Keyframes flips ease speeds by the property pasted into
The sign of the speeds was decided by the copied property, so Scale keys
pasted reversed into Position got negated speeds, which run a motion path
backwards. Paste Reversed now swaps the sides and keys.paste flips the
speeds for each property the keys land in: value curves flip, motion paths
and Orientation stay positive.
* Shapes: Add Merge Paths merges what's above it and paints the result (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tests: check the fix directly instead of assuming history or the tool's colour
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: only the Add menu's Merge Paths gets Mode Add and a paint (#2175)
Scripts keep Mode Merge and their own list: `layer.addShapeItem` does what
it did unless the menu passes `paint`, so the public `append` option goes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: Add Merge Paths' gradient runs across paths with no paint yet (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: a Repeater below an added Merge Paths doesn't widen its gradient (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: a Stroke among the paths doesn't widen an added Merge Paths' gradient (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: Add > Merge Paths gradient ignores an open line apart from the shapes (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Shapes: format the Merge Paths gradient test (#2175)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2175: saved projects keep their Merge Paths artwork
The renderer now drops every draw above a Merge Paths, as After Effects
does, so a project saved with painted groups above a Merge Paths and no
paint below it reopened blank (and exported blank).
Merge Paths gets a hidden Keep Group Paint property. New merges have it
off and render the After Effects way. A Merge Paths without it was saved
before this change: opening the project adds it on
(build::upgrade_shape_contents, next to Wiggle Paths' Spatial Phase),
and with it on, or missing, the renderer keeps the pre-#2175 rule
(drop only the paint above the merge in its own group, #1174), so saved
artwork renders as it did, with or without paint below the merge.
Tests: the #1174 pixel assertions come back as a saved-project case in
the render tests (as saved and as opened), and an engine test opens a
project file in the pre-PR shape, renders it, saves and reopens it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: Shift on an edge handle keeps the layer's proportions (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tests: check the fix directly instead of assuming history or the tool's colour
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: one uniform branch in drag_ratio, and trim the Shift edge test (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: a Shift-dragged edge on the anchor keeps its scale wherever the press caught it (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: a Shift-dragged handle takes no snap that would throw it past the snap distance (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: a dragged handle's snap feedback shows only the snap it took (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: a Shift-dragged handle's snap feedback marks a point only when both axes land (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Viewer: a point a Shift-dragged handle reaches on one axis shows as the line it reached (#2860)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2860: group snap_handle's inputs instead of allowing the lint
The handle geometry (handle, anchor, layer-to-comp matrix, scaled axes,
Shift) moves into a HandleDrag struct, so snap_handle takes four
arguments and no longer needs allow(clippy::too_many_arguments) (rule 13).
No behaviour change; the tests keep their assertions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <51426701+FredApps@users.noreply.github.com>
* Gradient stops given out of order in automation JSON sample as if in order
Opacity stops of the plain form, and colour and opacity stops of the typed form, are sorted by position (stably) when coerced, as the plain form's colour stops already were.
* Gradient stops at positions 0 and -0 keep the order they were given in
The stop sort used total_cmp, which puts -0.0 before 0.0 although both are
the same position, so a stable sort reordered such stops. Compare equal
positions as equal, for colour and opacity stops in the plain and typed forms.
* render queue: multi-select items and add several comps at once (#3726)
* render queue: Delete acts on the selection keyboard navigation just moved to
* render queue: install the headless framework in the selection tests
* render queue: Delete and Edit > Clear use the final selection; null items is an error
* render queue test: require every batch output to resolve
* Timeline: box selection selects keyframes live while it is dragged (#2858)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Timeline: a Cmd/Ctrl box over keys alone adds to the selection, as Shift does (#2858)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Timeline: a box over keys alone clears the earlier selection first, as main's box does (#2858)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #2858: marquee keeps its live selection in the UI and commits through commands
While a Timeline box is dragged, what it would select is a UI-side preview
(`TimelineState::marquee_preview`) that the rows draw as the selection; the
engine's selection is not written. The release runs main's `layer.select` and
`keys.select`, and Escape or any other end just drops the preview, so the
direct `Before::restore` writes are gone and the command journal replays to
the live selection (AGENTS.md rule 14).
Tests replay the journal on a fresh session after a Shift box that grows and
shrinks, and after a box cancelled with Escape; both fail on the previous
commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat: use craft-nightly for nightly profile isolation
* fix(nightly): answer bare version queries before profile resolution
* test: update version query unit test in main.rs for craft-nightly
* test(media): make cancelled draft-switch regression deterministic
* test(media): assert a submitted picture before cancelling the mode switch
---------
Co-authored-by: Fredrik Hallin <fredrik.hallin@guidelinegeo.com>
winit loads libxkbcommon-x11.so at runtime on X11. The .deb and .rpm
declared only libxkbcommon0, so on an X11 system without the X11 part
the app panicked before opening a window ("Library libxkbcommon-x11.so
could not be loaded", exit 101). Recommend it next to the other X11
libraries.
* Close texture-pool encoders after failed GPU submissions
* Register pool encoders only after device creation succeeds
---------
Co-authored-by: Fredrik Hallin <fredrik.hallin@guidelinegeo.com>
* Recover the session if a script host loses its reply channel
* Reject oversized bridge requests before sending any bytes
* Keep pre-script undo history when a failed host leaves a group open
---------
Co-authored-by: Fredrik Hallin <fredrik.hallin@guidelinegeo.com>