Commit graph

172 commits

Author SHA1 Message Date
A Thousand Ships
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
Rémi Verschelde
43c7e8d3b5
Merge pull request #81515 from dsnopek/gdextension-validate-property-object
Allow implementing `Object::_validate_property()` from GDExtension
2023-09-11 15:40:05 +02:00
Rémi Verschelde
786dab42fd
Merge pull request #70329 from Daylily-Zeleen/daylily-zeleen/register_internal_class
Allow GDExtension to register unexposed classes.
2023-09-11 15:35:31 +02:00
David Snopek
abef8e3874 Allow implementing Object::_validate_property() from GDExtension 2023-09-10 11:17:59 -05:00
Rémi Verschelde
d1c94eef06
Merge pull request #81261 from dsnopek/gdextension-validate-property
Allow implementing `ScriptInstance::validate_property()` from GDExtension
2023-09-07 13:51:44 +02:00
David Snopek
3e7a6e058a Allow implementing ScriptInstance::validate_property() from GDExtension 2023-09-04 13:55:48 -05:00
Daylily-Zeleen
41ffe5461f Allow GDExtension to register unexposed class. 2023-09-04 10:18:20 +08:00
Fredia Huya-Kouadio
8cc7739197 Godot Android plugin re-architecture 2023-09-03 17:04:10 -07:00
Jan Haller
4e202bcec7 GDExtension: fix bool unknown in C 2023-09-02 21:04:49 +02:00
David Snopek
83faf84ec9 GDExtension: Allocate GDExtensionScriptInstanceInfo2 for compatibility on the heap to prevent crash 2023-08-31 15:19:31 -05:00
Rémi Verschelde
8edc0b43b9
Merge pull request #78634 from Sauermann/fix-notification-order
Fix `Object::notification` order
2023-08-30 08:44:36 +02:00
Markus Sauermann
c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +02:00
David Snopek
39a604c9ab Exclude unexposed classes from the extension_api.json 2023-08-29 08:45:58 -05:00
Mai Lavelle
4b5da7e0ac Expose PlaceHolderScriptInstance to GDExtension
Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-28 17:43:45 -04:00
David Snopek
908b8c0507 GDExtension: Remove DLL copy if it fails to load 2023-08-17 13:23:31 -05:00
Rémi Verschelde
1e3b1a7137
Merge pull request #80188 from vnen/gdextension-copy-dll
GDExtension: Copy DLL to a temp file before opening
2023-08-16 16:55:19 +02:00
Ninni Pipping
97ef4a0536 Fix version check for GDExtension 2023-08-15 10:10:04 +02:00
George Marques
cff69b0612
GDExtension: Copy DLL to a temp file before opening
This is done only in the editor and only on Windows, to avoid a file
lock that prevents the original library being updated (e.g. by a
compiler).

When the game runs it will load the original DLL and pick up any
changes, only the editor will stay with the copy (until it is restarted
and create a new copy).

The copy is done in place by prepending a `~` to the original file name,
so dependencies that are loaded with a relative file path still work.
When the library is unloaded the copy file is deleted. The copy is also
marked as hidden to not show up in explorer.
2023-08-11 10:44:23 -03:00
Jeff Ward
efc8fd6e2c Add get_script_instance to GDExtension
Adds a method to GDExtension to get the ScriptInstanceExtension for an object.
2023-08-07 23:09:24 -04:00
Yuri Sizov
6bfda7f5c5 Merge pull request #79156 from dsnopek/gdextension-string-resize
Allow resizing Strings from GDExtension
2023-07-27 15:22:32 +02:00
David Snopek
e87900970c Allow resizing String's from GDExtension 2023-07-26 21:31:37 -05:00
Mikael Hermansson
2173821b38 Add support for indexed properties in GDExtension 2023-07-21 22:59:24 +02:00
Jan Haller
9ddd3c2af6 GDExtension @since attribute
All GDExtension function pointer types are versioned using a `@since` attribute, denoting the Godot minor version in
which they were introduced. This allows bindings to query if a feature is available for a target API version, or provide
a polyfill/fallback for it. It also serves as documentation for humans giving a feeling about recency of features.
2023-06-21 12:47:48 +02:00
Jan Haller
618507eb89 GDExtension: Uninitialized*Ptr for constructors/converters using placement new
These methods construct their destination in-place, but the parameters are not declared using the `Uninitialized*Ptr` pointer types.
2023-06-18 23:14:10 +02:00
David Snopek
ef9cb793d3 Remove GDExtension compatibility code for Godot 4.0 2023-06-07 13:01:42 -05:00
Yuri Sizov
a12327e277
Merge pull request #77445 from RedworkDE/gdextension-compat-update-validation
Update extension API validation
2023-05-27 17:23:26 +02:00
Rémi Verschelde
699b66b62d
Merge pull request #77010 from dsnopek/gdextension-editor-plugins
Allow GDExtensions to add editor plugins
2023-05-26 11:00:32 +02:00
David Snopek
3007163210 Allow GDExtensions to add editor plugins 2023-05-25 09:14:29 -05:00
RedworkDE
bbe04e1ec8 Update extension api validation
- Ensure that multiple changes to one method cannot hide each other in the CI.
- Check virtual methods for changes.
- Compare the detailed changes to a method.
- Compare enums.
- Fix comparing global enums.
- Use `vformat` to build error messages.
2023-05-24 18:51:33 +02:00
Rémi Verschelde
80bf8fd186
Merge pull request #73511 from dsnopek/gdextension-object-name
Add GDExtension function to get Object class name
2023-05-22 14:02:59 +02:00
David Snopek
c6b0d4aae3 Add GDExtension function to get Object class name 2023-05-22 06:58:59 -05:00
RedworkDE
402b3d146a Bind forgotten default value for GDExtension::open_library argument 2023-05-22 00:14:55 +02:00
RedworkDE
110bc5058d Compress embedded GDExtension interface 2023-05-16 22:16:45 +02:00
David Snopek
9b9482d4bb Rework GDExtension interface from a struct to loading function pointers 2023-05-16 10:27:46 -05:00
Emmanuel Leblond
e785dd9dd9
Improve user-friendliness of "return value as function param" pattern in GDExtension API
This commit introduce separate types (e.g. GDNativeStringPtr vs GDNativeUninitializedStringPtr)
depending on if the pointed data is already initialized (C++ style where constructor is alway
called when create a variable even if it is to be passed as return value) or not (C style).
On top of that, small changes has been made to `GDNativeInterface` so that it methods are
consistent on using uninitialized return value.
2023-05-15 17:14:57 +02:00
Rémi Verschelde
70dcfdab1f
Merge pull request #76446 from reduz/add-gdextension-api-compatibility
Add a backwards-compatibility system for GDExtension
2023-05-15 13:43:46 +02:00
Juan Linietsky
d8078d3f4c Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.

```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```

**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.

**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.

**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-05-15 12:05:40 +02:00
Emmanuel Leblond
7501ebb91a
Make *_operator_index in gdnative_interface not logging an error if called with an out-of-bound index 2023-05-13 20:01:55 +02:00
Juan Linietsky
1c93606e47 Add ValidatedCall to MethodBind
* This should optimize GDScript function calling _enormously_.
* It also should simplify the GDScript VM considerably.

NOTE: GDExtension calling performance has most likely been affected until going via ptrcall is fixed.
2023-04-30 20:01:26 +02:00
Yuri Sizov
ee2cc347c6 Add support for icons in GDExtension classes
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-03-31 21:39:02 +02:00
Haoyu Qiu
49400e0c1c Fix crash when dumping extension API in a non-writable directory 2023-03-08 15:05:44 +08:00
Jan Haller
45e6abde1d GDExtension: array_set_typed() accepts enum instead of uint32_t 2023-02-08 23:24:56 +01:00
Haoyu Qiu
d8d5cb1198 Use GDExtensionBool in GDExtension interface 2023-02-08 14:57:07 +08:00
Mikael Hermansson
99dba702f5
Expose _err_print_error with message parameter to GDExtension 2023-02-07 14:02:18 +01:00
Haoyu Qiu
f4ffa87a35 Remove unnecessary stdio.h from gdextension interface 2023-02-06 16:11:50 +08:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
bruvzg
5aa87ccc03
Move Array:set_typed to internal GDExtension structure and unexposed it. 2023-01-30 14:23:31 +02:00
Raul Santos
cac7a784d6
Add GodotTypeInfo::Metadata to MethodInfo 2023-01-26 15:51:34 +01:00
Jan Haller
b8c4ae28b7 Fix use of bool in extension header 2023-01-19 22:21:19 +01:00
bruvzg
db7d8c2d87
[GDExtension] Expose some low level functions and String operators. 2023-01-19 12:50:49 +02:00