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

Example Playgrounds for Properties and Methods of Vector3 #12874

Merged
merged 8 commits into from
Aug 17, 2022
Merged

Example Playgrounds for Properties and Methods of Vector3 #12874

merged 8 commits into from
Aug 17, 2022

Conversation

BabylonJSGuide
Copy link
Contributor

@BabylonJSGuide BabylonJSGuide commented Aug 16, 2022

My apologies for the length of this comment, it is because I need advice on whether it will be part of my very limited project or a much larger undertaking by the community. As a large community undertaking it needs considering and approval by @deltakosh along with @PirateJC and @RaananW as it involves the docs even though it is on the API side and I would like to include @sebavan as he as also been very supportive and helpful to me. Please include anyone else you would like to talk to about it.

Reason Behind PR
Within the API classes the search the playground for each property and method is at best hit and miss, so I thought that each property and method of a class should have its own playground example, which should be simple and as meaningful as possible. For my limited project, except for a few where they were trivial or I couldn't think of a good example or I forgot, I have done this for all the methods and classes of Vector3 in this PR.

Implications for a Large Community Undertaking
An announcement about the undertaking.
If members do put in example PGs they could come in piecemeal so lots of individual PRs, unless there was somewhere else to submit them. This would require a moderator or moderators.
Some rules for submitting an example PG, eg

  1. PGs should be simple and where possible meaningful.
  2. Code for the particular property or method should appear near the top of the PG
    When meaningful means more complex code this can be achieved by wrapping the
    a. method code in a function as in https://playground.babylonjs.com/#R1F8YU#111
    b. method code within an onBeforeRenderObservable as in https://playground.babylonjs.com/#R1F8YU#63
    c. complex code within functions as in https://playground.babylonjs.com/#R1F8YU#106
  3. There should be comments at the top describing the method/property also stating the example use matching a template
  4. Template PGs for each class would be needed
  5. New or edited methods without a PG should have a PG submitted when method PR submitted

I am sure there are more implications and I am happy for the rules to change. I only came up with them after doing half the methods.

Also as members of the community have their own agendas it is probably wishful thinking that enough people would get involved to get it done.

In terms of my very limited project I am happy to continue with the math.vector.ts classes, eg Vector2, Vector4, etc

Let me know what you think and whether it is just my limited project or a community appeal.

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

Wow, thank you so much John! This is amazing.
I didn't go into all of the examples, but a playground to each of those methods will be very very helpful. especially for functions like project/unproject which can sometimes be a mystery.

There is a very small formatting issue and I think it will be great if the example be a part of the description (i.e. - before the @returns and @param lines.

@BabylonJSGuide
Copy link
Contributor Author

BabylonJSGuide commented Aug 16, 2022

Wow, thank you so much John! This is amazing. I didn't go into all of the examples, but a playground to each of those methods will be very very helpful. especially for functions like project/unproject which can sometimes be a mystery.

There is a very small formatting issue and I think it will be great if the example be a part of the description (i.e. - before the @returns and @param lines.

Having problems getting prettier to run to correct any formatting errors.

Also tried
npm run format:check and got

PS C:\Users\johnk\Documents\Github\Babylon.js> npm run format:check

@babylonjs/root@1.0.0 format:check
prettier --check ./packages//src//*.{ts,tsx,js,json,scss,css}

'prettier' is not recognized as an internal or external command,
operable program or batch file.

I have checked that is it set as default formatter for all languages.

Just found the format error (I hope) exactly one extra space at the end of one line.

Happy to move it before @params and @return.

Will wait until any more suggestions so I can deal with them in one go.

@RaananW
Copy link
Member

RaananW commented Aug 16, 2022

Wow, thank you so much John! This is amazing. I didn't go into all of the examples, but a playground to each of those methods will be very very helpful. especially for functions like project/unproject which can sometimes be a mystery.
There is a very small formatting issue and I think it will be great if the example be a part of the description (i.e. - before the @returns and @param lines.

Having problems getting prettier to run to correct any formatting errors.

Also tried npm run format:check and got

PS C:\Users\johnk\Documents\Github\Babylon.js> npm run format:check

@babylonjs/root@1.0.0 format:check
prettier --check ./packages//src//*.{ts,tsx,js,json,scss,css}

'prettier' is not recognized as an internal or external command, operable program or batch file.

I have checked that is it set as default formatter for all languages.

Just found the format error (I hope) exactly one extra space at the end of one line.

Happy to move it before @params and @return.

Will wait until any more suggestions so I can deal with them in one go.

Hey @BabylonJSGuide, so sorry about that prettier issue.
can you try running npm install prettier and try running the formatter right after? If that doesn't work, try installing prettier globally (i.e. npm install prettier -g). And as a final solution, try this -
npx prettier --write ./packages/**/src/**/*.{ts,tsx,js,json,scss,css}

If that doesn't work let's hop on a call to check what's up with your local repo.

@BabylonJSGuide
Copy link
Contributor Author

Hi @RaananW, thank you for the help. It was my problem, I just did a new clone of Babylon.js and then behaved as if it was the old one. Completely forgot to do npm install. All well now. As no more suggestions will get on with move Example line to descriptions.

@BabylonJSGuide
Copy link
Contributor Author

Examples move up to descriptions as requested

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@sebavan sebavan merged commit b829012 into BabylonJS:master Aug 17, 2022
RaananW pushed a commit that referenced this pull request Dec 9, 2022
Example Playgrounds for Properties and Methods of Vector3

Former-commit-id: 384092f708633873823ee589dd984c0adf2012fb
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