Skip to content

Fix incorrect ImageBytes size and anchor for masked video layers in AE exporter#3589

Open
CodeJhF wants to merge 1 commit into
mainfrom
bugfix/markffan_video_mask
Open

Fix incorrect ImageBytes size and anchor for masked video layers in AE exporter#3589
CodeJhF wants to merge 1 commit into
mainfrom
bugfix/markffan_video_mask

Conversation

@CodeJhF

@CodeJhF CodeJhF commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

背景

参见 discussion #3578

当视频图层(video layer)在 After Effects 中添加了蒙版(mask)时,导出的占位图(ImageBytes)尺寸和锚点不正确,导致播放端图片定位错位。根因有两处:

  1. 渲染时间不正确AEGP_NewFromLayer 默认使用当前时间指示器位置,可能落在图层可见区间之外,导出的首帧内容错误(尤其存在 footage slip 时)。
  2. 蒙版裁剪未处理:当视频图层带蒙版时,AE 的 Layer Render 会把渲染结果裁剪到蒙版包围盒,导致导出的 width/height 变成裁剪后的尺寸,且未记录裁剪偏移,锚点随之错位。

改动

仅涉及 exporter/src/export/data/ImageBytes.cpp

  • 在渲染视频图层尺寸与像素前,显式将渲染时间设置为图层 in-point(layer time),确保渲染的是首个可见帧(含 footage slip)。
  • 新增 GetVideoLayerMaskedOffset,通过 AEGP_GetLayerMaskedBounds 获取蒙版包围盒在 layer space 的偏移。对包围盒 left/top 使用 floor 向下取整,与 AE 的像素级裁剪原点保持一致(避免负小数边界下产生 1px 偏差)。
  • 视频图层改用源素材尺寸作为逻辑内容尺寸;仅当渲染尺寸与源尺寸不一致(即发生蒙版裁剪)时,才计算并把蒙版偏移记入 anchorX/anchorY,使播放端能在 layer space 正确定位占位图。

验证

  • 本地以 -DPAG_BUILD_TESTS=ON 编译 PAGFullTest 通过。

Resolves discussion #3578

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.28%. Comparing base (0be6f16) to head (15f1e7f).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3589      +/-   ##
==========================================
+ Coverage   81.31%   82.28%   +0.96%     
==========================================
  Files         653      691      +38     
  Lines       77271    87954   +10683     
  Branches    21918    25281    +3363     
==========================================
+ Hits        62836    72376    +9540     
- Misses       9994    10300     +306     
- Partials     4441     5278     +837     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants