Skip to content
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

ESM script base class #6367

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

ESM script base class #6367

wants to merge 47 commits into from

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented May 14, 2024

New Script Base class

This PR adds a new base class Script to replace the current ScriptType class which is incompatible with ESM class syntax.

The Script class extracts a small subset of features from ScriptType and keeps anything related to ScriptAttributes in ScriptType. ScriptType now inherits from Script. This update minimizes the code changes required in the component system.

Files Changes

script.js renamed to script-create.js
script.js contains Script base class
script-type.js contains legacy ScriptType class

API Changes

ScriptAttributes.rawToValue is now exposed as a utility. This will also be used by the launcher page
ScriptRegistry.addSchema/getSchema - This stores a map of the the attribute schema <scriptName, schema>

Tests

Passes the ScriptType tests innpm run test:karma

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

Copy link

vercel bot commented May 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
engine ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 4:05pm

@Maksims
Copy link
Contributor

Maksims commented May 14, 2024

What would be the impact to users in terms of migrations or API changes?

@marklundin
Copy link
Member Author

What would be the impact to users in terms of migrations or API changes?

pc.createScript() will still work and return a ScriptType which should function in the same way. ESM users will use Script as a base class without any ScriptAttribute functionality (events, rawToValue deep copying)

marklundin and others added 29 commits May 28, 2024 12:18
…PU (#6394)

* Support for Picker on WebGPU

* Gizmos example on webgpu

* USDZ / GLTF exporter supports exposing of compressed textures on WebGPU

* tiny comment update

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
* SSAO engine example

* lint

* draco + texture resize: 17MB -> 6MB

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
* [BREAKING] Removed backwards compatibility for few functions

* lint

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
* treeshake smallest enabled

* ignore playcanvas PCUI from being treeshaken

* treeshake ignore only pcui

* added device type constants directly (no playcanvas dependency)

* format rollup

* word wrap fix

* Updated PCUI

* removed PCUI aliasing
…6593)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
* New texture formats: R8 and RG8

* Apply suggestions from code review

Co-authored-by: Will Eastcott <will@playcanvas.com>

* deprecate the old constants

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
* separated out grid code

* split out selector and disabled deselection on orbiting

* added type for observer set callback

* fixed example page
* cleaned up ts and js config; adds debug and profiler to exports

* set module resolution to node
* docs update

* Update README.md

---------

Co-authored-by: Will Eastcott <willeastcott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

7 participants