Skip to content

Merge origin/main into origin/dev #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 11, 2025
Merged

Merge origin/main into origin/dev #1073

merged 10 commits into from
Jul 11, 2025

Conversation

yiiqii
Copy link
Collaborator

@yiiqii yiiqii commented Jul 11, 2025

Summary by CodeRabbit

  • New Features

    • Added a new demo showcasing multiple load types and scene management.
    • Demo index updated to reference the new multi-load-type demo.
  • Bug Fixes

    • Resolved issues with composition autoplay and playback.
    • Fixed bezier path easing logic for more accurate animations.
    • Improved canvas disposal logic to prevent resource leaks.
  • Chores

    • Updated package versions to 2.5.3 across all relevant packages.
    • Updated changelogs to reflect recent fixes and improvements.
    • Removed the old shape demo and its references from the project.

wumaolinmaoan and others added 10 commits July 9, 2025 16:51
* fix: opt canvas and gl dispose logic

* chore: update

* chore: update
fix: bezier path build const bezier easing
* fix: composition play issue

* chore: add multi load type demo

* chore: update case test version

---------

Co-authored-by: yiiqii <[email protected]>
@yiiqii yiiqii requested a review from wumaolinmaoan July 11, 2025 02:20
Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

Walkthrough

This update introduces patch versions 2.5.2 and 2.5.3 across multiple packages, reflecting several bug fixes and internal improvements. Key changes include adjustments to composition playback control, canvas ownership tracking, bezier easing instantiation, and demo asset management. Documentation and demo files were updated to align with these changes.

Changes

File(s) Change Summary
CHANGELOG.md, CHANGELOG-zh_CN.md Added entries for versions 2.5.2 and 2.5.3 with bugfix details.
packages/effects-core/package.json
packages/effects-helper/package.json
packages/effects-threejs/package.json
packages/effects-webgl/package.json
packages/effects/package.json
plugin-packages/alipay-downgrade/package.json
plugin-packages/downgrade/package.json
plugin-packages/editor-gizmo/package.json
plugin-packages/model/package.json
plugin-packages/multimedia/package.json
plugin-packages/orientation-transformer/package.json
plugin-packages/rich-text/package.json
plugin-packages/spine/package.json
plugin-packages/stats/package.json
Bumped package versions from 2.5.1 to 2.5.3.
packages/effects-core/src/composition.ts Removed assigned property and its usage from Composition class and update method.
packages/effects-core/src/math/bezier.ts Conditional creation of BezierEasing based on valueInterval using decimalEqual.
packages/effects-webgl/src/gl-engine.ts dispose method now checks destroyed property instead of isDestroyed.
packages/effects/src/player.ts Added useExternalCanvas property, adjusted error handling, and modified composition insertion logic.
web-packages/demo/html/multi-load-type.html
web-packages/demo/index.html
Replaced "shape" demo references with "multi-load-type" in HTML and navigation.
web-packages/demo/src/multi-load-type.ts New script for multi-load-type demo: loads multiple assets, manages playback and transforms.
web-packages/demo/src/shape.ts Deleted file; previously contained a shape demo and related logic.
web-packages/demo/vite.config.js Swapped build input from "shape" to "multi-load-type".
web-packages/test/case/src/common/test-controller.ts Updated fallback Player version string from "2.4.8" to "2.5.2".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Player
    participant DOM
    participant Composition

    User->>Player: new Player(container, canvas?)
    Player->>DOM: (optionally create canvas)
    Player->>Player: set useExternalCanvas flag

    Note over Player: On error during construction
    alt useExternalCanvas is false
        Player->>DOM: Remove internally created canvas
    end

    User->>Player: loadScene(sceneAssets)
    loop For each asset
        Player->>Composition: createComposition(asset)
        alt autoplay
            Player->>Composition: play()
        else
            Player->>Composition: pause()
        end
        Player->>Player: compositions.push(composition)
    end
Loading

Possibly related PRs

Suggested reviewers

  • wumaolinmaoan

Poem

Patchwork hops and version bumps,
Canvas swaps and easing jumps.
Demos shift, old shapes retire—
New assets dance, as specs require.
Bugs are squashed, the code’s pristine,
A rabbit grins—release thirteen!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yiiqii yiiqii merged commit 3e12ce2 into dev Jul 11, 2025
4 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
web-packages/demo/src/multi-load-type.ts (1)

31-43: Consider improving code maintainability and consistency.

