Skip to content

lottie/expressions: support content() access by numeric index#4436

Open
tinyjin wants to merge 1 commit into
mainfrom
jinny/content-exp-number
Open

lottie/expressions: support content() access by numeric index#4436
tinyjin wants to merge 1 commit into
mainfrom
jinny/content-exp-number

Conversation

@tinyjin

@tinyjin tinyjin commented Jun 6, 2026

Copy link
Copy Markdown
Member

The index uses the item's authored "ix",
or its order in the shape list when absent.

related: #4394

test file :
content_index.json

Before After Expectation
CleanShot 2026-06-06 at 17 10 29@2x CleanShot 2026-06-06 at 17 16 59 CleanShot 2026-06-06 at 17 10 49

@tinyjin tinyjin self-assigned this Jun 6, 2026
Copilot AI review requested due to automatic review settings June 6, 2026 08:24
@tinyjin tinyjin requested a review from Nor-s as a code owner June 6, 2026 08:24
@tinyjin tinyjin added enhancement Improve features lottie Lottie animation labels Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Binary Size Report

Config main text main data PR text PR data Delta
arm64-clang 852,487 23,672 852,663 23,672 +176 (+0.02%)
x86-gcc 881,896 11,516 882,078 11,516 +182 (+0.02%)
x86_64-clang 857,478 22,176 857,646 22,176 +168 (+0.02%)
x86_64-gcc 863,201 21,912 863,395 21,912 +194 (+0.02%)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Lottie expressions content() accessor to support numeric indices, using the authored "ix" value when present and falling back to the object’s order within its parent’s shape list when "ix" is absent.

Changes:

  • Parse and store "ix" on LottieObject and assign a fallback index during shape list parsing when missing.
  • Add LottieGroup::contentByIdx() to resolve children by numeric index.
  • Update the expressions content() binding to accept either a string (name) or numeric (index) argument.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/loaders/lottie/tvgLottieParser.cpp Parses object "ix" and assigns a default index when missing.
src/loaders/lottie/tvgLottieModel.h Adds LottieObject::ix and introduces LottieGroup::contentByIdx() lookup.
src/loaders/lottie/tvgLottieExpressions.cpp Updates content() to resolve targets by either name or numeric index.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/loaders/lottie/tvgLottieExpressions.cpp
Comment thread src/loaders/lottie/tvgLottieModel.h
Comment thread src/loaders/lottie/tvgLottieParser.cpp
@hermet hermet added the compliance Specification Compliance for W3C, Lottie, SVG, etc. label Jun 8, 2026
The index uses the item's authored "ix",
or its order in the shape list when absent.

related: #4394
@hermet hermet force-pushed the jinny/content-exp-number branch from e6d26f4 to dba0077 Compare June 15, 2026 16:07
@github-actions

Copy link
Copy Markdown

Pixel Test Report

Backend Compared Diff Failed
gl 292 5 0
wg 292 5 0
sw 292 5 0

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

Labels

compliance Specification Compliance for W3C, Lottie, SVG, etc. enhancement Improve features lottie Lottie animation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants