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

Tools Recipes #23

Merged
merged 13 commits into from
Jan 14, 2024
Merged

Conversation

QueenOfSquiggles
Copy link
Contributor

This PR adds a section dedicated to describing how to get started with tooling using godot-rust. Specifically the three main categories available to the average developer:

  • Simple Types: defining custom Object, Resource, and Node types for the end-user
  • EditorPlugin: creating an EditorPlugin type for typical plugin development
  • Engine Singletons: creating an "always on" singleton easily available to GDScript

The guides go over why each method is valuable and how to implement them, with recommendations and callouts for specific pitfalls where necessary.

I have no doubt I made some mistakes so far, but this is just an initial commit. Excited to hear what y'all think

@QueenOfSquiggles
Copy link
Contributor Author

I just realized I accidentally merged the admonish stuff which messed with the TOML

@QueenOfSquiggles
Copy link
Contributor Author

Working on lint issues

@Bromeon Bromeon added the new-topic New content added to the book label Jan 6, 2024
@Bromeon Bromeon linked an issue Jan 6, 2024 that may be closed by this pull request
@Bromeon
Copy link
Member

Bromeon commented Jan 6, 2024

💡 You can auto-fix some of the lints, see ReadMe and lint.sh script.

@QueenOfSquiggles
Copy link
Contributor Author

I don't imagine I'd add the gdscript highlighting in this PR. I'm also struggling to figure out how to add it to mdbook so I'd have to do some digging to figure that out.

@Bromeon
Copy link
Member

Bromeon commented Jan 6, 2024

All good, we can always add it later 🙂 also, would deserve its own PR anyway...

@QueenOfSquiggles
Copy link
Contributor Author

Following up on this PR, is there a plan to merge? Does it require a review? Anything I can do? If y'all want me to make some edits I'd be happy to do so. Just wanna know the plan

Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

Thanks a lot! 👍

I gave quite some feedback. In general, I'm sometimes a bit nitpicky about precise formulations 😬 but since this is tutorial-level material, it's quite important that terminology is clear and unambiguous, and that we use full sentences where possible (sometimes even in comments). But my comments are mostly technicalities, the content itself is great!

book.code-workspace Outdated Show resolved Hide resolved
src/SUMMARY.md Outdated Show resolved Hide resolved
src/tooling/index.md Outdated Show resolved Hide resolved
src/tooling/index.md Outdated Show resolved Hide resolved
src/tooling/index.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

Would also be good to have all the code snippets run through rustfmt 🧹

src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
src/tooling/tooling-simple-types.md Outdated Show resolved Hide resolved
@QueenOfSquiggles
Copy link
Contributor Author

I took a breeze through the review and answered. Im gonna spend a few hours cleaning this up once I've got myself some tea

Copy link
Contributor Author

@QueenOfSquiggles QueenOfSquiggles left a comment

Choose a reason for hiding this comment

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

I just pushed a version taking your recommendations into consideration, which did constitute drastic changes to two (one being created) files.

@QueenOfSquiggles
Copy link
Contributor Author

dangit forgot license and lint again 😩

@QueenOfSquiggles
Copy link
Contributor Author

I wager another round of review might be needed. But hopefully this is cleaner and more readable than before!

Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

Thanks for the update! 🙂

General points:

  1. Titles do not get special capitalization, but follow English grammar (just first word and names like "Rust" or "Godot" are capitalized).
  2. Avoid "tooling", as mentioned before.
  3. The writing style should generally be objective and not too opinionated, I mentioned a few instances 🙂
  4. If you see a "Suggested change" diff in a review comment, you can directly apply it via the web UI. This saves you from manually needing to rewrite things, and makes sure all my suggestions are included.
  5. Links should ideally be expanded at the end of the page, not inline.

Sorry for the extra work -- maybe next time, it's better to submit only one page at a time, and then apply the suggestions there to more writing before submitting additional PRs. Either way, thanks a lot! 👍

src/SUMMARY.md Outdated Show resolved Hide resolved
src/recipes/tooling-custom-resources.md Outdated Show resolved Hide resolved
src/recipes/tooling-custom-resources.md Outdated Show resolved Hide resolved
src/recipes/tooling-custom-resources.md Outdated Show resolved Hide resolved
src/recipes/tooling-custom-resources.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
@QueenOfSquiggles
Copy link
Contributor Author

I'll have a deeper look through the review later today

@QueenOfSquiggles QueenOfSquiggles changed the title Tooling Guide Section Tools Recipes Jan 10, 2024
@Bromeon
Copy link
Member

Bromeon commented Jan 11, 2024

Thanks for the updates. Could you rebase this onto lastest master? There are now lots of commits from my changes showing up, which makes review harder.

