Skip to content

perf: opt playable asset #368

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 2 commits into from
May 22, 2024
Merged

perf: opt playable asset #368

merged 2 commits into from
May 22, 2024

Conversation

wumaolinmaoan
Copy link
Contributor

@wumaolinmaoan wumaolinmaoan commented May 21, 2024

Summary by CodeRabbit

  • New Features

    • Introduced editorScaleRatio property in the Composition class for better scaling control.
    • Added new methods and properties to TransformAnimationPlayable and TransformAnimationPlayableAsset classes for enhanced animation handling.
  • Improvements

    • Enhanced the Engine class to better handle animations within jsonScene.
    • Improved the handling of clips within tracks in calculate-item.ts.
    • Adjusted position and size calculations in the ParticleSystem class based on the environment.
  • Refactor

    • Simplified logic for creating new TimelineClip instances.
    • Modified visibility of addClip method in Track class to allow external access.
    • Updated handling of different data types in migration functions for better data integrity.

Copy link
Contributor

coderabbitai bot commented May 21, 2024

Walkthrough

The recent updates to the effects-core package encompass various enhancements and refactorings. Key changes include modifications to import statements, handling of optional properties, and improvements in data processing methods. Notably, new properties and methods have been introduced to several classes, enhancing their functionality and flexibility. The Track class's addClip method's visibility has been changed for broader access, and new decorators and data handling mechanisms have been integrated into animation-related classes.

Changes

File Path Change Summary
packages/effects-core/src/composition-source-manager.ts Modified import statement for TimelineAsset, handled absence of sceneBindings, and adjusted timelineAsset loading.
packages/effects-core/src/composition.ts Added editorScaleRatio property to Composition class.
packages/effects-core/src/engine.ts Added code to handle jsonScene.animations by iterating and calling this.addEffectsObjectData.
packages/effects-core/src/fallback/migration.ts Updated handling of data types, introduced new PlayableAssetData structures, and adjusted timelineAsset and sceneBindings assignments.
.../src/plugins/cal/calculate-item.ts Refactored clip handling within tracks, simplified logic, and updated imports.
.../src/plugins/cal/calculate-vfx-item.ts Added private data property, onGraphStart method, and decorator to TransformAnimationPlayableAsset class.
.../src/plugins/cal/track.ts Changed addClip method visibility from private to public in Track class.
.../src/plugins/particle/particle-system.ts Added import for PLAYER_OPTIONS_ENV_EDITOR and adjusted calculations based on environment.
.../src/plugins/sprite/sprite-item.ts Added PlayableAsset import, modified fromData method, introduced SpriteColorPlayableAsset class, and defined SpriteColorPlayableAssetData interface.

🐇✨
In the code where changes bloom,
Imports shift to make more room.
New properties and methods gleam,
Enhancing each developer's dream.
Tracks now open, clips align,
With playful assets, all refined.
Let's celebrate with hops and cheer,
For better code is finally here!
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6b34325 and 9ee4364.
Files selected for processing (9)
  • packages/effects-core/src/composition-source-manager.ts (3 hunks)
  • packages/effects-core/src/composition.ts (1 hunks)
  • packages/effects-core/src/engine.ts (1 hunks)
  • packages/effects-core/src/fallback/migration.ts (4 hunks)
  • packages/effects-core/src/plugins/cal/calculate-item.ts (2 hunks)
  • packages/effects-core/src/plugins/cal/calculate-vfx-item.ts (4 hunks)
  • packages/effects-core/src/plugins/cal/track.ts (1 hunks)
  • packages/effects-core/src/plugins/particle/particle-system.ts (3 hunks)
  • packages/effects-core/src/plugins/sprite/sprite-item.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • packages/effects-core/src/composition.ts
Additional comments not posted (11)
packages/effects-core/src/plugins/cal/track.ts (1)

64-64: Visibility of addClip method changed to public.

Ensure that this method is robust and handles all edge cases since it can now be accessed more broadly.

packages/effects-core/src/plugins/cal/calculate-item.ts (1)

80-85: Refactored handling of clips within tracks.

Ensure that all properties necessary for the correct functioning of clips are being set in the new TimelineClip instances.

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

98-103: Added handling for jsonScene.animations.

Verify that addEffectsObjectData correctly processes each animationData and that no animations are missed.

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

Line range hint 87-115: Improved handling of sceneBindings and timelineAsset.

Ensure that sceneBindings is correctly initialized as an empty array when absent and that timelineAsset is properly loaded based on its id.

packages/effects-core/src/plugins/cal/calculate-vfx-item.ts (1)

Line range hint 51-196: Enhanced TransformAnimationPlayable with new properties and methods.

Verify that the new data property and onGraphStart, processFrame methods are correctly implemented and integrate well with existing functionalities.

packages/effects-core/src/fallback/migration.ts (1)

Line range hint 423-515: Updated handling of dataType values and creation of new PlayableAssetData objects.

Ensure that dataType values are correctly set for various components and that new PlayableAssetData objects are created appropriately.

packages/effects-core/src/plugins/sprite/sprite-item.ts (3)

18-18: The updated imports align with the new class implementations and refactoring strategy.


111-111: Updated method signature enhances type safety and clarity in data handling.


127-148: Introduction of SpriteColorPlayableAsset class and related data types enhances modularity and clarity. Good use of decorators to define class responsibilities.

packages/effects-core/src/plugins/particle/particle-system.ts (2)

645-650: Adjust particle position based on editor scale ratio.

Consider adding a comment explaining why this adjustment is necessary, as it helps maintain the code's readability and understandability.


745-748: Adjust particle size based on editor scale ratio.

Consider adding a comment explaining why this adjustment is necessary, as it helps maintain the code's readability and understandability.

@yiiqii yiiqii merged commit 32ce259 into feat/2.0 May 22, 2024
@yiiqii yiiqii deleted the perf/playable branch May 22, 2024 02:58
@coderabbitai coderabbitai bot mentioned this pull request Feb 20, 2025
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.

3 participants