Commit Graph

61 Commits

Author SHA1 Message Date
David Snopek
971e154588 GDExtension: Allow directly getting ObjectID from Variant 2024-09-17 11:58:55 -05:00
Rémi Verschelde
f8fbb860f5
Merge pull request #95840 from raulsntos/char_metadata
Add metadata for `char16_t` and `char32_t`
2024-09-12 09:25:19 +02:00
Raul Santos
aaffab8afb
Add metadata for char16_t and char32_t
We don't seem to expose any API that uses `char16_t` yet, but I added it anyway since we make the type info for it.

I didn't add anything for `wchar_t` because we are not making a type info so maybe we don't have a need for it yet, it could be added in the future.

To prevent breaking compatibility with the C# bindings, we ignore the `char32_t` metadata and still use `System.Int64`.
2024-09-12 02:15:55 +02:00
Raul Santos
9e57674550
Remove get_rid_func from GDExtensionClassCreationInfo4 2024-09-10 12:35:24 +02:00
Thaddeus Crews
9853a69144
Implement typed dictionaries 2024-09-04 10:27:26 -05:00
Jan Haller
82b2a58f4c Fix bool type appearing in GDExtension header 2024-08-31 22:40:48 +02:00
Daylily-Zeleen
3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +08:00
Jan Haller
b2a9ea6d22 GDExtension docs: advise bindings to use uint64_t for bitfields 2024-07-15 22:37:33 +02:00
bruvzg
e651421905
[TextServer, GDExtension] Fix building text servers as GDExtension, expose new/changed low-level methods to GDExtension API. 2024-06-12 19:30:19 +03:00
Rémi Verschelde
4b070e8031
Fix various typos with codespell
Using 2.2.7.dev217+g10c2abcf.

Had to add `colour` to the ignore list as we used it as an alias/keyword for the
documentation of color-related APIs.
Also ignore recommendations to change `thirdparty` to either `third-party` or
`third party`, which are correct but we use the former fairly consistently.
2024-05-07 10:08:42 +02:00
K. S. Ernest (iFire) Lee
f9b488508c
Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +02:00
Jan Haller
27a637d287 GDExtension: provide free_property_list_func with length of array 2024-04-27 14:13:17 +02:00
A Thousand Ships
0c19d0f5a0
Add extension support for argument count to ScriptInstance 2024-03-13 22:40:09 +01:00
A Thousand Ships
59bcc2888c
Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +01:00
David Snopek
0badf07657 GDExtension: Pass count when freeing method and property lists for script instances 2024-03-02 10:13:37 -06:00
David Snopek
ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 -06:00
David Snopek
be11002e41 Allow GDExtensions to register virtual methods and call them on scripts 2024-02-12 13:29:18 -06:00
Riteo
f468e59efd GDExtension: add an interface for loading extra documentation
Adds two new GDExtension interface methods:
 - `editor_help_load_xml_from_utf8_chars`
 - `editor_help_load_xml_from_utf8_chars_and_len`

Both of these methods parse the XML passed into an extra documentation
container which, when needed, is merged into the main doc container.

Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
2024-01-26 13:53:33 +01:00
David Snopek
b0a33cac7c GDExtension: Use ObjectID when creating custom callable 2023-10-23 09:05:17 -05:00
Emmanuel Leblond
5aa9f1ce64
Fix comment in gdextension_interface.h 2023-10-16 21:40:45 +02:00
Ced Naru
0a246e9b54 expose Object::free_instance_binding to GDExtension 2023-10-04 19:24:37 +02:00
David Snopek
cbf939e121 GDExtension: Don't deprecate old method of getting script category 2023-10-02 09:23:27 -05:00
David Cambré
531f56e830 add GDExtensionScriptInstanceGetClassCategory
Change GetClassCategory so it is handled in native directly
2023-09-27 17:45:48 +02:00
David Snopek
2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 -05:00
Jan Haller
c770937db5 More precise documentation for GDExtension String constructors (bytes vs. character count) 2023-09-24 20:57:58 +02:00
Jan Haller
ed3015e979 GDExtension: construct StringName directly from char*
So far, an indirection via String was necessary, causing at least 2 allocations and copies (String; String inside StringName).
Since StringNames often refer to string literals, this allows them to be directly constructed from C strings.

There are two formats: Latin-1 and UTF-8.

The Latin-1 constructor also provides the `p_is_static` flag: when the source has static storage duration, no copy/allocation will be needed.
However, the extension developer needs to uphold this lifetime guarantee.
2023-09-24 18:18:05 +02:00
Jeff Ward
60851af4da Add functions for non-ptr style virtual calls in GDExtension
This adds two functions to `GDExtensionClassCreationInfo` that allow for developers to supply a generic virtual call function along with user data to be sent to that call.

If `get_virutal_call_data_func` is not null, extensions call this function to get user data to pass to a supplied `call_virtual_with_data_func`. Both must be provided is one is provided.

If `get_virtual_call_data_func` is null, Godot falls back to the old `get_virtual_func` logic.

Fixes #63275

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-09-19 22:33:32 -04:00
Rémi Verschelde
8dfc3f1864
Merge pull request #79005 from maiself/gde-custom-callable
Allow CallableCustom objects to be created from GDExtensions (extended)
2023-09-19 09:02: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
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
Jan Haller
4e202bcec7 GDExtension: fix bool unknown in C 2023-09-02 21:04:49 +02:00
Mai Lavelle
e0ee985f64 Allow CallableCustom objects to be created from GDExtensions
Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-31 12:36:25 -04: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
Mai Lavelle
4b5da7e0ac Expose PlaceHolderScriptInstance to GDExtension
Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-28 17:43:45 -04: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
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
David Snopek
c6b0d4aae3 Add GDExtension function to get Object class name 2023-05-22 06:58:59 -05: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
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
Jan Haller
45e6abde1d GDExtension: array_set_typed() accepts enum instead of uint32_t 2023-02-08 23:24:56 +01:00