Commit Graph

1196 Commits

Author SHA1 Message Date
arnav-hiwarkar 565ab57821 fix(ui): the Revert question does not open with Revert focused
The shared question focuses its accepting answer as it opens, which for
Revert is the button that discards work, so Space answered it. The frame
now drops that opening focus right after the dialog host ran, leaving no
button focused until Tab or a click moves it. The agents doc no longer
says Enter answers Revert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 15:33:45 +05:30
arnav-hiwarkar f7f50891cf fix(ui): ask about unsaved changes with the shared dialog
Every close, open/new over a modified project, Quit, window close and
Revert now asks with craft_ui's UnsavedChangesDialog on the app's dialog
host (document wording; Revert uses CloseScope::Revert). The custom
modal, its automation ids and its now-unused words are gone. Don't Save
is Cmd+D (was Cmd+Backspace); Revert answers Enter (was Cmd+R).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 15:28:35 +05:30
Nazar 2b62873310 perf(ui): the Puppet overlay and the Layer panel preview render off the UI thread (#2516) (#4411)
* Puppet tools: a precomp layer's overlay is evaluated off the UI thread (#2516)

With a Puppet tool active, the viewer evaluated the selected layers' Puppet meshes and pins on
the UI thread once per project revision. A precomp layer's input has no layer-cache key, so
every edit anywhere (each Position or Scale change, every drag step) re-rendered its whole nested
composition at full size on the UI thread, and the whole window slowed down.

`Renderer::layer_input_cacheable` tells whether a layer's input is kept by the layer cache, and
`PuppetSource` evaluates a Puppet from shared parts. Cacheable inputs are still evaluated in the
frame; the rest are evaluated on a worker, one at a time, the layer's last overlay drawn until
the new one lands. Only a layer's first overlay is waited for, at most 16 ms.

In a 4K comp with a precomp of four large solids, a Position edit with the Puppet tool active
went from 48 ms to 20 ms to its frame, the same as with the Selection tool.

* Puppet tools: take an inline overlay before waiting; doc fixes

On the web the overlay is evaluated inline and sent before the frame
waits for it, and recv_timeout reads the clock, which std doesn't have
there. try_recv takes the inline result first; only with nothing yet
and no overlay to draw does the frame wait.

layer_input gets its own doc comment back (layer_input_cacheable's had
been appended to it), PuppetSource's fields are documented, and its doc
says it borrows.

* refactor(render): one key function behind layer_input and its cacheable check

layer_input_cacheable re-derived the layer cache key beside
whole_layer_input instead of asking it, and the two had already fallen
out of step: the part-read footage filter (#3271) and the content key
were added to the render path only.

Neither changes the answer today. layer_input renders with whole_raster
set, which turns the footage filter off, and the content key keeps every
key input_key gives, so this is not a behaviour fix. It removes the
second derivation so that the next filter added to the render path
cannot silently leave the predicate behind -- which matters, because
callers decide by it whether to render off the UI thread.

Both now ask Renderer::whole_layer_input_key.

* perf(ui): the Layer panel renders its preview off the UI thread

Double-clicking a clip opens it in the Layer panel, and the preview then
rendered in the frame: a source decode, the masks and the effects up to
the View choice, on the UI thread, whenever the render key changed. The
key holds the current time and the project revision, so that was every
step of a scrub and every edit anywhere in the project. Scrubbing in the
panel stalled the whole window.

render_tex now drives a slot: a frame starts the render on a worker and
draws the panel's last texture until it lands, repainting when it does.
One render at a time, so a fast scrub drops the frames it passed over
instead of queueing a render for each. A frame waits (16 ms) only when
there is nothing to draw yet, and takes an inline result with try_recv
before reading the clock, which the web has none of. An empty render is
kept under its key, so a layer with no pixels is not retried every frame.

The same cost #2516 reported under the Puppet tools, fixed the same way;
the layer cache still makes a repeat cheap.

Trade-off: on a paint-stroke release the baked image lands a frame or
two later instead of synchronously, so the stroke can blink once as the
drag overlay hands over. Waiting in the frame is what #2516 says not to
do.

* fix(ui): a pin's turn and scale gesture starts from the project, not the drawn overlay

CodeRabbit on #4411. A rotate or scale drag seeded Gesture::PuppetRotate
and PuppetScale from PinHit, whose rotation and scale come from the
overlay on screen. Since that overlay may now be one a worker rendered
for an earlier revision or time, and puppet.setPin writes an absolute
value, the drag's first frame could write a stale base back over the
pin's current turn or scale. Undo recovers the edit but not the lost
value. Before the overlay moved off the UI thread it was always current
in the frame, so this is a hazard the move introduced.

The gesture now reads the pin from the project at the press.
PuppetSource::params flattens the Puppet effect's parameters without
rendering the layer's input -- puppet::parse builds the pins from those
alone -- so pin_now costs nothing on a press.

Only Advanced and Bend pins are affected; Position pins have no
rotation. Pin movement never was, as it follows the cursor.

The test covers pin_now's contract -- the project's turn, not the drawn
one -- rather than the whole press-and-drag path, which would need a
render in flight at a precise moment.

* docs(gaps): gap 5 says the Layer panel preview is addressed

CodeRabbit on #4411. The row still described the preview as rendered on
the UI thread at every scrub step and edit, while the revision history
in the same file said it had moved off. The row now reads as addressed
for both panels, and notes that each draws its last result while the
new one renders.

* test(ui): the pin-turn test does not depend on worker scheduling

CodeRabbit on #4411. The test called overlay() again after changing the
turn and asserted the result was still the old one. That holds only
while the worker has not finished between the spawn and the try_recv
that follows it -- OVERLAY_GRACE being zero stops the frame waiting, not
the worker completing -- so the assertion was a timing one, which
rule 28 asks tests not to make.

The call is gone. The overlay a gesture would be seeded from is the one
already in hand from the previous step, and an overlay already rendered
keeps reporting the turn it was rendered for however the next worker is
scheduled. The test now asserts the relation that matters -- the turn
the project holds differs from the one that overlay holds, and pin_now
reports the project's -- against that value.

No barrier or injected pending result: the race goes away by not making
the racy call, rather than by adding a test hook to the overlay path.

* fix(ui): the Layer panel never draws another layer's picture

The panel has one render slot and drew its last texture whatever it was
rendered for, so switching layer or comp showed the old picture until the
new render landed. The slot now hands out a texture only for the same
comp and layer. Also update two comments that still said "synchronously".

* fix(ui): the Layer panel never draws a closed project's picture

Comp and layer ids restart in every project, so the render slot could
hand the last project's texture to the new one. The render key now
includes the project epoch.

* fix(ui): the Puppet overlay never draws a closed project's pins

Comp, layer and effect ids restart in each project, so the overlay
key now includes the project epoch and effect, and only an overlay
of the same ones stands in while a new one renders.

---------

Co-authored-by: Simon Hull <5488089+simonhull@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-12-04 10:08:44 +01:00
Bar Borer eb630e222c #4368: Add / Match / Remove Grain gain After Effects' missing controls (#4369)
* #4368: Add / Match / Remove Grain gain After Effects' missing controls

Shared grain groups (crates/effects/src/grain_shared.rs), all functional:
- Application > Channel Balance (9 per-channel shadow/midtone/highlight multipliers)
- Sampling > Source Frame, Noise Sample Points 1-10 (used by Sampling Process "Manual"),
  Match Grain's per-point Intensity 1-10
- Blend with Original: Amount, Combine Match and Mask Using, Blur Matte, Color Matching
  (RGB / Hue / Chroma, tolerance, softness, invert) and Masking Layer (layer, mode, size fit)
Remove Grain: Channel Noise Reduction (R/G/B), Chroma Suppression, Noise Size Bias,
Clean Solid Areas.

New instances follow After Effects' Effect Controls order; saved instances keep their
stored order and get the new controls with defaults that render unchanged (Source Frame
-1 = the frame being rendered for projects saved before it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: grain sampling review fixes

- Manual Noise Sample Points skip boxes whose surround reaches transparent pixels (the
  automatic rule), and each kept box keeps its own point's Intensity.
- Remove Grain measures a fixed Source Frame that is the current frame before Temporal
  Filtering, as other frames are measured; Source Frame -1 keeps the old measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: Match Grain's historical Masks choice no longer samples the unmasked Source

Historical mask reads aren't available, so layer_sample_frame returns None for
the Masks choice and the caller falls back to the current-frame layer_masks
read. Source and Effects & Masks historical reads are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: Masks at a historical Source Frame; legacy Roto Brush keys with grain above

Match Grain's Masks choice at a historical Source Frame now samples the
layer with its masks as they are at that frame: EffectHost gains
layer_masks_at (default None, the current-frame fallback), and the
renderer's FxHost implements it like layer_masks at another time.

Roto Brush Input Keys saved by 0.24 hash the effects above the brush.
Opening an old project adds the grain effects' 89 new controls and
Manual to Sampling Process, so the legacy text now leaves the added
controls out while they hold the value an old project gets (Source
Frame -1 via legacy_default) and restores Sampling Process's 0.24
options. The ADDED_SINCE_0_24 mechanism is taken as-is from #4374
(with an Added::Legacy variant and a POPUPS_0_24 table added).

Tests: grain_shared historical Masks test, render
layer_masks_at_reads_the_masks_of_that_time, legacy.rs unit tests and
an analysis_signature test on an old project with grain above a frozen
brush (fixture grain-0.24.json written by the pre-#4368 code). That
last test is #[ignore]d: its 0.24 key derivation did not reproduce the
base fixture's key in a local run.

Not compiled locally after the final edits; CI is the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: un-ignore the grain legacy Roto Brush key test

The test reproduced 0.24's Roto Brush Input Key from the fixture as opened, but the fixture's
3D Camera Tracker (above the brush) holds a stand-in Solve that 0.24 didn't have when it made
the key: the first edit clears it (camera_track::invalidate), and only then does the legacy text
give ROTO_INPUT_0_24. The derivation now adds a render queue item first, as the fixture's own
test does, and the test runs again.

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>
2026-12-04 10:07:24 +01:00
Bar Borer d46f2083f0 #4368: Immersive Video (VR) effects: add missing After Effects properties (#4370)
* #4368: VR effects: field of view, glitch transform/sub/noise, gradient points 6-8, converter sizing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR effects: address review (partial-FOV gradient points, plane-to-sphere source, work-scale controls, target restriction)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR sphere-to-plane: no panic on sub-pixel cube faces or empty images

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR effects: empty eyes skip the filter, wrap_pad accepts empty images

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR Output Frame Width projects from the source; Fractal Noise generates only the visible crop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR Digital Glitch: scanline spacing in output pixels on a reduced work image

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR cube-map input: clamp to the pixel centres inside a face with fractional edges

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: VR review fixes: minification filtering, partial-field scanlines, legacy stereo Plane to Sphere, FOV canvas cap

- VR Converter / Sphere to Plane: when Output Frame Width resizes the frame, the projection
  averages a grid of samples over each output pixel's source footprint (measured from the
  neighbouring pixels' source positions, up to 8 x 8), staying inside the source eye and the
  cube face of the pixel's centre. Unresized conversions are unchanged (and match the GPU).
- VR Digital Glitch: on a reduced work image (narrow field of view) scanlines are drawn
  afterwards at the eye's own resolution, keeping Target Point attenuation, so the default
  spacing of 2 still alternates rows instead of tinting evenly.
- VR Plane to Sphere: a hidden Split Eyes version flag (legacy default off on upgrade, off
  when missing) keeps projects saved before the per-eye placement rendering a stereo frame as
  one sphere on the GPU path; new instances split the eyes. Golden from origin/main 9dcb8871.
- Partial field canvas: the 4x-frame-pixels cap is enforced after rounding to whole pixels and
  the one-pixel minimum (floor: the canvas of a one-pixel eye).

Regression tests: shrinking_output_frame_width_keeps_minification_filtering,
partial_field_scanlines_alternate_at_the_default_spacing,
partial_field_canvas_stays_within_its_pixel_budget,
migrate::legacy_stereo_plane_to_sphere_renders_as_before.

Not compiled locally after the final test tweak; CI is the check. An earlier local run of
the vr:: and migrate:: tests compiled and passed all but one test bound, since narrowed to the
middle of the view. Clippy not run locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 09:23:51 +01:00
Bar Borer f1be334ce1 Composition Mini-Flowchart: Tab opens it from the Timeline and viewer, arrows walk the whole chain (continues #1338) (#4347)
* Composition Mini-Flowchart: Tab from the Timeline and viewer, focus navigation with every branch, as in After Effects

From #1338 by Themolx, ported onto the split module layout (#2491):
the Tab claim moved to menus/shortcuts.rs, the command to
menus/frontend.rs, the frame hook to app/frame.rs, and the tests to
tests/it/ (one binary).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: Tab reaches it past the window runtime; pills, edge stubs and the review fixes

On current main the craft-ui window runtime takes a plain Tab for the
whole window (keyboard traversal) before the app sees it, so Tab still
never opened the Mini-Flowchart (#3772). The raw-input hook now holds the
popup's keys back from the runtime and egui when Tab is the
Mini-Flowchart's (or the popup is open), and the frame hands them back
first. Tab stays traversal once Tab or Shift+Tab has moved the keyboard
focus, until the next pointer press.

Look: comps are pills joined by curved links; every outer comp has a
stub at its outer side, an arrow where the chain goes on (click shows
that level) and an end bar where it stops. The link back the way the
focus came is drawn in the accent. Long names end in an ellipsis with
the whole name on hover.

Review points from #1338: only unmodified keys drive the popup (Ctrl,
Alt or Shift with an arrow stay with the shortcuts); closing gives the
keyboard focus back to the widget that had it; Space shows one more
level of every shown comp, then folds them back; nodes and stubs are
named for assistive technology; per-guard tests for the Tab claim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: the focus alone in the centre column, no animation, 30% smaller

The centre column holds only the focus comp; Up / Down still step to its
siblings, which are drawn only when they are the focus. Moving the focus
redraws the popup around it with no easing. Pills, gaps, stubs, links and
names are about 30% smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: keyboard focus follows the selected comp and stays in view

- The focused comp's pill holds egui's keyboard focus while the popup is
  open (screen readers follow the arrows); the app's shortcuts still run
  (framework::focused_widget leaves the pill out), a dialog opened over the
  popup keeps its own focus, and closing gives the focus back or drops it.
- A new focus or a level shown or hidden scrolls the focused pill into view
  once (Space on a long upstream chain left it past the popup's edge).
- Regression tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: reveal the focused comp again when a column grows taller

The reveal signature now includes the tallest column, so expanding a branch
into an existing column (more rows, same column count) scrolls the focus back
into view. Manual scrolling still leaves the signature unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: yield the keyboard to modal ScriptUI dialogs and link nodes by parent index

A modal ScriptUI dialog lives in session.script_ui.windows, not app.dialog, so
the flowchart kept requesting focus and taking Tab/arrows/Enter. A shared
modal_open check now suspends key interception and the focus request.

Links no longer search the placed list per node: each node carries its parent's
index, filled once while placing the columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: modal framework dialogs also take the keyboard

modal_open now includes DialogHost::shows_modal() on app.framework_dialogs, so
the flowchart's keys (arrows, Enter, Escape, Tab) and focus request stay out of
a modal framework dialog's way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mini-Flowchart: modal dialogs keep the keyboard; arrows reach every linked comp

- A modal ScriptUI or framework dialog over the open flowchart: the focused
  pill gives its egui focus up (a focused widget took Enter/Space as a click
  and Tab/arrows moved focus on from it) and the popup is disabled until the
  dialog closes.
- The workspace shortcut dispatcher runs nothing behind a script's modal
  dialog, so Space no longer starts or stops the preview behind it.
- The arrow keys follow the whole nesting, not the drawn columns: Up/Down
  siblings are no longer capped at MINI_MAX_COLUMN and Left/Right pick from
  the focus's full neighbour list. The display stays bounded.
- One validated focus (mini_focus) for the centre pill and for Enter.

The mini-flowchart tests passed locally (19/19) before the final cargo fmt;
not recompiled after it, CI is the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Themolx <183303841+Themolx@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-12-04 06:57:48 +01:00
Bar Borer ed525612b7 #4368: add missing properties of the smaller effects (#4374)
* #4368: add the missing properties of the smaller effects

Adds the After Effects properties missing from Paint Beads, Sphere Wrap, Card Wipe,
Warp Stabilizer, Cylinder Wrap, Vector Blur, Light Rays, Page Curl, Plastic Shading, Radio
Waves, Slant and Block Reveal, Bulge, Color Neutralizer, Convolution Kernel, Cross Blur,
Directional Smear, Dual Lens Warp, Edge Tile Repeat, Environment Map, Hexagonal Tiles,
Kaleidoscope, OCIO CDL Transform, Organic Displacement, Paint Bucket, Radial Blur, Radial
Light Burst, Refine Soft Matte, Source Composite, Strobe Light, Surface Spotlight, Temporal
Motion Blur, Turbulent Displace, Two-Point Bend and Wave Warp. New properties sit in After
Effects order and drive the render; defaults reproduce the previous output and old projects
load unchanged (Card Wipe's new Y/Z jitter speeds start from the old single speed). GPU paths
fall back to the CPU when a new control is active.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: review fixes (identity pixels at High antialiasing, light normalisation, 100% blend)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: fix the deferred review findings (Page Curl, Edge Tile, Plastic, Chatter Reduction, Hexagonal Tiles, Warp Stabilizer)

- Page Curl: the corner drag places the fold so the corner lands on Fold Position for any curl radius; an unmoved corner shows no Back Page; the GPU path falls back to the CPU for corner drags and Back Page layers.
- Edge Tile: Repeat Blend Borders blends with what the neighbouring tile shows, flip included.
- Plastic Shading: Ambient Light Color tints only the ambient term, lit with the light colour, and nothing without ambient light.
- Refine Soft Matte: Chatter Reduction rejects outer frames where the matte moves.
- Hexagonal Tiles: Lock Center Tile keeps the grid centred on the layer while Center moves the picture.
- Warp Stabilizer: the Target Layer is fitted over the whole frame, not this layer's buffer bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: legacy Roto Brush keys leave out the parameters added since 0.24

Roto Brush keys saved by 0.22-0.24 hash the Debug text of every effect above the brush. The
new properties of #4368 (Warp Stabilizer's Advanced options among them) are added when such
a project opens, so the legacy key no longer matched and the saved analysis was dropped
(tests::analysis_signature). The legacy text now leaves out each parameter added since 0.24
while it still holds the value an old project gets (its default, or for Card Wipe's split
jitter speeds the single speed), along with a layer parameter's source choice and groups of
only new parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: review fixes (Curve Size, Paint Beads light and GPU fallback, Radial Blur seed, pinned High antialiasing, Card Wipe keys, ambient tint, target Source)

- Radio Waves: Curve Size subdivides its own interval, so small sizes draw their own curve.
- Paint Beads: point-light height follows the layer size, not a padded buffer; the GPU path
  hands non-default Wobble, Light and Shading to the CPU.
- Radial Blur: seeded Zoom jitter is half a real ladder step and never crosses the centre.
- High antialiasing keeps pixels the warp leaves in place at their centre (pinned edges).
- Card Wipe migration copies an animated shared jitter speed (keyframes, expression); the
  legacy Roto Brush key compares the copy in full.
- Plastic Shading: the Ambient Light Color clamp limits only the tint's change.
- Warp Stabilizer: the Target Layer honours its Source choice.
- tests_4368: an unknown parameter fails the test instead of passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: Plastic Ambient Light Color scales with the light intensity

At Light Intensity 0 the surface is unlit (the layer as it is), so the ambient tint is scaled
by the intensity as the light colour is: a black Ambient Light Color no longer turns it black.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #4368: Two-Point Bend Preserve Length renders on the CPU

The GPU kernel draws only the Normal arc mapping; Distort = Preserve Length is listed in the
catalog's CPU-only controls so the effect falls back to the CPU (Normal stays on the GPU).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:39:48 +01:00
Matthew Don a11548f909 feat(engine): reload external .ecproj edits into the live session (#4170)
* 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>
2026-12-02 00:55:37 +01:00
Valentin Klein d4b2392f40 Render log says why a job renders on the CPU and names the GPU adapter (#3732)
* 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>
2026-12-01 11:33:14 +01:00
Valentin Klein 7e7118f1a5 Overwriting a render no longer freezes the app on projects with many footage files (#3330)
* #3328: output guard checks file identity only where an alias is possible

The output guard opened every footage file of the project, for every check
of an output that existed, on the UI thread: minutes for long sequences on
a network share. It now compares only the files that can be the output
(folders on the output's volume, folders holding symbolic links), keeps the
identities it learnt in the session (folders that changed are looked at
again; Reload Footage forgets them), and does no file system call while its
lock is held.

render.frame checks and writes with one guard. A control request whose
sender stopped waiting is not run, and one tick runs control requests for at
most a tenth of a second; the rest follow in order on the next ticks.

* #3328: output guard compares paths only, no file is opened

Comparing file identities still cost a file open per footage frame when
folders were on the output's volume, and caching them invited races (#3330
review). The guard now compares paths by name once resolved: absolute, dot
segments resolved, one separator, Windows verbatim prefixes as the plain
path, without case on Windows and macOS. A link or hard link to footage
under another name is no longer recognised; the reported data loss (#1743)
is the same-path case. Render queue duplicate outputs compare by name too.

* #3328: drop the link identity tests of the render queue; test and doc review fixes

* #3328: a mapped network drive and its UNC path are one place

On Windows the output guard resolves each drive letter's root once per guard
(std::fs::canonicalize of `X:\`) and compares a path on that letter as the
place it resolves to: a mapped network drive as its \server\share path, a
subst drive as its folder. A root that can't be resolved keeps its letter.

* #3328: drive roots are looked up only where they can matter, and kept a minute

A drive letter's root is resolved only when the output and the protected
files are not all on one letter, or not all UNC paths: footage and output on
one mapped drive never wait for a disconnected drive or an empty removable
one. Resolved roots, failures too, are kept process-wide for 60 s.

* #3328: the 13,000-frame guard test counts file system lookups instead of timing them

* #3328: note why only Windows counts lookups in the 13,000-frame guard test

* #3328: queued outputs collide under drive and UNC spellings

* #3328: queued sequences and subst drives compare by the place they name

* #3328: queued outputs keep their resolved places instead of resolving per comparison

* #3328: cache_bench's play request carries the abandoned flag (main's example met the new ControlRequest field)

* Refuse an output in a folder linked to a source's folder

An output whose name matches no protected file now has its folder resolved on disk, once per folder per guard, and is compared again by name. An output in render-alias/, a symbolic link or junction to plates/, no longer replaces plates/source.exr. No protected file is looked at.

* Resolve both folders, and only for a source with the output's file name

The footage path as imported may itself run through a link (macOS /var is /private/var, Windows 8.3 names), so resolving only the output's folder missed it. Now an output whose path matches nothing is compared again only with sources of the same file name, both folders resolved once per guard. An output named like no source asks the file system nothing.
2026-11-28 08:25:14 +01:00
FredApps 2b750011a7 Merge upstream main into gpu-upload-budget-3731 2026-11-26 21:17:44 +01:00
Nazar 6002e6214f Helper host: video helper client with reply rules and gate tests (#4189)
* Helper host: video protocol types, reply rules and discovery

Part of RFC-0031, phase 1. The host side of docs/video-helper-protocol.md
that needs no process: the messages, what to do with each reply, and
finding the program. Starting the helper and the client come next.

- video::wire: encode.open/frame/flush/close, cancel, hello and the
  replies, as the page documents them; control lines are at most 1 MiB.
- video::jobs: job and frame ids, the 8 frame / 256 MiB budget and the
  "What EffectCraft does with each reply" table (accept, drop, job error,
  protocol break) as plain logic.
- video::check_hello and find_video_helper: the version and app_min
  checks, and the program is looked for only in helpers/ next to the
  executable. Effect-helper scans now skip it.

* Helper host: video helper client, stand-in helper and gate tests

Part of RFC-0031, phase 1. Starts a video helper and runs encode jobs
on it, following docs/video-helper-protocol.md and the reply rules
added in the previous commit.

- video::client: VideoHelper starts the program, checks its hello,
  opens encode jobs, sends pictures (waiting when 8 frames or 256 MiB
  are out), flushes, cancels and closes. Packets are copied out of the
  exchange file as they arrive. A crash, hang or broken reply stops the
  helper and fails the export; 3 stops turn it off. A refused job ends
  that job only.
- Stopping kills the helper process and waits at most 5 s, then drops
  the exchange file so a stray process can't touch a reused region. The
  spec no longer promises a process-group or job-object kill, which
  needs unsafe code; its wording follows what is implemented.
- tests/it/video.rs: a stand-in helper (this test binary, driven by a
  scenario) and 19 gate checks: crash, hang, bad and out-of-order
  replies, out-of-bounds packets, version mismatch, missing helper,
  lost device, packet_too_large as a job error, cancel, ignored
  cancel, 3 stops and retry.

* Helper host: harden the video client against a misbehaving helper

Review fixes on the video client and its tests.

- Packets in one reply may not add up to more than their region, so
  repeated references to the same bytes can't make the host copy them
  many times. The reader's queue is bounded; a helper that floods it
  waits on its own pipe.
- A picture is sized with checked arithmetic and refused over 256 MiB
  before any layout or exchange file growth; an encode.open that can't
  be written is refused before the job, its ids and regions exist.
- Waits end at their deadline even while replies keep arriving, a poll
  looks at a bounded number of late replies, the flush batch and
  encode.flushed share one timeout, and a timeout too long to represent
  no longer panics.
- close is private: a job is closed only after encode.flushed or
  cancelled. An unsent frame is given back when writing its planes
  fails; a failed copy of packets stops the helper without counting it
  as a crash.
- Contents/Helpers is searched only for an executable in
  Contents/MacOS. An incomplete base64 group is rejected.
- Tests assert the protocol diagnostic of each malformed reply and
  cover the flood, the flush deadline, oversized pictures and an
  oversized encode.open. The spec table drops every reply except
  cancelled for a failed job that has not been cancelled yet.

* Helper host: allow one encoder job at a time on a video helper

open_encoder accepted a second job while the first was open. If the
first job then reported an error while the client was waiting on the
second, the error was dropped and its caller only saw "no such video
job".

A second open is now refused with a request error until the first job
is finished or cancelled, so each job's error reaches its own caller.
The receiver state machine still tracks several jobs; only the client
API is single-job.

The gate test refuses a second open while one is active and accepts a
new one after finish and after cancel.

* Helper host: reject malformed base64 padding, align two protocol notes

base64_decode stripped every trailing "=", so "====" decoded to an
empty codec configuration that open_encoder then accepted. It now
accepts at most two "=" and only when the length is a multiple of 4.

The protocol page said job ids are never reused even after a restart,
but the counter is per process, and said nothing about replies that
were already queued when the frame timeout passed. Both now describe
what the client does.

* Helper host: fix two code comments about job id reuse

The comments on NEXT_JOB and Jobs::new said ids are never reused across
helper processes or restarts. The counter is per process and a new
helper starts from the highest id opened so far, so the comments now say
that, matching docs/video-helper-protocol.md.

* Helper host: cap the encoder delay a video helper may report

A helper-reported delay sized the flush region (and the exchange file) with
unchecked arithmetic. A delay over 64 is now a protocol break, the flush
region uses checked arithmetic, and the protocol page says so. Also moves a
test doc comment back onto the test it describes.

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-26 20:47:36 +01:00
FredApps b602fc35f5 Merge branch 'main' into fix/3668-render-queue-duplicate-shortcut 2026-11-26 17:54:25 +01:00
FredApps 995039c7aa Merge branch 'main' into feat/import-photocraft 2026-11-26 17:17:26 +01:00
FredApps 52b1d18833 Merge branch 'main' into camera-tools-2586 2026-11-26 16:07:34 +01:00
FredApps c1758a2667 Merge branch 'main' into export-log-phases-3713 2026-11-26 15:30:33 +01:00
FredApps 28fc5906d3 Merge main into fix/3668-render-queue-duplicate-shortcut
Conflict in crates/ui-egui/tests/it/ui_shortcut_scopes.rs: kept this PR's press/press_in split (press and release, shared context) and main's framework::install_headless call, now made on every context the tests create.
2026-11-26 19:26:23 +07:00
FredApps 0760042742 Merge pull request #3993 from nazar-gavrylyk/docs/hardware-video-protocol
Docs: propose the video helper protocol for hardware encoding (RFC-0031)
2026-11-26 10:07:25 +01:00
FredApps 8d9aaf1055 Reconcile PhotoCraft import with current EffectCraft dependencies 2026-11-26 08:54:52 +01:00
aiongg 47ab68c218 Merge pull request #4153 from aiongg/minimal-port-next
EffectCraft: move to craft-libs next (minimal port)
2026-11-25 23:09:14 -05:00
skylar taylor-barrick 9111eaa73c Switch on supervised nightlies on the nightly-signer branch (#4175)
Supervised nightly switch-on, merged under Skylar's explicit Nightly 758 override after green CI, CodeRabbit on this head with no open threads, Sonar passing, and an independent adversarial review with no blockers.
2026-11-25 21:05:26 -06:00
aiongg 57d7b0dd1b Merge main into the minimal port
Conflicts: crates/ui-egui/src/lib.rs (module list: kept the port's capture module and main's channel module).
2026-11-25 06:36:34 +00:00
Dylan M. Taylor 59aed45057 packaging(linux): support co-installable nightly packages (#4154)
Linux nightly packaging by @dylanmtaylor, with the per-app Nightly flavor commits stacked on his branch.

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-24 19:38:19 -06:00
aiongg dbbf485774 Repin craft-libs to dock-gaps 4e806d57a5: panel focus on DockAreaOutput::pressed, document tab sources, tests on next's ids 2026-11-24 21:09:54 +00:00
aiongg 74ba361444 dock: EffectCraft's panels on next's DockArea
- dock_ui: DockArea over the given workspace (one Arc kept while equal), a
  Tracked spec model (tab names, label swatches, the Timeline's comps as
  panel documents), EffectCraft's lock and panel menu in each group header,
  DockConfig from the old style flags (side edge zones, Maximize Frame,
  Close Other Panels in Group, float on empty drop, title bars only move,
  wheel selects tabs, tab close buttons, native windows), DockArea::raise
  for a floating panel shown by a command, window_files per panel,
  automation ids from DockAreaOutput::sources.
- dock_command: the window.panel.* and ui.dock vocabulary, app-local.
- Lock Workspace is UiState::dock_locked, saved in the workspaces file; an
  earlier file's own workspace lock carries over once.
- Native window places of earlier files are dropped: the dock places its
  OS windows again (native_outer and the place sanitizing go).
- Floating-window keys and text-field edits go through the window host.
- Tests: next's constructors; ui_dock_resize goes (divider geometry is the
  dock's own behaviour, with its trials).
2026-11-24 19:17:33 +00:00
nazar-gavrylyk ccb628207f #805: Docs: define how a flush's packets and encode.flushed are accepted 2026-11-24 20:14:12 +01:00
nazar-gavrylyk cfc57d390a #805: Docs: reflow the error bullet in the video protocol 2026-11-24 19:42:23 +01:00
nazar-gavrylyk 7e9fc1e49e #805: Docs: rewrap a line in the video protocol 2026-11-24 19:42:13 +01:00
nazar-gavrylyk 6581b6f937 #805: Docs: align the video protocol with RFC-0031 D3 and fix reply rules 2026-11-24 19:42:05 +01:00
nazar-gavrylyk a0ef54fac1 Merge remote-tracking branch 'upstream/main' into docs/hardware-video-protocol 2026-11-24 19:41:21 +01:00
FredApps 786e9b033f Merge branch 'main' into fix/1955-producer-history 2026-11-25 00:00:45 +07:00
Valentin Klein 525dcfc0d8 Browse… buttons in a script's own dialogs and panels open the file dialog instead of doing nothing (#3253)
* Scripts: a ScriptUI Browse… button opens the file dialog

Fixes #2778.
Fixes #2894.

File.openDialog, File.saveDialog, Folder.selectDialog and the instance
openDlg / saveDlg / selectDlg were stubs that returned null, so a script
dialog's or a dockable ScriptUI panel's Browse… button did nothing.

On a script-host thread, in an app that shows them, the script now asks
for the dialog (Session::script_ui.file_dialogs, each with an id), hands
the session back like a modal dialog's show() does and waits for the
answer: a File (an array with multiSelect), a Folder, or null when
cancelled. The script's filter becomes the dialog's (its name, "All Files"
for *.*); without extensions every file shows. Headless runs, the Script
Console, the web and Shutdown scripts get null at once.

The app shows the dialog after the pass's events: blocking on Windows
(Hooks::pick_file_dialog), without blocking on macOS and Linux, one at a
time; a non-blocking dialog that ends without answering counts as
cancelled. scriptui.fileDialogs lists the waiting dialogs and
scriptui.fileDialog answers one (refused while file access is confined,
and refused to scripts). A dialog leaves the list only when its script
has the answer; the script's windows refuse events meanwhile, except
scriptui.close, which cancels the file dialog first. A script host that
ends takes its dialogs with it.

* Scripts: carry a file dialog's prompt, start location and filter to the native dialog (#2778)

serve_file_dialogs collected the script's prompt, start folder and save filter
but dropped them at the host boundary. FileDialog::Script now carries prompt and
start, and new ScriptFolder and ScriptSave requests carry the folder dialog's
prompt/start and the save dialog's prompt and whole filter (label, extensions,
any file) instead of the default name's extension. Both the blocking and the
non-blocking host dialogs apply title, initial directory and filters; Save also
goes through the blocking hook where one is set. Hook-level regression test
asserts all three requests.

* Scripts: a hidden window paints so a script's file dialog is shown (#3253 review)

* Scripts: formatting (#3253)
2026-11-22 12:58:56 -06:00
NullTron 5fe33d0a9b fix(effects): sample particle producers at their birth time (#1955) 2026-11-22 02:24:47 +05:30
nazar-gavrylyk 5b2ee09762 #805: Docs: drop a stopped helper's exchange file and bound the stop wait 2026-11-20 20:40:09 +01:00
nazar-gavrylyk dede545a7f #805: Docs: keep a job's regions until every helper process has exited 2026-11-20 20:33:00 +01:00
nazar-gavrylyk 7233dda4b0 #805: Docs: retire a job's frames on cancel or helper exit 2026-11-20 20:25:53 +01:00
nazar-gavrylyk 41a4eae706 #805: Docs: define how an error and encode.close retire a job 2026-11-20 20:18:50 +01:00
nazar-gavrylyk a2e62b438a #805: Docs: specify packet framing, offsets, flush and error replies 2026-11-20 20:10:37 +01:00
nazar-gavrylyk e495469969 #805: Docs: propose the video helper protocol for hardware encoding (RFC-0031)
Specify phase 1 of RFC-0031 in docs/video-helper-protocol.md, marked
proposed: how a video helper is started and found, the hello version
check, the 8-bit 4:2:0 picture format, the encode.* messages with
slots, limits, cancel and per-frame timeouts, and what happens when a
hardware export fails. Decoding is reserved for phase 2.

external-helpers.md gets a pointer to the new page.
2026-11-20 19:38:13 +01:00
dotCooCoo f5bbbd2d64 Merge main into feat/import-photocraft 2026-11-19 07:28:11 -08:00
vangel76 98ada1e8ff Watch Folder renders take the host's memory budget; docs and test comment (#3941 review) 2026-11-19 10:37:00 +01:00
vangel76 6bea5fa6ae Merge upstream/main into cache-defaults-3298 2026-11-19 10:21:55 +01:00
vangel76 34a1c88930 Reap a killed nvidia-smi on a thread of its own, tell why it gave no output, restore the test budget on failure, clearer cap docs 2026-11-18 17:38:13 +01:00
vangel76 3d3abd9561 Give the held-output test room to start, retry reaping on a loaded machine, clearer budget docs 2026-11-18 16:31:12 +01:00
vangel76 ec3116f04d Keep nvidia-smi from holding the caller; never take another card's memory
Read nvidia-smi's output on a thread of its own and stop at the same
timeout, so a process it leaves behind holding the pipe cannot block.
Reap a program killed at the timeout, waiting at most 200 ms.
When the adapter's own nvidia-smi line (or a line of its device id) has
no size, the memory is unknown instead of another card's.
A memory cap override that is not a number now behaves like no override
for both the cap and the upload budget.
The upload-budget test sets a budget that fits before its first phase,
and the docs say how a set cap lowers the default upload budget.
2026-11-18 16:24:46 +01:00
vangel76 a987ed1216 Read NVIDIA video memory with nvidia-smi when the OS does not report it
The proprietary NVIDIA driver on Linux has no sysfs file for the card's
memory, so the upload budget stayed at 1.5 GiB there. When the adapter is
NVIDIA and nothing else reported its memory, run nvidia-smi once (no console
window, 3 s timeout, cached) and take the line of the adapter's PCI address,
else of its device id, else the smallest card.
2026-11-18 15:29:51 +01:00
FredApps e2b17586c0 Merge main into feat/import-photocraft 2026-11-18 20:20:08 +07:00
vangel76 1032cb6490 Merge remote-tracking branch 'upstream/main' into gpu-upload-budget-3731
# Conflicts:
#	Cargo.lock
2026-11-18 12:56:47 +01:00
vangel76 3641cb38a8 Merge remote-tracking branch 'upstream/main' into export-log-phases-3713
# Conflicts:
#	crates/export/src/lib.rs
#	crates/export/src/webm.rs
#	crates/export/src/webm_av1.rs
2026-11-18 12:54:29 +01:00
arnav-hiwarkar c07dbf32ca Merge remote-tracking branch 'upstream/main' into fix/3464-drop-shadow-softness-range 2026-11-17 20:54:02 +05:30