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

Support constant refs #16

Open
marklundin opened this issue Sep 18, 2024 · 0 comments
Open

Support constant refs #16

marklundin opened this issue Sep 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@marklundin
Copy link
Member

marklundin commented Sep 18, 2024

Similar to #12, it would be useful to specify default values via references

import { Script, SomeEnum } from 'playcanvas';

class MyScript extends Script {
   /**
    * @attribute
    * @type {Vec3}
    */
   up = Vec3.UP

  /**
   * @attribute
   * @type {SomeEnum}
   */
   value = SomeEnum.A
}

Currently this is not supported and the up needs to be initialised ie. (up = new Vec3(0, 1, 0)).

This should be easy to implement for local constant values defined within the program, however for playcanvas values ie VecX.UP etc, the parser only has the playcanvas types and not the actual values ie static readonly UP: Vec2;.

Any solution would need to account for both constant values within the program, and constant values defined with the engine.

@marklundin marklundin added the bug Something isn't working label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant