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] Use function names with underscore for TextServer extension, add macros to generate wrappers for module functions. #66492

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Sep 27, 2022

  • Change TextServerExtension virtual method names to start with underscore.
  • Add MODBIND* macros to automatically generate wrappers and method definitions to use same code as built-in module or GDExtension.
  • Re-enable test to check if virtual method names start with underscore.
  • Update TextServer code to build as GDExtension after FileAccess and some other recent changes.

Fixes #64814

Depends on godotengine/godot-cpp#870 (only for TextServer GDEXtension builds, it won't break CI or other GDExtension modules).

@MGilleronFJ
Copy link

MGilleronFJ commented Sep 27, 2022

It looks like this is for TextServer, but I had the same problem where my project can build both as a module and as GDExtension.
See for example what I had to do:
https://github.com/Zylann/godot_voxel/blob/dc9f1a7de0c3003f8a2adf5ecd5d231418db0ccf/editor/terrain/voxel_terrain_editor_plugin.h#L19
I have no idea how this MODBIND* works, but would it help with my use case?
(as you might notice, sometimes differences are more than just the _. See also a much worse situation in https://github.com/Zylann/godot_voxel/blob/dc9f1a7de0c3003f8a2adf5ecd5d231418db0ccf/util/godot/editor_import_plugin.h#L80)

@bruvzg
Copy link
Member Author

bruvzg commented Sep 28, 2022

I have no idea how this MODBIND* works, but would it help with my use case?
as you might notice, sometimes differences are more than just the _. See also a much worse situation in

The only thing it's doing is generating funcname -> _funcname wrapper and define for _funcname (with or without override).

As for the other differences in the https://github.com/Zylann/godot_voxel/blob/dc9f1a7de0c3003f8a2adf5ecd5d231418db0ccf/util/godot/editor_import_plugin.h#L80

HashMap and List can be used in the GDExtension. Some like Node *Object * are clearly bugs and should be fixed (but not directly related to this PR). For the other API differences, ifdefs are probably the only way to do it (the only other option is to change C++ API for specific cases in the engine, which was done for the TextServer some time ago).

…sion, add macros to generate wrappers for module functions.
@bruvzg bruvzg marked this pull request as ready for review September 28, 2022 07:49
@bruvzg bruvzg requested review from a team as code owners September 28, 2022 07:49
@akien-mga akien-mga modified the milestones: 4.x, 4.0 Sep 28, 2022
@akien-mga akien-mga merged commit 14e1f36 into godotengine:master Sep 28, 2022
@akien-mga
Copy link
Member

Thanks!

@bruvzg bruvzg deleted the gde_ts_underscr branch September 28, 2022 10:13
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.

Virtual methods in TextServerExtension are missing the undescore prefix
3 participants