Also, please ping me once the next round is ready for review -- no rush though! 🙂

@QueenOfSquiggles
Copy link
Contributor Author

@Bromeon as far as I can tell my latest commit (Linting pt 2 #40d62b9) is already rebased with the latest commits on this repo applied. Let me know if there's anything more I can/should do

@MarkWilds
Copy link

MarkWilds commented Jan 13, 2024

This is amazing! great job. Do you also know how to implement the "handles" function in rust?

edit
I think I found a way:
pub fn class_name() -> ClassName { ClassName::from_ascii_cstr("WildVoxelMap".as_bytes()) }
That is what I have to implement in my GodotClass

@QueenOfSquiggles
Copy link
Contributor Author

This is amazing! great job. Do you also know how to implement the "handles" function in rust?

edit I think I found a way: pub fn class_name() -> ClassName { ClassName::from_ascii_cstr("WildVoxelMap".as_bytes()) } That is what I have to implement in my GodotClass

I appreciate your interest in learning! But I don't think this is the best forum for that kind of question. I'd recommend the godot-rust discord server, specifically the "#help-gdext" channel which is for floating those kinds of questions to the community. Best of luck!

@Bromeon Bromeon force-pushed the squiggles-tooling-section branch from 40d62b9 to 7fa58ab Compare January 13, 2024 17:18
@Bromeon Bromeon force-pushed the squiggles-tooling-section branch from 7fa58ab to 4ef90d8 Compare January 13, 2024 17:20
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

Thanks, almost there 🙂

I rebased onto master and squashed the 36 commits (29 without mine) to 1.

Comment on lines +8 to +9
mdbook-admonish.css
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? The css should not be in the root.

Also, what is *.code-workspace?
VS Code's directory is typically .vscode, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That keeps happening because mdbook refuses to serve without running mdbook-admonish install. To check my edits I have to cause issues to the toml and then clear it out to push. Must have missed that.

as for *.code-workspace, that's the file type for defining workspace settings overrides. I use it to force wrap at 150 characters, so I can easily see where to make line breaks.

Comment on lines 21 to 28
```admonish hint
Note that the path is based off of the `res://` path, like all other resources for Godot.
This means that you will need to have a standard
installation path for your tool. It is recommended to make this in the "addons" folder because
this will clearly signify to users that it is a
directory of third party resources and code and that they likely shouldn't mess
with it unless they are certain of what they are doing.
```
Copy link
Member

Choose a reason for hiding this comment

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

Something is off with the line lengths here, maybe you accidentally broke them too early?

Copy link
Member

Choose a reason for hiding this comment

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

Also, is addons/ actually an established convention? If yes, is there some documentation for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll have to check those lines in my editor

From the basis that GDScript plugins must be installed into the addons/ folder, it seems reasonable (to me) that we suggest addons/ as the folder for GDExtension by default, especially if writing using EditorPlugin to do typical plugin modifications to the editor interface and such. It also cleans things up for redistribution because the end user doesn't necessarily need to know that the plugin is written in rust rather than gdscript in order to install correctly. Though if you want this to be changed to be less opinionated I can make that change

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense in that case!

Could you insert a link to the docs where this addons for GDScript is explained?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just pushed a commit with a link to the "Installing Plugins" page of the docs, which includes a callout detailing how to tell if something is a plugin. I'd argue that section should be updated to include .gdextension files, but one step at a time

src/recipes/custom-resources.md Outdated Show resolved Hide resolved
src/recipes/custom-resources.md Outdated Show resolved Hide resolved
src/recipes/custom-resources.md Outdated Show resolved Hide resolved
src/recipes/engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/tooling-engine-singleton.md Outdated Show resolved Hide resolved
src/recipes/custom-icons.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@QueenOfSquiggles QueenOfSquiggles left a comment

Choose a reason for hiding this comment

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

I'm just awaiting further change requests on this. And some verification on if certain changes are needed.

Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

I think we're slowly getting there, thanks for the quick update! 🙂

src/recipes/custom-icons.md Outdated Show resolved Hide resolved
src/recipes/custom-icons.md Outdated Show resolved Hide resolved
src/recipes/editor-plugin.md Outdated Show resolved Hide resolved
src/recipes/index.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@QueenOfSquiggles QueenOfSquiggles left a comment

Choose a reason for hiding this comment

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

Got another round of fixes done

@Bromeon
Copy link
Member

Bromeon commented Jan 14, 2024

Really nice addition. Thanks for all the corrections and the patience! 🙂

@Bromeon Bromeon merged commit ddcf2c0 into godot-rust:master Jan 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-topic New content added to the book
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Topic: Tooling Resources
3 participants