Skip to content

About

Кроп прекомпов по текущему кадру с сохранением внешней анимации. / Current-frame precomp cropping with external transform animation preservation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AE Precomp Cropper

Русский

Скрипт для After Effects: кроп выбранных прекомпозиций по геометрическим границам внутренних 2D-слоёв на текущем кадре исходной композиции. Внешняя анимация трансформаций сохраняется в поддерживаемых сценариях.

Обновление от 14 сентября 2026

  • Исправлен отказ при наличии ключей: поддерживаются анимированные Position и Anchor Point, разделённые координаты Position.
  • Сохраняются внешние Position, Scale, Rotation, тайминг и Time Remap. Смещение компенсируется через Anchor Point после изменения размеров.
  • Сдвигаются значения и ключи Position корневых внутренних слоёв с сохранением easing, касательных, интерполяции и roving.
  • Компенсируются прямые дочерние слои внешнего прекомпа и все экземпляры исходной композиции в проекте.
  • Исправлены комбинации масок, включая Subtract, Intersect, инверсию и отрицательное расширение.
  • При расчёте не учитываются выключенные, неактивные по in/out, guide-, null-, полностью прозрачные и исключённые режимом solo слои.
  • Вместо молчаливого отказа показывается причина пропуска. Ошибка записи вызывает восстановление размеров и затронутых свойств.
  • Пройдены 20 тестов в After Effects 2026. Допуск для пересчитанного roving-пути: 0,02 пикселя; остальные проверки координат: 0,001 пикселя.

Использование

  1. Внутри прекомпозиции поставьте курсор на кадр с нужными границами.
  2. Выделите её слой в родительской композиции и запустите cropper.jsx.

AE может синхронизировать курсоры вложенных композиций при перемещении внешнего курсора. Используется текущее время source в момент запуска, а не запомненный ранее кадр.

Учитывается только этот кадр, не вся анимация. Внутренние ключи не удаляются и не замораживаются: на других кадрах содержимое может выходить за новые границы. Кроп не расширяет исходный холст. Повторные выбранные экземпляры одного source обрабатываются один раз.

Успешный запуск проходит без диалога. Один запуск объединён в одну операцию Undo. В пакете поддерживаемые прекомпы могут быть обрезаны, а неподдерживаемые пропущены.

Установка

  1. Скачайте cropper.jsx. Это единственный необходимый файл; библиотека геометрии встроена.
  2. Для разового запуска выберите File > Scripts > Run Script File....
  3. Для постоянной установки поместите файл в Scripts и перезапустите AE:
    • Windows: C:\Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\
    • macOS: /Applications/Adobe After Effects <version>/Scripts/
  4. Запускайте через File > Scripts > cropper.jsx или добавьте файл как кнопку скрипта в KBar/Mobar. Это обычный скрипт без панели, не ScriptUI Panel.

Ограничения

  • Это геометрический кроп, не обрезка по отрендеренной альфе. Прозрачные поля footage и холсты вложенных прекомпов могут входить в границы.
  • Выражения на проверяемых слоях отклоняются, а не переписываются и не запекаются. Заблокированные затронутые слои также блокируют кроп source.
  • Эффекты, feather масок, внутренние track mattes, 3D, внутренний Auto-Orient, смешанный pixel aspect ratio и Collapse Transformations у прекомпов не поддерживаются. Обычные text/shape-слои разрешены, посимвольный 3D-текст нет.
  • Маски и включённые эффекты на внешних экземплярах отклоняются: их координаты требуют дополнительной компенсации.
  • Layer styles, субкадры motion blur, направляющие и Region of Interest не учитываются. Выражения в других местах проекта, зависящие от изменённых размеров, невозможно надёжно обнаружить.
  • Изменяется общий source, затрагивая все его экземпляры. Проверяйте сложные сцены на копии проекта.

Проверки

Запустите tests/cropper-regression.jsx в AE. Он создаёт временные композиции, проверяет свойства и проецируемые координаты, удаляет тестовые объекты и записывает результат в tests/artifacts/cropper-regression.txt. Это не сравнение пикселей итогового рендера произвольных сцен. Лицензия встроенного Clipper: vendor/NOTICE.txt.


English

An After Effects script that crops selected precomposition sources to the geometric bounds of their internal 2D layers at the source composition's current frame. External transform animation is preserved in supported scenarios.

Update: September 14, 2026

  • Fixed rejection of keyframed properties: animated Position and Anchor Point and separated Position dimensions are supported.
  • Preserves external Position, Scale, Rotation, timing and Time Remap. Compensates through Anchor Point after resizing.
  • Translates internal root Position values and keys, preserving easing, tangents, interpolation and roving.
  • Compensates direct children of outer precomp layers and every instance of the source across the project.
  • Fixed mask combinations, including Subtract, Intersect, inversion and negative expansion.
  • Bounds exclude disabled, out-of-range, guide, null, zero-opacity and solo-excluded content.
  • Unsupported cases display a reason instead of silently doing nothing. Write failures restore dimensions and affected properties.
  • Passed 20 native After Effects 2026 tests. Roving-path recomputation tolerance: 0.02 pixels; other coordinate checks: 0.001 pixels.

Usage

  1. Set the playhead inside the source precomposition to the desired frame.
  2. Select its layer in the parent composition and run cropper.jsx.

AE may synchronize nested playheads when scrubbing the parent. The source's current time at invocation is used, not a remembered earlier frame.

Only that frame determines the crop, not the entire animation. Internal keys are not deleted or frozen: other frames may extend beyond the new crop. The crop never expands beyond the original canvas. Repeated selected instances of the same source are deduplicated.

Successful runs show no dialog. One run is one Undo group. In a batch, supported sources may be cropped while unsupported sources are skipped.

Installation

  1. Download cropper.jsx. It is the only required file; the geometry library is embedded.
  2. For a one-time run, use File > Scripts > Run Script File....
  3. For a permanent installation, place it in Scripts and restart AE:
    • Windows: C:\Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\
    • macOS: /Applications/Adobe After Effects <version>/Scripts/
  4. Run File > Scripts > cropper.jsx, or add it as a script button in KBar/Mobar. This is a plain script without a panel, not a ScriptUI Panel.

Limitations

  • Geometric cropping, not rendered-alpha trimming. Transparent footage margins and nested precomp canvases can contribute bounds.
  • Expressions on inspected layers are rejected, not rewritten or baked. Locked affected layers also prevent the source's crop.
  • Effects, mask feather, internal track mattes, 3D, internal Auto-Orient, mixed pixel aspect ratios and collapsed precomp transformations are unsupported. Ordinary text/shape layers are allowed; per-character 3D text is not.
  • Masks and enabled effects on external instances are rejected because their coordinates require additional compensation.
  • Layer styles, motion-blur subframes, guides and Region of Interest are not accounted for. Unrelated expressions elsewhere in the project that depend on changed dimensions cannot be detected reliably.
  • The shared source changes, affecting every instance. Test complex scenes on a project copy.

Tests

Run tests/cropper-regression.jsx in AE. It creates temporary compositions, checks properties and projected coordinates, removes its fixtures and writes tests/artifacts/cropper-regression.txt. It does not compare rendered pixels for arbitrary scenes. Embedded Clipper license: vendor/NOTICE.txt.

About

Кроп прекомпов по текущему кадру с сохранением внешней анимации. / Current-frame precomp cropping with external transform animation preservation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages