GDExtension: Fix _get_property_list
not working correctly in parent classes
#79683
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.
Godot-side fix for godotengine/godot-cpp#1183
The issue got really long as I spent all the evening investigating it, so in summary:
Godot used to get properties from extensions in two "passes" (first code by Reduz, later code by different contributors, but latter one was not a complete fix). First, it got all properties declared in
_bind_methods
, for every level of inheritance hierarchy.And only after that, it called the extension instance
_get_property_list
, which only returned procedural properties of the most derived class.Two problems:
_get_property_list
too, their properties didn't appear anymore, because the code only queried the most derived one;ClassDB::get_property_list
of every inheritance level, procedural properties ended up in the wrong class group in the inspector (always the most-base extension class).This fix replicates the behavior of
_get_property_listv
by properly interleaving properties added with_get_property_list
with those added in_bind_methods
, so they all get returned, and in the right place.There will be a GodotCpp-side fix to apply as well, because it seems GodotCpp sometimes returns the parent class
_get_property_list
when it should not, causing procedural properties to still sometimes appear in the wrong group.