-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add further details on properties returning Packed*Array
#85207
Conversation
4d8f6c2
to
980dc72
Compare
I don't know how to feel about this. The note of this PR talks about "returned values" and "methods", but the subject is always a property. The meaning of the note can only be inferred if you know what setters and getters are, and is otherwise still a bit puzzling. Also consider that both GDScript and C# discourage using setters/getters for built-in classes whenever possible, in favour of properties. |
This is an existing note applied to more places, I didn't write this just updated one and copied it around, this was done in (and has been in there for almost 5 years): |
I'm aware it does exist elsewhere, I am just a not fan of the way it is worded when applied to an Object's properties. |
I mean I get the issue, but adding this note to absolutely every case of using packed arrays in the entire Godot API seems like an overkill. |
Can work on the verbosity, or add a note to the packed arrays themselves and link to it instead, but this thing has caused a lot of confusion and I think just putting it in the manual isn't enough (and it isn't there yet either) |
Yeah, I am familiar with the kind of confusion it can cause, been there 🙂 But from the maintenance perspective this is unrealistic to keep up and keep in sync. Should we work on a more general solution if a method returns a value vs a reference? That way we could automate the notes/visual indication in the docs. Edit: Although here it's members, and not methods, which makes it even worse. I dunno, maybe this is the only way. |
Could have an automatic addition, can look into that, but I think important to have self contained in the built in docs |
Thinking an addition to all the Or something, will see the wording in Perhaps an automatic message of: |
3a32a97
to
c97b6ae
Compare
Added notes to |
Added an automatic note in the built-in documentation, will see how to implement the same for the rst generation etc., if this is the way to go Will also remove notes that already exist Any suggestions on either wording is welcome |
editor/editor_help.cpp
Outdated
@@ -1831,6 +1831,15 @@ void EditorHelp::_update_doc() { | |||
class_desc->push_indent(1); | |||
if (!cd.properties[i].description.strip_edges().is_empty()) { | |||
_add_text(DTR(cd.properties[i].description)); | |||
// Add copy note to built-in properties returning Packed*Array. | |||
if (!cd.is_script_doc && |
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.
Restricting to built-in classes at the moment, as from what I can tell at least for GDScript the data isn't copied like this but remains shared, but will investigate further as well
Not extremely familiar with the doc generation system but attempted to add the same feature to the rst side, any hints would be very welcome |
06b120a
to
c5a1b76
Compare
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.
Looks great and has been needed for a while.
Someone well versed in the rst generation and style would be appreciated to take a look at that side, it looked like it works correctly but I haven't worked with that side properly CC @Calinou I believe you've done some work in this area |
c5a1b76
to
01e74c0
Compare
1c317bf
to
b8f15ca
Compare
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.
Tested locally (rebased on top of master
29b3d9e), it works as expected.
Commits need to be squashed, besides that and the small note above this LGTM. |
Good, had separate commits for specific things, will fixup and squash |
b8f15ca
to
594e691
Compare
Needs rebase. |
594e691
to
23782b8
Compare
Thanks! |
Thank you! Great to get this merged, learned entirely new areas of the system |
Limited it to properties with setters and existing documentation, might be excessive but without some central point to point to explaining this I feel this is a relevant point to clarify generally (also easier to access the information from the built-in documentation)
Left the documentation for
Gradient
as is as it has more specific details, could possibly add specific details to some of these if they have specific setters for details, but left it simple for now