docs: Clarify Object custom-property name collision in class reference - #122435
Closed
basteez wants to merge 1 commit into
Closed
docs: Clarify Object custom-property name collision in class reference#122435basteez wants to merge 1 commit into
basteez wants to merge 1 commit into
Conversation
Member
|
AI generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds a clarifying
Note:to the_get_property_list()description in theObjectclass reference (doc/classes/Object.xml), warning that a custom property'snamemust not collide with an existing member variable or built-in property (including@exportvars).Why
Reported in #64227: a user defined a real member variable and returned a property with the same name from
_get_property_list(), then overrode_set()to react to changes. Their_set()was never called, so the inspector never refreshed. Prefixing the name (e.g./my_property) made it work, because the name no longer matched a real member.This is intended behavior, confirmed by @HolonProduction in the issue thread —
_get()/_set()are not called for built-in properties, and a_get_property_list()entry whose name matches a member collides with that built-in property.The existing
_get()/_set()notes already state the "not called for built-in properties" half. What was missing is the connection: don't reuse a member variable's name for a custom property. This PR adds exactly that, at the method that adds the names.The note
Prose-only (no code sample), so it can't drift out of sync across the GDScript/C# examples. It frames the rule generally rather than documenting the
/prefix as a supported feature, since that's an incidental side effect of the name no longer matching a member.Scope
Docs-only. No C++, no scripting API, no other XML files. The GDScript tutorial prose quoted in the report lives in
godot-docsand could get a matching clarification as a follow-up there.Testing
make_rst.py doc/classes modules platform --dry-runreports no warnings or errors; all[method ...]/[annotation ...]references resolve.git diff --statshows onlydoc/classes/Object.xmlchanged.Closes #64227