Commit Graph

65 Commits (505076c9a97adb72386ce352610048ea93040167)

Author SHA1 Message Date
David Snopek ca46ef4d25 Give compile-time error if registering a class without its own `_bind_methods()` function 2024-04-24 14:49:26 -05:00
Thaddeus Crews 87f5fb0691
Enforce template syntax `typename` over `class` 2024-03-10 16:02:43 -05:00
David Snopek 23c010900c Fix _notification with parent and child classes 2024-02-22 14:39:50 -06:00
David Snopek 8fbb7cf795 Allow GDExtensions to register virtual methods and call them on scripts 2024-02-12 13:30:07 -06:00
Chris Cranford 5f350e2572 Rework GDCLASS macro to allow pure virtual functions 2024-01-18 20:14:13 -05:00
bruvzg 29b34d92bb
[iOS] Fix building as static library or xcframework, add iOS config and xcframework build script to the test project. 2023-11-09 20:01:59 +02:00
Thaddeus Crews 6eb5d450bd
GDCLASS synced by ending with "private:"
• Matches implementation used by modules and godot itself
• Apply same to GDEXTENSION_CLASS, setup with same diff-friendly spacers as GDCLASS
2023-11-01 12:44:14 -05:00
David Snopek a61cdc8860 Add protections against registering classes that didn't use GDCLASS() 2023-10-22 08:44:09 -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 df849651d9 Changes necessary for hot reload to work 2023-09-25 22:13:33 -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 aa6867e6c9 Support `_validate_property()` 2023-09-12 13:21:16 -05:00
A Thousand Ships f651df5e7a Ensure `const` correctness for wrappers 2023-09-06 19:33:03 +02:00
Jan Haller 54092861f1 GDExtension: fix `bool` unknown in C 2023-09-02 13:19:14 +02:00
Markus Sauermann c2d99fd519 Fix `Object::notification` order
For the notification-order to work correctly, it is necessary to
allow the `p_reversed` argument to be used within cpp.
This PR changes the necessary bindings.
2023-08-30 00:07:28 +02: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
Marc Gilleron baf0b9e0f7 Don't call parent _get_property_list when a class doesn't define it.
Godot is already supposed to call _get_property_list of parent classes,
so this binding function must really only return procedural properties of
the class it belongs to, and not parent or child classes.
2023-07-26 20:12:25 +01: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 ad726015e7 Revert the changes from PR #1044 and #1045 and standardize on `Object **` encoding in ptrcall 2023-06-07 08:30:33 -05:00
David Snopek 0d0d5a670b
Merge pull request #1116 from saki7/Ref-allow-non-const-access
Change Ref<T> to allow non const access to ptr
2023-05-24 21:17:25 -05:00
Nana Sakisaka 48635729b9 Change Ref<T> to allow non const access to ptr 2023-05-17 19:24:09 +09:00
David Snopek 431e30bc32 Ensure GDExtension class is the correct type for the Godot engine class 2023-05-16 15:18:48 -05:00
David Snopek a5c6ca5920 Update to load function pointers for GDExtension interface 2023-05-09 21:45:48 -05:00
Zhehang Ding 517db6686a Fix PtrToArg<Ref<T>> crash 2023-02-15 22:36:29 -08:00
Rémi Verschelde 04731d2b78
Merge pull request #965 from WildRackoon/fix-GDCLASS-fwddeclaration
Fix GDCLASS needs explicit ClassDB fwd declaration
2023-01-19 13:55:14 +01:00
Andy Maloney 5dd2928790 "Wrapped" has virtual functions so it should have a virtual destructor.
Deleting an object through a pointer to a base class is undefined behaviour unless the destructor in the base class is virtual.
2023-01-19 05:57:17 -05:00
Дмитрий Сальников 0c6e26dabe Added property info for ptr and ref + ported the implementation of the `check` method 2023-01-13 15:56:51 +03:00
Rémi Verschelde 931f1a3f34
Sync license copyright with upstream GH-70885 2023-01-10 16:15:31 +01:00
Rackoon 72d537fd95 Fix GDCLASS needs explicit ClassDB fwd declaration 2022-12-16 13:49:10 +01:00
Bastiaan Olij 992d85e6f8 Fix virtual GDExtension method Ref<T> conversion 2022-12-13 10:41:55 +11:00
Gilles Roudière c02e644679 Rename GDNative to GDExtension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension -> Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION -> EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:06:38 +01:00
Emmanuel Leblond fe86a94dcf
Fix const qualifier for parameters in GDExtension api functions 2022-12-03 00:27:07 +01:00
Emmanuel Leblond fa405a8337
Fix lifetime of StringName objects returned by Wrapped::_get_property_list 2022-11-29 18:23:56 +01:00
Andy Maloney c7e34c2f9d Basic static analysis fixes
- remove extraneous semicolons
- use "nullptr" instead of "0"
- remove "break" after "return"
- use <cstdio> instead of <stdio.h>
2022-11-18 17:46:13 -05:00
Emmanuel Leblond 2745d341aa
Fix broken namespace isolation in GDCLASS macro 2022-11-11 16:45:42 +01:00
Emmanuel Leblond b6ba0dca13
StringName is working fine with demo \o/ 2022-11-08 21:44:33 +01:00
Emmanuel Leblond 3b82d5937b
Correct GDNativeExtensionScriptInstanceToString 2022-11-08 21:44:32 +01:00
Emmanuel Leblond a706a9ceb9
Remove now useless `_alloc_and_copy_cstr` 2022-11-08 21:44:31 +01:00
Emmanuel Leblond e24b6b0e51
Use StringName in the whole GDExtension API instead of const char * 2022-11-08 21:44:31 +01:00
Emmanuel Leblond 0e81f89dd3
Uses `StringName` in GDExtension perf critical instance creation & method/properties setter/getter 2022-11-08 21:44:30 +01:00
Emmanuel Leblond b21931c4a3
Type `GDNativePropertyInfo.type` field as `GDNativeVariantType` 2022-10-13 14:04:54 +02:00
Aaron Franke 592bd15c7a
Run scripts to format and make headers consistent 2022-10-09 01:47:07 -05:00
Marc Gilleron 5de2c059d1 Fix deriving a custom class with virtual methods 2022-09-21 19:31:30 +01:00
Rémi Verschelde 3276688c82
Merge pull request #844 from Zylann/fix_get_const
Fix issues with `_get` and `_get_property_list`
2022-09-16 08:48:00 +02:00
Marc Gilleron 6f3bdab090 Fix issues with `_get` and `_get_property_list`
`_get` was using `_set` internally, and should be `const`.
`_get_property_list` should be `const`.
2022-09-15 23:46:50 +01:00
bruvzg 36273baa7e
Change PropertyInfo members to String. 2022-09-14 08:41:09 +03:00
Fabio Alessandrelli bcf27d8af4 Ensure GDCLASS can be used outside the godot namespace.
The `GDCLASS` macro should not assume to be called inside the `godot`
namespace and should thus prefix function calls for that namespace with
`::godot::` to ensure proper namespace referencing.
2022-09-01 04:11:23 +02:00
bruvzg 270ad28931
Add support for `_notification`, `_set`, `_get`, `_get_property_list`, `_property_can_revert`, `_property_get_revert`, and `_to_string` methods. 2022-08-22 12:59:38 +03:00