The delayed scene loading demonstration is effective, but there are a few suggestions:

  1. The comment on line 31 is in Chinese - consider using English for consistency
  2. Consider extracting the hardcoded URLs to constants for better maintainability
+const SCENE_URLS = {
+  MAIN: 'https://gw.alipayobjects.com/os/gltf-asset/mars-cli/ILDKKFUFMVJA/1705406034-80896.json',
+  CARD: 'https://mdn.alipayobjects.com/mars/afts/file/A*u-NFTK_DS0IAAAAAAAAAAAAAelB4AQ',
+  DELAYED: 'https://mdn.alipayobjects.com/mars/afts/file/A*k6vyTpyAkykAAAAARYAAAAgAelB4AQ'
+};

const [_, card] = await player.loadScene([
-  json,
+  SCENE_URLS.MAIN,
  {
-    url: 'https://mdn.alipayobjects.com/mars/afts/file/A*u-NFTK_DS0IAAAAAAAAAAAAAelB4AQ',
+    url: SCENE_URLS.CARD,
    options: {
      autoplay: false,
    },
  },
]);

-// 改为点击触发即可
+// Could be triggered by click event instead
setTimeout(async () => {
  const composition = await player.loadScene({
-    url: 'https://mdn.alipayobjects.com/mars/afts/file/A*k6vyTpyAkykAAAAARYAAAAgAelB4AQ',
+    url: SCENE_URLS.DELAYED,
    options: {
      autoplay: false,
    },
  });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c9e1c5 and b3a6b97.

📒 Files selected for processing (26)
  • CHANGELOG-zh_CN.md (1 hunks)
  • CHANGELOG.md (1 hunks)
  • packages/effects-core/package.json (1 hunks)
  • packages/effects-core/src/composition.ts (1 hunks)
  • packages/effects-core/src/math/bezier.ts (1 hunks)
  • packages/effects-helper/package.json (1 hunks)
  • packages/effects-threejs/package.json (1 hunks)
  • packages/effects-webgl/package.json (1 hunks)
  • packages/effects-webgl/src/gl-engine.ts (1 hunks)
  • packages/effects/package.json (1 hunks)
  • packages/effects/src/player.ts (4 hunks)
  • plugin-packages/alipay-downgrade/package.json (1 hunks)
  • plugin-packages/downgrade/package.json (1 hunks)
  • plugin-packages/editor-gizmo/package.json (1 hunks)
  • plugin-packages/model/package.json (1 hunks)
  • plugin-packages/multimedia/package.json (1 hunks)
  • plugin-packages/orientation-transformer/package.json (1 hunks)
  • plugin-packages/rich-text/package.json (1 hunks)
  • plugin-packages/spine/package.json (1 hunks)
  • plugin-packages/stats/package.json (1 hunks)
  • web-packages/demo/html/multi-load-type.html (2 hunks)
  • web-packages/demo/index.html (1 hunks)
  • web-packages/demo/src/multi-load-type.ts (1 hunks)
  • web-packages/demo/src/shape.ts (0 hunks)
  • web-packages/demo/vite.config.js (1 hunks)
  • web-packages/test/case/src/common/test-controller.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • web-packages/demo/src/shape.ts
🧰 Additional context used
🧠 Learnings (9)
plugin-packages/rich-text/package.json (2)
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-07-26T21:12:19.313Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
plugin-packages/model/package.json (2)
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-07-26T21:12:19.313Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
packages/effects-webgl/src/gl-engine.ts (1)
Learnt from: wumaolinmaoan
PR: galacean/effects-runtime#691
File: packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts:39-42
Timestamp: 2024-10-18T09:15:08.038Z
Learning: In `packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts`, when accumulating color components, avoid using `clone()` methods because it can cause additional garbage collection overhead.
plugin-packages/downgrade/package.json (2)
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-07-26T21:12:19.313Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
packages/effects-core/src/composition.ts (1)
Learnt from: wumaolinmaoan
PR: galacean/effects-runtime#691
File: packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts:39-42
Timestamp: 2024-10-18T09:15:08.038Z
Learning: In `packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts`, when accumulating color components, avoid using `clone()` methods because it can cause additional garbage collection overhead.
packages/effects-core/src/math/bezier.ts (1)
Learnt from: wumaolinmaoan
PR: galacean/effects-runtime#691
File: packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts:39-42
Timestamp: 2024-10-18T09:15:08.038Z
Learning: In `packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts`, when accumulating color components, avoid using `clone()` methods because it can cause additional garbage collection overhead.
packages/effects-helper/package.json (2)
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-07-26T21:12:19.313Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
Learnt from: liuxi150
PR: galacean/effects-runtime#0
File: :0-0
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Imports in `plugin-packages/model/src/utility/plugin-helper.ts` do not need to be merged as per project preference or coding standards.
web-packages/demo/src/multi-load-type.ts (2)
Learnt from: wumaolinmaoan
PR: galacean/effects-runtime#691
File: packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts:39-42
Timestamp: 2024-10-18T09:15:08.038Z
Learning: In `packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts`, when accumulating color components, avoid using `clone()` methods because it can cause additional garbage collection overhead.
Learnt from: yiiqii
PR: galacean/effects-runtime#214
File: packages/effects/src/player.ts:416-429
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Data compatibility or processing logic related to replacing text variables in scene compositions should be handled in the AssetManager class through the updateOptions method, not in the Player class.
packages/effects/src/player.ts (2)
Learnt from: wumaolinmaoan
PR: galacean/effects-runtime#691
File: packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts:39-42
Timestamp: 2024-10-18T09:15:08.038Z
Learning: In `packages/effects-core/src/plugins/timeline/playables/color-property-mixer-playable.ts`, when accumulating color components, avoid using `clone()` methods because it can cause additional garbage collection overhead.
Learnt from: yiiqii
PR: galacean/effects-runtime#214
File: packages/effects/src/player.ts:416-429
Timestamp: 2024-10-17T07:15:16.523Z
Learning: Data compatibility or processing logic related to replacing text variables in scene compositions should be handled in the AssetManager class through the updateOptions method, not in the Player class.
🧬 Code Graph Analysis (2)
packages/effects-core/src/math/bezier.ts (1)
packages/effects-core/src/math/utils.ts (1)
  • decimalEqual (86-88)
web-packages/demo/src/multi-load-type.ts (1)
packages/effects/src/player.ts (1)
  • Player (24-958)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (30)
packages/effects-webgl/package.json (1)

3-3: Version bump to 2.5.3 looks good.

No further issues spotted.
Please remember to regenerate / commit the workspace lockfile (pnpm-lock.yaml) so the registry receives the exact dependency graph corresponding to this version.

packages/effects-core/package.json (1)

3-3: Patch-version alignment confirmed.

@galacean/effects-core is now at 2.5.3, matching the ecosystem.
Same note about updating the lockfile before publishing.

packages/effects/package.json (1)

3-3: Player package version increment acknowledged.

Everything else in the manifest remains unchanged and consistent.
Ensure you run pnpm install (or pnpm -r exec npm pack in CI) to verify there are no peer-dependency warnings after the bump.

packages/effects-threejs/package.json (1)

3-3: ThreeJS plugin version updated correctly.

No discrepancies found.
Lockfile refresh still required before publish.

plugin-packages/stats/package.json (1)

3-3: Stats plugin patch release accepted.

Manifest remains otherwise untouched and valid.

plugin-packages/model/package.json (1)

3-3: Patch bump is correct and consistent

Version updated to 2.5.3, matching the coordinated patch release across the repo.
No further action required.

plugin-packages/rich-text/package.json (1)

3-3: Version synchronized successfully

2.5.3 aligns with the core and sibling plugin packages.
Looks good.

packages/effects-helper/package.json (1)

3-3: Helper package version bump verified

Patch version set to 2.5.3; this keeps the helper library in lock-step with the runtime packages.

plugin-packages/orientation-transformer/package.json (1)

3-3: Orientation-transformer version updated

Change to 2.5.3 is correct and consistent with the mono-repo release strategy.

plugin-packages/spine/package.json (1)

3-3: Spine plugin patch release acknowledged

2.5.3 version bump matches the rest of the ecosystem; nothing else to flag.

plugin-packages/editor-gizmo/package.json (1)

3-3: Version bump looks good

Patch-level increment to 2.5.3 aligns with the rest of the workspace.
No other metadata affected—nothing else to flag.

plugin-packages/alipay-downgrade/package.json (1)

3-3: Consistent patch upgrade

The package now targets 2.5.3, keeping it in step with the core and sibling plugins.
Ship it.

plugin-packages/downgrade/package.json (1)

3-3: Patch version synced

2.5.3 is correctly applied. All other manifest sections remain intact.

plugin-packages/multimedia/package.json (1)

3-3: Patch version bump acknowledged

No additional changes observed. Good to merge.

web-packages/test/case/src/common/test-controller.ts (1)

7-7: Confirm availability of old artefacts on CDN

The fallback version for the legacy player/plugins moved to 2.5.2.
Before merging, make sure every required package (player + model, rich-text, spine, orientation-transformer) is published to npm at exactly 2.5.2; otherwise the tests will break when unpkg 404s.

If 2.5.3 is already published for all those artefacts, consider switching the constant to 2.5.3 for consistency.

packages/effects-core/src/math/bezier.ts (1)

407-411: LGTM! Proper handling of constant bezier easing.

The conditional instantiation of BezierEasing correctly handles the case where valueInterval is zero by creating a default (constant) easing instance. This optimization avoids unnecessary computations for constant bezier curves and aligns with the constructor's design where no parameters result in isConstant = true.

web-packages/demo/html/multi-load-type.html (2)

6-6: LGTM! Title update reflects demo content change.

The title change from "图形元素 - demo" to "多加载类型 - demo" accurately reflects the shift from a shape-focused demo to a multi-load-type demo.


19-19: LGTM! Script source updated consistently.

The script source change from "../src/shape.ts" to "../src/multi-load-type.ts" is consistent with the demo content update and aligns with the coordinated changes across the demo files.

web-packages/demo/index.html (1)

24-24: LGTM! Navigation updated to reflect demo changes.

The navigation link update from "图形元素" (shape.html) to "多加载类型" (multi-load-type.html) is consistent with the demo content restructuring and maintains proper navigation flow.

packages/effects-webgl/src/gl-engine.ts (1)

13-13: LGTM! Property name standardization.

The change from this.isDestroyed to this.destroyed appears to be a property name standardization that maintains the same disposal logic while improving consistency across the codebase.

CHANGELOG.md (1)

10-23: LGTM! Well-formatted changelog entries.

The changelog entries for versions 2.5.3 and 2.5.2 are properly formatted, include appropriate PR references, and accurately describe the fixes implemented in the codebase. The entries align with the code changes reviewed in the other files.

web-packages/demo/vite.config.js (1)

31-31: LGTM! Demo configuration update is correct.

The replacement of the 'shape' demo with 'multi-load-type' demo is properly configured in the build input entries.

CHANGELOG-zh_CN.md (1)

11-24: LGTM! Changelog entries are properly formatted and documented.

The version entries for 2.5.3 and 2.5.2 correctly document the composition autoplay fixes, bezier easing improvements, and canvas dispose logic optimizations with proper dates and PR references.

packages/effects-core/src/composition.ts (1)

619-621: Removal of assigned check in Composition.update is safe

All references to the old assigned flag have been removed, and Composition.update is only ever called by:

  • Player (in its ticker loop via this.compositions.forEach(comp => comp.update(dt)))
  • The Three.js display‐object plugin (composition.update(delta))

Player’s own methods (createComposition/loadScenethis.compositions and destroyCurrentCompositions) fully manage when compositions are added and removed, ensuring they’re initialized before any update runs. No further action required.

web-packages/demo/src/multi-load-type.ts (2)

1-15: LGTM! Well-structured demo with proper async patterns and error handling.

The Player initialization and error handling setup look good, properly demonstrating the interactive and transparent background features.


17-29: Good demonstration of multi-scene loading with different autoplay settings.

The code properly demonstrates loading multiple scenes with different configurations and composition manipulation. The destructuring assignment and subsequent manipulation of the card composition shows the key features well.

packages/effects/src/player.ts (4)

71-71: Clean property addition for canvas ownership tracking.

The useExternalCanvas property provides a clear way to track canvas ownership, which is essential for proper cleanup logic.


120-120: Proper canvas ownership flag setting.

The flag is correctly set when an external canvas is provided, enabling proper cleanup decisions later.


156-158: Excellent canvas cleanup improvement.

This conditional removal logic properly respects canvas ownership - only cleaning up internally created canvases while preserving externally provided ones. This prevents potential DOM manipulation issues and maintains proper resource management.


386-388: Critical timing fix for composition management.

This placement prevents premature rendering of non-autoplay compositions during multi-composition loading scenarios. The explicit comment warns against moving this code, indicating this addresses a specific and important rendering issue.

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