Skip to content

Add asset load event #7803

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 1 commit into from
Jun 30, 2025
Merged

Add asset load event #7803

merged 1 commit into from
Jun 30, 2025

Conversation

slimbuck
Copy link
Member

This PR adds an event fire on PLY asset load.

The event is called load:data and sends the newly created GSplatData instance so the user can modify it before constructing the GSplatInstance.

This was needed so we can continue to support things like 2dgs in supersplat (playcanvas/supersplat#528).

@slimbuck slimbuck requested review from a team and Copilot June 30, 2025 08:48
@slimbuck slimbuck self-assigned this Jun 30, 2025
@slimbuck slimbuck added the area: graphics Graphics related issue label Jun 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

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 introduces a new load:data event on PLY asset load so consumers can intercept and modify the parsed GSplatData before it’s turned into an instance.

  • Fires load:data on the asset with the raw data object after parsing.
  • Ensures reordering step still occurs after event handlers run.
  • Enables external extensions (e.g., 2dgs support) to hook into PLY processing.
Comments suppressed due to low confidence (3)

src/framework/parsers/ply.js:613

  • Add a unit or integration test to verify that the load:data event is emitted and that event handlers can observe and modify the data object as expected.
                asset.fire('load:data', data);

src/framework/parsers/ply.js:612

  • [nitpick] Consider updating the public API docs or adding a JSDoc comment here to explain when and why consumers should listen for load:data, and what shape of data they can expect.
                // allow application to process the data

src/framework/parsers/ply.js:613

  • [nitpick] Review existing asset event naming conventions (e.g., use of colons vs. hyphens) to ensure load:data aligns consistently with other events in the framework.
                asset.fire('load:data', data);

@slimbuck slimbuck merged commit 0c113b2 into playcanvas:main Jun 30, 2025
7 checks passed
@slimbuck slimbuck deleted the ply-dev branch June 30, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants