Commit Graph

192 Commits (ef4c38418e114647ccc0b80ac95b2634471a7877)

Author SHA1 Message Date
Fabio Alessandrelli 71b5b84fb1 [Bindings] Build profile now strips methods and skip files
This allows removing dependencies that are not explicitly unused by the
gdextension being built and is implemented using an intermediate json
API file with the methods and classes stripped (i.e. without touching
the file generators).

(cherry picked from commit c4f1abe3f9)
2025-01-27 15:58:30 -06:00
Mikael Hermansson f9095a5552 Fix incorrect generation of some C++ operators
(cherry picked from commit 9949d09f3e)
2024-09-03 17:14:57 -05:00
Raul Santos 63c67a9977 Avoid hardcoded type conversion for metadata
The engine uses the names `int` and `float` to refer to the 64-bit types, so in the bindings generator we have a hardcoded conversion for those types.

But this type conversion should not be used for metadata. Even though the underlying type should still be 64-bit for interop, metadata is meant to specify the correct type to expose. So if metadata says `float` it means the type is really meant to be a 32-bit `float` and not `double`. Other hardcoded type conversions (`int` and `Nil`) won't ever be metadata.

This change corrects the `float` type, to use the right type in the generated C++ code. Before we were always using `double` due to this type conversion.

(cherry picked from commit 4829199081)
2024-09-03 17:14:48 -05:00
A Thousand Ships 12f6eecf65 Make generated code mostly style compliant
(cherry picked from commit f131efb791)
2024-09-03 17:14:15 -05:00
Thaddeus Crews c35e7545b7 Integrate `.pre-commit-config.yaml`
(cherry picked from commit e0d363aad8)
2024-07-17 09:17:36 -05:00
A Thousand Ships 19f56af1be Fix some style details in generation
(cherry picked from commit e7a13e3bf4)
2024-07-17 09:12:21 -05:00
A Thousand Ships 7f3e914c6d Enforce `p_` prefixes for arguments in binds
(cherry picked from commit 9e2771f918)
2024-07-17 09:11:54 -05:00
Fabio Alessandrelli 528b7801d2 Add support for build profiles.
Allow enabling or disabling specific classes (which will not be built).

(cherry picked from commit 1186c488bd)
2024-07-17 09:06:07 -05:00
A Thousand Ships c5204a2e84 Add default argument processing for `NodePath`
(cherry picked from commit 37e7a6da05)
2024-06-14 12:44:10 -05:00
A Thousand Ships a6e5caacf8 Fix generating default values for `StringName`
Cases other than `&""` were not processed correctly

(cherry picked from commit 6cd6c8923a)
2024-06-14 12:44:10 -05:00
David Snopek 246fd4718c Fix vararg methods forwarded to the `ClassDB` singleton
(cherry picked from commit e04a26b2bc)
2024-06-14 12:44:10 -05:00
David Snopek 18354f9b9b Clean up instance bindings for engine singletons to prevent crash
(cherry picked from commit 88df025aa0)
2024-05-17 16:40:13 -05:00
David Snopek acee69a3f6 Allow forwarding from `ClassDB` to `ClassDBSingleton` to support enumerations
(cherry picked from commit e1b3b32db5)
2024-05-17 16:35:22 -05:00
Thaddeus Crews 7473b984cb Enforce template syntax `typename` over `class`
(cherry picked from commit 87f5fb0691)
2024-04-08 11:49:37 -05:00
David Snopek 98ad839827 Avoid creating most objects that Godot is going to use placement new to initialize
(cherry picked from commit c4fde852e6)
2024-04-08 11:45:25 -05:00
bruvzg a07b1f6e07 [Packed*Array] Add support for initializer lists.
(cherry picked from commit 8c98a90f32)
2024-04-08 11:44:28 -05:00
DaylilyZeleen dc19986497 Fix object return value of builtin types' methods.
(cherry picked from commit 6a3753c076)
2024-03-11 12:46:39 -05:00
bruvzg c2d4ccd592 Switch to 64-bit ints.
(cherry picked from commit 59a5a8b104)
2024-03-11 12:46:27 -05:00
Daylily-Zeleen 3129672a4f Remove "godot" namespace when binding global constants.
(cherry picked from commit bd40a94424)
2024-01-22 15:29:36 -06:00
A Thousand Ships c0b2d85ffc Add missing `OP_POWER` operator to `Variant`
(cherry picked from commit f037a697eb)
2024-01-22 15:29:27 -06:00
Mikael Hermansson 943d1c8cdf Change bit field enums to use `uint64_t` as underlying type 2023-11-28 01:03:41 +01:00
Rémi Verschelde 4fed88afcf
Merge pull request #1307 from LAK132/master
Fix file list issues when trying to build with meson via cmake
2023-11-24 12:35:29 +01:00
LAK132 39c139c814 Fix file list issues when trying to build with meson via cmake 2023-11-11 23:29:33 +10:30
David Snopek d33bd47219 Add `CallableCustom` that devs can use in their GDExtensions 2023-11-06 00:09:06 -06:00
David Snopek 64eac01d04
Merge pull request #1266 from dsnopek/automatic-engine-class-registration
Automatically register only engine classes whose header has been included
2023-10-16 10:47:06 -05:00
David Snopek b507b3e591 Automatically register only engine classes whose header has been included 2023-10-16 10:19:11 -05:00
David Snopek 3d814f9e4a Use the new `string_name_new_with_latin1_chars` function to improve StringName construction performance 2023-10-09 16:59:29 -05:00
David Snopek b1fd1b65fd
Merge pull request #1242 from AThousandShips/null_check
Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
2023-09-20 07:32:14 -05:00
David Snopek 0d6de7a80e
Merge pull request #1164 from dsnopek/classdb-singleton-alternate
Add static methods to `ClassDB` for the methods bound to the `ClassDB` singleton
2023-09-19 10:33:15 -05:00
A Thousand Ships 1e5767693e Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-13 14:34:04 +02:00
David Snopek 5cdc2fc099
Merge pull request #1214 from dsnopek/ptrtoarg-native-struct
Ensure that PtrToArg specializations for native structs are used
2023-09-08 10:12:23 -05:00
David Snopek 8990d5a40e
Merge pull request #1091 from Daylily-Zeleen/daylily-zeleen/implement_builtin_classes_vararg_methods
Implement vararg methods of builtin classes.
2023-09-02 08:04:29 -05:00
David Snopek 3cd3f24150 Ensure that PtrToArg specializations for native structs are used 2023-08-15 17:54:11 -05:00
David Snopek 5eebc6b20c
Merge pull request #1193 from Zylann/version_header
Added generated version header
2023-08-11 10:33:49 -05:00
David Snopek 6f913563d8 Add static methods to `ClassDB` for the methods bound to the `ClassDB` singleton 2023-07-31 16:04:27 -05:00
David Snopek 8bc1c1dbeb Implement `String::resize()` 2023-07-31 15:14:10 -05:00
Marc Gilleron c6b2c82570 Added generated version header 2023-07-26 23:23:56 +01:00
Marc Gilleron 548c758677 Don't cache `null` forever if a singleton isn't available yet
# Conflicts:
#	binding_generator.py
2023-07-22 16:31:28 +01:00
David Snopek efc16b49d9 In generated methods, only construct the method StringName the first time 2023-07-13 13:05:41 -05:00
Daylily-Zeleen 3536803e9e Implement vararg methods of builtin classes. 2023-07-03 17:30:42 +08:00
Rémi Verschelde 130644c061
Merge pull request #1138 from dsnopek/editor-plugins-deinitialize
Automatically remove editor plugins when deinitializing GDExtension
2023-06-19 10:43:34 +02:00
Rémi Verschelde ca78bcf558
Merge pull request #1086 from lucasrafael98/fixes/missing-include-audio-frame
Fix: Include method_ptrcall.hpp on simple structs.
2023-06-19 10:43:10 +02:00
Rémi Verschelde f56f45156b
Merge pull request #1143 from bruvzg/py_utf8
Force UTF-8 encoding in the binding generator script.
2023-06-16 10:30:08 +02:00
bruvzg f1ad719ffc Force UTF-8 encoding in the binding generator script. 2023-06-16 10:41:23 +03:00
Andy Maloney db2394dbe7 Identifiers containing double underscore are reserved according to the C++ standard
Rename __* to _gde_*

https://timsong-cpp.github.io/cppwp/n3337/global.names

https://en.cppreference.com/w/cpp/language/identifiers

Identifiers appearing as a token or preprocessing token (i.e., not in user-defined-string-literal like operator ""id) (since C++11) of one of the following forms are reserved:
 - identifiers with a double underscore anywhere;
 - identifiers that begin with an underscore followed by an uppercase letter;
 - in the global namespace, identifiers that begin with an underscore.
2023-06-15 20:45:01 -04:00
David Snopek d28a3cbbd5 Automatically remove editor plugins when deinitializing GDExtension 2023-06-13 14:24:33 -05:00
Rémi Verschelde d12cf071bb
Merge pull request #1128 from Mathis-Z/master
Fixing #1127 by making return types of auto-generated functions dynamic
2023-06-08 22:31:51 +02:00
Mathis-Z ac98dd2752 Fixing #1127 by making return types of auto-generated functions dynamic 2023-06-08 20:35:29 +02:00
David Snopek ad726015e7 Revert the changes from PR #1044 and #1045 and standardize on `Object **` encoding in ptrcall 2023-06-07 08:30:33 -05:00
Rémi Verschelde 2078c00bab
Merge pull request #1114 from dsnopek/editor-plugins
Add support for adding/removing editor plugins
2023-05-26 11:04:35 +02:00