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

GDExtension: Fix _get_property_list not working correctly in parent classes #79683

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

Zylann
Copy link
Contributor

@Zylann Zylann commented Jul 20, 2023

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:

  • If parent classes declare _get_property_list too, their properties didn't appear anymore, because the code only queried the most derived one;
  • Since it came after 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.

Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Thanks!

This looks good to me, and helps to fix the issue in my testing.

@YuriSizov YuriSizov changed the title GDExtension: fix _get_property_list not working correctly in parent classes GDExtension: Fix _get_property_list not working correctly in parent classes Jul 26, 2023
@YuriSizov YuriSizov merged commit a68137b into godotengine:master Jul 26, 2023
@YuriSizov
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants