Rewiring a dragged link (Disconnect + Connect), dragging a frame (Edit
frame + Move nodes) and Import bitmap (import + add node + set param)
each made 2-3 history entries. Add Session::begin_group/end_group and
Session::group: edits inside a group share one snapshot, an untouched
group records nothing, and a failing group() restores everything. The
UI uses begin/end_group around those gestures.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The multigrid solve divided the slope divergence by the level's scale where it
must multiply (one coarse pixel spans `scale` full-size pixels), so the coarse
levels contributed almost nothing and the broad shape was lost. A Gaussian bump
round-tripped through Height to Normal now correlates 0.99+ at 256 and 1024 px
(0.86 at 256 before).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
resolve_params only checked types, so a hand-edited file, a binding to an
exposed input or a dynamic function could pass any float or int to a cook
(including NaN and 1e30). Clamp Float, Int and Float2 parameters to the
declared min/max in resolve_params (new clamp_params; non-finite values fall
back to the default; angles are left alone) and again in eval after bindings
and functions have run.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
decode() decoded the whole image before checking its size, so an oversized
image allocated first and was refused after. The dimensions are now read from
the header and refused before decoding, and the decoder gets width and height
limits. write_atomic syncs the temp file before the rename and uses a
per-process, per-call temp name so concurrent saves of one path do not collide.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
File > Open, Close all, Empty package, drag-drop and browser open, and
closing the window or Quit replaced or ended the package without
checking Session::modified. They now hold the action and show a Save /
Discard / Cancel dialog; a failed or cancelled save keeps the work. The
decision is a pure state machine (unsaved.rs) and the held action is
serde state in Windows::unsaved. Engine commands run by the control
channel, MCP and CLI still never open a dialog.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each used one noise period for both axes while the cell counts differed per
axis, leaving a seam. Add noise::value_xy (separate period per axis) and use
whole-number cell counts. The noises_tile test now checks the top/bottom edge
too, compares against the mean neighbour difference, and covers the three nodes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ui.set replaced whole top-level keys, so a partial {"prefs":{"thumbnails":false}}
reset every other preference to its default. It now merges objects
recursively. GraphCamera and ImageCamera gain sanitized(), applied after
ui.set and when drawing, so a zoom of 0 or NaN can no longer reach the
division in view_center and the 2D view.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Out-of-range indices were filtered one at a time, which shifted every later
triangle (and a glTF index count that was not a multiple of 3 shifted later
primitives). Importers now keep or drop whole triangles. Non-finite positions,
normals and UVs are rejected before normals, tangents and bounds are computed
from them; a NaN position used to hang the import.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A panic in the background cook left stale previews with no error, and a
dead worker (Disconnected) was cleared silently. The worker now runs under
catch_unwind and reports failure; the failure and a vanished worker mark
every node with the error and raise a toast. App::run and the control
channel's command.run also run commands under catch_unwind and reply with
an error instead of crashing.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
decode() sRGB-decoded every 8/16-bit color bitmap, so an RGB normal map
(0.5, 0.5, 1) became (0.214, 0.214, 1). decode now takes a linear flag. The
Bitmap node gets a Color space choice (sRGB by default, so existing files cook
the same) and graph input preview images can be bound as linear data maps
(graph.input.bind linear: true, stored in input_images_linear).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A background cook of version A could land after session.inspect had
synchronously cooked version B and cleared dirty, overwriting B's results
with no recook. Sessions now count synchronous cooks (cook_epoch) and the
cooker discards a result whose start epoch is out of date.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The grid-bin span was unbounded, so a large size or length visited billions of
bins per item, and Splatter also scanned each bin with contains. Cap the span
to one turn of bins per axis (as fx_map does), drop the contains scan, and
clamp Splatter's count to its declared maximum of 2000.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
merge_key was cleared only by edit/undo/redo/reset_history, so two drags
of one slider, two "New random seed" clicks and two MCP/control
node_param calls collapsed into one undo entry. Add Session::end_merge,
call it on pointer release and around each control/MCP command, and
restore the session when a merged edit fails.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
blur_xy made ceil(extra/2) full-image passes with an unclamped sigma, so a
large intensity at high resolution took ~1e11 ops and a hostile one never
ended. Clamp both sigmas to the image size and do the extra horizontal blur
as one Gaussian (new ops::gaussian_h, three box passes, O(1) per pixel).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
load_package read a resource entry once per resource that named it, so a tiny
deflated entry plus thousands of resources could allocate hundreds of GB. Each
distinct entry is now read once and shared, the resource count and total bytes
are capped, and a missing or over-cap entry is an error instead of silently
empty data. save_package gives colliding sanitized file names a numeric suffix.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Editing a graph two levels below an instance node left the instance's cached result stale, and
bitmaps of equal length with equal headers shared a cache key.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>