Commit Graph
70 Commits
Author SHA1 Message Date
bflatastic 5c2e7ad343 Merge remote-tracking branch 'origin/main' into HEAD 2026-10-30 07:11:39 +07:00
bflatastic 0039081952 Merge main into #2567; keep both test modules, and convert four layer stacks main's new render tests assign as Vec<Layer> with .into() 2026-10-30 06:01:06 +07:00
bflatastic d7ab6bc11b Merge main into #1387; clean 2026-10-30 05:46:52 +07:00
BFlat cdc5fddaff Merge pull request #2610 from storytold/fix/text-line-join
Text: stroke Line Join — Miter, Round or Bevel (#2077)
2026-10-30 05:41:27 +07:00
bflatastic 57b76bcc88 Merge remote-tracking branch 'origin/main' into HEAD 2026-10-30 05:08:13 +07:00
BFlat 5874304437 Merge pull request #1887 from ki2pixel/expressions-cubic-bezier
Expressions: cubic-Bezier easing helper (bezier(...)) (#1884)
2026-10-30 05:08:06 +07:00
tylerjenningsw 4b7ed9c77f Expressions: test that a frozen kept layer reads the project again 2026-10-29 17:53:50 -04:00
tylerjenningsw ffad10c7f3 Expressions: a kept layer's info is private, so freezing the layer doesn't keep it 2026-10-29 17:53:50 -04:00
tylerjenningsw 48c9993bd3 Expressions: test that propertyGroup reaches the same layer as thisLayer 2026-10-29 17:43:30 -04:00
tylerjenningsw cca5447e09 Expressions: propertyGroup reaches the kept layer, not a new one 2026-10-29 17:43:30 -04:00
tylerjenningsw 2bd86c6cd8 Merge remote-tracking branch 'origin/main' into fix/paths-and-callable-layers
# Conflicts:
#	crates/expr/src/prelude.js
2026-10-29 17:42:29 -04:00
bflatasticandClaude Opus 5.5 dc09ba58ae Text: stroke Line Join — Miter, Round or Bevel (#2077)
Text strokes were always drawn with round joins. The document gets a
Line Join (`lineJoin: miter|round|bevel` in layer.setText / newText),
Miter for new text as in After Effects, Round for documents saved before
it so their look is kept. The 2D and Advanced 3D (extruded) text strokes
use it, expressions' style copies carry it, and the Character panel has
Miter / Round / Bevel buttons under the stroke width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 04:25:27 +07:00
BFlat 0f2225fe9c Merge pull request #2161 from Barzabel/fix/2124-2125-expr-nesting
expr: bound runtime parser and native recursion depth (#2124, #2125)
2026-10-30 01:19:11 +07:00
Camille Moine a2f8913eb3 Expressions: follow Media Replacement source dimensions (#1747)
LayerInfo, sourceRectAtTime and Layer.source now resolve the effective footage item/size through the collapsed instance EvalCtx, matching the rendered pixels. Adds a regression test with different original and replacement footage sizes.
2026-10-29 15:21:16 +01:00
Camille Moine df0a88b795 Fix collapsed precomp Essential Property overrides (#1747)
Carry property, Font and Media Replacement overrides into the collapsed nested EvalCtx so nested layers render beyond the precomp frame instead of falling back to a clipped, flattened image. Key the layer cache on instance overrides to keep distinct collapsed instances isolated.
2026-10-29 15:21:16 +01:00
Camille Moine 7038f4f0ee Expressions: read bezier curve by position (#1884)
A missing or unusable curve no longer consumes the last value. The long form reads argument 5 and the short form argument 3, with the other arities falling back to linear interpolation. Adds the missing-curve and four-element-array cases reported in review.
2026-10-29 11:58:35 +01:00
Camille Moine efcdad04af Expressions: reject malformed bezier curves and bound the y error
- accept only four-element arrays for bezier(): extra values make the curve
  malformed, so it falls back to linear like the other invalid forms (#1884);
- stop Newton on the estimated y error (f * dy/dx) instead of a residual in x
  alone: near the endpoints dy/dx is in the thousands, so a 1e-9 residual in x
  could still move the returned value;
- tests: a five-element curve is linear, and three steep curves match a
  bisection reference within 1e-6.
2026-10-29 11:58:34 +01:00
Camille Moine 53399c2831 Expressions: cubic-Bezier easing helper (bezier(...)) (#1884)
Add bezier(t, tMin, tMax, v1, v2, [x1, y1, x2, y2]) and the short bezier(t, v1, v2, curve) form: a CSS cubic-bezier easing curve solved with Newton-Raphson and a bisection fallback.

Scalars and arrays work like linear/ease; x1/x2 clamp to 0..1, y1/y2 may overshoot, t clamps to tMin..tMax, and a curve that is not four finite numbers falls back to linear instead of throwing.

Tests cover known curves (ease is [1/3, 0, 2/3, 1]), clamps, arrays, the short form, invalid curves and overshoot, plus two fuzz seeds.

Closes #1884.
2026-10-29 11:58:34 +01:00
Eduardo EspinosaandClaude Opus 5.5 e1d66a3c5c perf: share unchanged layers between undo states
Every undoable edit keeps the previous project for undo, so the comp it touches
is shared and Arc::make_mut deep-copies it: every layer and every keyframe. An
edit therefore costs time in proportion to the comp's size, and a script that
sets many keyframes in a big comp goes quadratic (a 1,600-layer build with
~100k sampled keys took ~45 minutes).

Comp::layers is now a Layers collection backed by Vec<Arc<Layer>>: copying the
stack copies pointers, and only the layer an edit changes is copied. The API
mirrors Vec<Layer>; serialized form is unchanged (a list of layers).
Comp::layer_mut and the iter_mut().filter/find call sites use find_mut /
iter_mut_where so they copy only the layers they actually change.

- prop.addKey in a 400-layer comp: 1.36 ms -> 0.16 ms per key (flat in comp size)
- the 1,600-layer script build: ~45 min -> 47 s, frames pixel-identical
- regression tests: an edit leaves the other layers shared with undo; layers
  round-trip as a plain list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VkpGcKfWyCudfSsQNiWAaG
2026-10-28 22:20:23 -04:00
Dylan M. Taylor 2fd6c448c5 Refactor expr for strict Clippy checks 2026-10-28 06:09:20 +00:00
tylerjenningsw 95ee400ab2 Expressions: test that a change to Object.prototype doesn't reach the kept layers 2026-10-27 14:04:10 -04:00
tylerjenningsw 2eefced49b Expressions: the kept layers' maps have no prototype 2026-10-27 14:04:10 -04:00
tylerjenningsw e7cf022a7d Expressions: test that the kept layers are bounded 2026-10-27 14:04:10 -04:00
tylerjenningsw ad6b87c60d Expressions: the kept layers are bounded like the runtime's scripts 2026-10-27 14:04:10 -04:00
tylerjenningsw 2f2ebbdedb Expressions: test that deleting or redefining thisLayer and thisComp doesn't reach the next evaluation 2026-10-27 14:04:10 -04:00
tylerjenningsw ecb8dadde5 Expressions: an expression can't delete or redefine thisLayer, thisComp or the other unqualified names 2026-10-27 14:04:10 -04:00
tylerjenningsw d81716bfb6 Expressions: test that an expression can't change the prelude for the next one 2026-10-27 14:04:10 -04:00
tylerjenningsw b2fb5f4e5f Expressions: an expression can't change the prelude for the evaluations after it 2026-10-27 14:04:10 -04:00
tylerjenningsw 0860c7e03d Expressions: an expression can't delete a kept layer's fields 2026-10-27 14:04:10 -04:00
tylerjenningsw f4a4d76f2a Expressions: test that a kept layer's own fields don't carry over to the next evaluation 2026-10-27 14:04:10 -04:00
tylerjenningsw 5c23bda95d Expressions: an expression can't change which layer a kept layer is 2026-10-27 14:04:10 -04:00
tylerjenningsw 754ed2fe84 Expressions: test that a kept layer reads the project again in each evaluation 2026-10-27 14:04:09 -04:00
tylerjenningsw 7c0ba4ef1d Expressions: a layer is made once per runtime and reads its info again in each evaluation 2026-10-27 14:04:09 -04:00
tylerjenningsw ca590aaead Expressions: a layer is made once per evaluation, and only functions are checked for being one
A Layer is now a callable function with its own prototype, which costs
more to make than the plain object it was. __layer(c, l) makes each
layer once per evaluation (kept in __S, which __begin resets), so an
expression naming the same layer many times builds it once. That covers
thisComp.layer(...) in a loop, .parent, a Layer Control's value and
thisLayer.

The checks for a layer (the result, thisComp.layer(layer, offset), the
property proxy) read __isLayer only on functions. Numbers and other
primitives are no longer boxed to look the property up.

Timing (release, Windows, medians of 2000 evaluations, PR vs main):
- one evaluation building one layer: about 22 vs 16 us;
- thisLayer.transform.opacity: about 200 vs 170 us;
- 20000 thisComp.layer(1) lookups in one evaluation: 95 vs 138 ms.
2026-10-27 14:04:09 -04:00
tylerjenningsw 3f88c72a43 Expressions: a layer is a callable property group
In After Effects a layer is a property group: thisLayer("transform"),
thisComp.layer("Other")("effects")("Blur"), thisLayer(1). In
EffectCraft's expression runtime a Layer was a plain object, so those
failed with "TypeError: not a callable function", including the
references the pick whip writes with Compact English off
(thisComp.layer("Other")("effects")("ec.noise.fractal")(...)).

A Layer is now callable like a property group (built as __mkGroup
builds groups), looking up its own properties by match name, name or
index, and keeps its methods, name and index. The places that took a
layer for a plain object (the result reading as the layer's index,
thisComp.layer(layer, offset), a Layer Control's value handed through
the property proxy) accept it.

Test: layers_are_callable_property_groups (fails before).
2026-10-27 14:03:59 -04:00
skylar taylor-barrick 69b9ce2bd1 M0.37: reconcile shared docking and qualify migration follow-up 2026-10-26 06:47:07 +01:00
Dylan M. Taylor f31a6b0aef sonar: optional chaining (S6582) and for-of loops (S4138) in engine-owned JS (#2273)
ExtendScript .jsx files are left alone (ES3, no ?. or for-of).
2026-10-25 19:37:04 -04:00
Dylan M. Taylor 23f11ab7cf expr: bound rewrite expansion and preserve assignment targets (#2195)
* expr: bound rewrite expansion and preserve assignment targets

* expr: bound rewritten output size and rewrite computed assignment targets
2026-10-23 09:14:49 -04:00
Dylan M. Taylor 0871135a6b Merge pull request #2062 from storytold/sonar-fix/js-css-reliability
fix: JS reliability bugs (SonarCloud S1764/S9383/S4275)
2026-10-22 19:27:57 -04:00
Barzabel a854e680f7 test(expr): deep-nesting tests assert the guard's own error (#2124, #2125)
Reflect is not an expression global, so Reflect.construct never reached the
nesting check; the proxy case asserts Proxy is undefined.
2026-10-22 23:00:12 +03:00
Barzabel 8324d93c39 fix(expr): JSON.stringify key lists report cycles; document stack guard coverage (#2124, #2125)
An array replacer now copies each source object once per call, so a cycle stays a cycle and the native check throws TypeError, while shared objects still serialize. Documents which threads evaluate expressions, what the 256 KiB guard covers (tested on a 512 KiB thread), that it does not apply on wasm32, and why eval is indirect.
2026-10-22 21:33:16 +03:00
Barzabel 6686cc75ca fix(expr): bound runtime parser and native recursion depth (#2124, #2125)
eval, Function and the generator/async function constructors now check the nesting of their source like the expression text. join, toLocaleString, flat and JSON.stringify check the run's stack use per level, results nested past the detached levels become [object], and Proxy/Reflect are no longer available to expressions. Each of these overflowed the stack and aborted the app.
2026-10-22 20:28:38 +03:00
Dylan M. Taylor 7983396692 fix: JS reliability bugs (SonarCloud S1764, S9383, S4275)
- scriptui.js: replace the self-comparison NaN check (o.max === o.max) with
  the explicit Number.isNaN(o.max) (S1764).
- sw.js: mark the fire-and-forget cache.put() with void and a .catch() so the
  promise rejection is handled (S9383).
- prelude.js: return __err(...) from the activeCamera getter so every path
  yields a value (S4275); __err always throws, so behavior is unchanged.
2026-10-21 17:20:35 -04:00
NetterSilverandClaude Haiku 5.5 28f97be7ee Fix integer overflow in sampleImage for huge sample points
Found while testing crates/expr/src/sample.rs:102

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 02:39:20 +02:00
Gert Pellin 0bdf9ec5e3 Merge branch 'main' into expr-property-group-1619 2026-10-16 14:28:34 +02:00
bflatasticandClaude Opus 5.5 cc138fcb90 Expressions: timeToFrames keeps whole durations whole under float error
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:38:56 +07:00
Gert Pellin 71a0f8855a Expressions: find an ancestor's index by uid, not by formatted path 2026-10-16 05:45:47 +02:00
Gert Pellin d347a0efca Expressions: propertyGroup() and a group's propertyIndex (#1619)
The After Effects stagger idiom
  id = thisProperty.propertyGroup(2).propertyIndex;
failed with "not a callable function": the expression object model had
no propertyGroup() and property groups had no propertyIndex.

- Property.propertyGroup(countUp = 1) and PropertyGroup.propertyGroup()
  return the group countUp levels up; from a top-level group they reach
  the layer. A count below 1, not a number, or above the layer is an
  error naming propertyGroup, never a crash.
- PropertyGroup.propertyIndex: the group's 1-based index among its
  siblings (Child requests now carry it).
- One new host request (Ancestor) walks up from the node's full uid
  path, so it also works for the property being evaluated.
- Tests for the stagger expression, effect parameters, reaching the
  layer, other layers' properties and groups and out-of-range counts;
  the fuzzer seeds and tokens include the new members.
2026-10-16 05:31:49 +02:00
sanyamsingh001andCodex 36ebe2eada Honor duration rounding in timeToFrames
Round nonzero duration frame counts away from zero while retaining
absolute-time rounding, default argument selection and numeric coercion.

Cover fractional durations, absolute controls, defaults and coercion.
Sort expected paths in the existing footage test for temporary-directory portability.

Co-authored-by: Codex <codex@openai.com>
2026-10-14 03:21:23 +10:00
Kristian MyramandClaude Haiku 5.5 4d105f02d4 #809: layer.source and a Layer Control's layer work in expressions
layer.source was undefined in expressions, and a layer from a Layer Control had no transform.
Both now work.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-12 19:19:11 +02:00