-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 by Bors] - Doc/module style doc blocks for examples #4438
[Merged by Bors] - Doc/module style doc blocks for examples #4438
Conversation
Your commit style is fine, we always squash the PR in a single commit using the PR title+description as the commit message so it doesn't matter how you commit while working on it. |
examples/2d/contributors.rs
Outdated
@@ -1,3 +1,32 @@ | |||
//! This example collects a list of all contributors to the bevy source code and renders a bouncing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would prefer if comments explaining a specific system were directly on that system and not all at the top. I think the top level doc should just be a short explanation of what it is. I would start with having the same short description found in the examples README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely agree here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks! I agree with IceSentry: we can keep the "module-level" comments pretty terse to start.
More detailed explanation (such as "why do we add LogPlugin
) belongs with that code, because it's a) more helpful to users there and b) less likely to go out of sync.
First, thanks for you fast and helpful feedback! I really dont know what I was thinking when doing the
Great, thanks!
I agree that especially the Maybe a way between those extremes would be useful? Do you thing the comments for I will rework the changes by (re-)moving details and keeping the file level doc block terse. |
I really like these comments :) They strike a nice balance, and provide some essential context on the examples. |
Oh, yeah, I was just suggesting the README comments as a starting point. I definitely agree that more detail is necessary. My issue was specifically about the comments explaining specific systems not being directly next to the system, |
I'm on board with this general approach. Whenever y'all think this is ready, feel free to merge! |
4ba0af0
to
cf66375
Compare
So, I think this is ready for review/feedback. All examples should have comments, I used the ones from the readme if I was not able to come up with something short and better (most of them), used existing comments where they existed. |
@bevyengine/docs-team can I get another set of eyes on this? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look at everything in detail, but it looks good to me except a couple of nitpicks
examples/stress_tests/many_cubes.rs
Outdated
@@ -1,8 +1,21 @@ | |||
//! Simple benchmark to test per-entity draw overhead | |||
//! | |||
//! To a realistic performance result, run this in release mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there's a missing word here. "To see a" or "To get a" or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! To a realistic performance result, run this in release mode. | |
//! To measure performance realistically, be sure to run this in release mode. |
examples/tools/scene_viewer.rs
Outdated
@@ -1,3 +1,8 @@ | |||
//! A simple way to view glTF models with Bevy. | |||
//! Just run `cargo run --release --example scene_viewer -- /path/to/model.gltf#Scene0`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the -- is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. Just tested this, and - at least with 1.60 on windows - cargo run
seems to pass additional paramters to the target binary.
I'll remove all --
from cargo run
s in the examples.
@@ -1,3 +1,5 @@ | |||
//! An empty application (does nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love that this example exists, but that's not this PR's fault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want me to delete it?
Not sure if thats something that should be done in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to say that this should be done in a separate PR, yeah.
@@ -1,3 +1,5 @@ | |||
//! Allows reflection with trait objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't terribly descriptive; but IMO we should tackle this as part of a push to properly document and explain bevy_reflect instead.
examples/scene/scene.rs
Outdated
@@ -1,6 +1,7 @@ | |||
//! This example illustrates loading and saving scenes from files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could really use a brief explanation of what a "scene" is in Bevy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me to add that, I'd need to understand that myself 😅. From what I understand, a Scene
is a newtype wrapper around a World
so we can put complete worlds - for example loaded from gltf assets - into our main world. That works by copying all components from the scene to the world its spawned in when the command is executed. Therefor, it does not really 'mount' other worlds into our app.world, it just uses the container to spawn a coupled set of components/entities into it?
a
Scene
is a set of entites that can be loaded from an asset and added to our world.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's about the right idea. They're effectively "ECS data, but on disk". We can clean this up later :)
@@ -1,3 +1,5 @@ | |||
//! A compute shader simulating Conway's Game of Life |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's a compute shader? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a sentence to add some context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Great work; and we can build on these further.
In general, I think these could benefit from having a bit more "background explanation" about the topics they're covering, but I'm fine to address those in follow-up PRs.
IMO we should clean up the few typos, and then merge this.
9afa163
to
16ed993
Compare
Thanks for the quick feedback, I tried to address all points. |
@bevyengine/docs-team + @Nilirad can I have another review or two on this? I'd like to get this in and start enforcing it as a standard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doing this review by pieces since the PR is quite big. I reached the load_gltf
example. I mostly did consistency checks and, in a couple of cases, I suggested a longer, more specific suggestion.
examples/2d/mesh2d_manual.rs
Outdated
@@ -1,3 +1,8 @@ | |||
//! This example shows how to manually render 2d items using "mid level render apis" with a custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! This example shows how to manually render 2d items using "mid level render apis" with a custom | |
//! This example shows how to manually render 2d items using "mid level render apis" with a custom |
Double space.
examples/2d/mesh2d_manual.rs
Outdated
//! It doesn't use the [`Material2d`] abstraction, but changes the vertex buffer to include vertex color | ||
//! Check out the "mesh2d" example for simpler / higher level 2d meshes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! It doesn't use the [`Material2d`] abstraction, but changes the vertex buffer to include vertex color | |
//! Check out the "mesh2d" example for simpler / higher level 2d meshes | |
//! It doesn't use the [`Material2d`] abstraction, but changes the vertex buffer to include vertex color. | |
//! Check out the "mesh2d" example for simpler / higher level 2d meshes. |
Period at the end of sentence.
examples/2d/rect.rs
Outdated
@@ -9,6 +11,8 @@ fn main() { | |||
|
|||
fn setup(mut commands: Commands) { | |||
commands.spawn_bundle(OrthographicCameraBundle::new_2d()); | |||
|
|||
// Since this Sprite is not generated from an image, we have to specify its size in `custom_size`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Since this Sprite is not generated from an image, we have to specify its size in `custom_size`. | |
// Since this `Sprite` is not generated from an image, we have to specify its size in `custom_size`. |
Monospace consistency.
examples/2d/rotation.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! Demonstrates rotating entities in 2D with quaternions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! Demonstrates rotating entities in 2D with quaternions. | |
//! Demonstrates rotating entities in 2D using quaternions. |
Just my opinion, feel free to skip if using “with” is sufficient.
examples/2d/texture_atlas.rs
Outdated
@@ -1,7 +1,8 @@ | |||
//! In this example we generate a new texture atlas (sprite sheet) from a folder containing | |||
//! individual sprites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! individual sprites | |
//! individual sprites. |
Sentence period.
examples/3d/3d_scene.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! Simple 3D scene with basic shapes and lighting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I would think about changing the description into something less generic, that makes the reader expect more what they are about to see, since the focus of the example is on the scene itself; maybe something like:
A simple 3D scene with light shining over a cube sitting on a plane.
examples/3d/lighting.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! Illustrates various lighting options in a simple scene |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! Illustrates various lighting options in a simple scene | |
//! Illustrates various lighting options in a simple scene. |
Sentence period.
examples/3d/lighting.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! Illustrates various lighting options in a simple scene |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description should talk about the fact that there are used different light types (point, directional, ...) and different colors, instead of simply stating “various lighting options”.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sounds good. I'll try to come up with something more helpful!
examples/3d/load_gltf.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! Loads and renders a gltf file as a scene |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! Loads and renders a gltf file as a scene | |
//! Loads and renders a glTF file as a scene. |
This is the capitalization that Khronos uses. If one is referring to the file extension instead, they should write “.gltf
file” instead. It is ok to say “glTF file” since it is another wording for “file with glTF format”.
I also added the period.
examples/2d/text2d.rs
Outdated
@@ -1,3 +1,10 @@ | |||
//! Example to show text rendering with moving, rotating and scaling text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! Example to show text rendering with moving, rotating and scaling text. | |
//! Shows text rendering with moving, rotating and scaling text. |
Saying it is an example doesn't convey any new or useful information.
Thanks for the annotations, @Nilirad! I went through the list and added periods where they where missing in the header comment. I did not fix punctuation for all existing comments (yet), as I think that would increase the pull request size even more. |
The plan here is having a short, but helpful, introduction to each example. Stating what is meant to be shown, without going into details.
I used the text from the README as a default, or comments from the `main` if they existed in the example, sometime adding a bit more context. Some slight re-wording or layout changes where also applied.
re-sorted two groups alphabetically.
c796c38
to
cbc2470
Compare
Thanks again @Nilirad, I copied all your suggestions. At least I hope I got them all correct, at this point I doubt my ability to do even that. Anyhow, I rebased on the current main branch, as there was a merge conflict (2d/rect.rs got deleted). A few new examples have been added in the meantime, some of them without commets, so I tried to add at least a basic one. Basically longer versions of the file name 😕. |
You did a great job with this PR! The amount of files made it a gigantic task, and that's normal to make some mistakes. That's why reviews are fundamental. I'll do now a quick final pass to ensure there aren't misplaced descriptions. I'll ignore typos, grammar, punctuation or form so we can merge it ASAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are no grave mistakes. Thank you for accomplishing this task @themasch, and congratulations for your first merged contribution! 🎉
bors r+ |
# Objective Provide a starting point for #3951, or a partial solution. Providing a few comment blocks to discuss, and hopefully find better one in the process. ## Solution Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. ## Changelog - Moved some existing comments from main() functions in the 2d examples to the file header level - Wrote some more comment blocks for most other 2d examples TODO: - [x] 2d/sprite_sheet, wasnt able to come up with something good yet - [x] all other example groups... Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
# Objective Provide a starting point for bevyengine#3951, or a partial solution. Providing a few comment blocks to discuss, and hopefully find better one in the process. ## Solution Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. ## Changelog - Moved some existing comments from main() functions in the 2d examples to the file header level - Wrote some more comment blocks for most other 2d examples TODO: - [x] 2d/sprite_sheet, wasnt able to come up with something good yet - [x] all other example groups... Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
# Objective Provide a starting point for bevyengine#3951, or a partial solution. Providing a few comment blocks to discuss, and hopefully find better one in the process. ## Solution Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. ## Changelog - Moved some existing comments from main() functions in the 2d examples to the file header level - Wrote some more comment blocks for most other 2d examples TODO: - [x] 2d/sprite_sheet, wasnt able to come up with something good yet - [x] all other example groups... Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
# Objective Provide a starting point for bevyengine#3951, or a partial solution. Providing a few comment blocks to discuss, and hopefully find better one in the process. ## Solution Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. ## Changelog - Moved some existing comments from main() functions in the 2d examples to the file header level - Wrote some more comment blocks for most other 2d examples TODO: - [x] 2d/sprite_sheet, wasnt able to come up with something good yet - [x] all other example groups... Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
Objective
Provide a starting point for #3951, or a partial solution.
Providing a few comment blocks to discuss, and hopefully find better one in the process.
Solution
Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less.
Changelog
TODO:
Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed.
I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.