Commit Graph

137 Commits

Author SHA1 Message Date
Yuri Sizov
18b81efbf3 Fix argument metadata when binding methods
While there doesn't seem to be any runtime issues,
this triggers the address sanitizer in a few ways,
depending on what kind of method you're
binding.

(cherry picked from commit 2b34bd0d8b)
2024-07-17 09:57:10 -05:00
David Snopek
8269c0102a Explicitly refer to godot namespace in GDREGISTER_*_CLASS() macros
(cherry picked from commit 246a803954)
2024-06-14 10:31:04 -05:00
David Snopek
6328728dc2 Allow forwarding from ClassDB to ClassDBSingleton to support enumerations
(cherry picked from commit e1b3b32db5)
2024-05-17 16:57:33 -05:00
David Snopek
6123c86f06 Correctly handle Object * arguments that were encoded as nullptr
(cherry picked from commit 37542dc2ec)
2024-05-17 16:56:37 -05:00
David Snopek
fff665e0f5 Give compile-time error if registering a class without its own _bind_methods() function
(cherry picked from commit ca46ef4d25)
2024-05-17 16:55:41 -05:00
pupil1337
82ea3f74a4 Add static_assert() for register_class
(cherry picked from commit 1fa7a9cb19)
2024-05-17 16:54:44 -05:00
A Thousand Ships
11cd9a0727 [Math] Add is_finite methods
(cherry picked from commit d389171905)
2024-05-17 16:54:00 -05:00
Chris Cranford
a75e33c333 Implement to/from dict helpers for PropertyInfo/MethodInfo
(cherry picked from commit 2a041b5240)
2024-05-17 16:53:43 -05:00
David Snopek
d24983d682 Backport miscellaneous changes that can't be cherry-picked
(cherry picked from commit 9afbdb9cf6)
2024-05-17 16:51:42 -05:00
Chris Cranford
30ebe5fdf9 Fix PropertyInfo to use hint/usage default constants
(cherry picked from commit e160966163)
2024-04-17 11:01:33 -05:00
A Thousand Ships
c8fa4c0fd0 Fix incorrect utility call signature
(cherry picked from commit d055b575fb)
2024-04-08 11:40:05 -05:00
Thaddeus Crews
9e48c45bfc Enforce template syntax typename over class
(cherry picked from commit 87f5fb0691)
2024-04-08 11:39:21 -05:00
A Thousand Ships
07e245e3e4 Fix invalid void return in BitField
(cherry picked from commit 7ed8ef7221)
2024-03-11 13:33:57 -05:00
Marc Gilleron
ed576f8318 Fix explicit namespaces in macros
(cherry picked from commit e607790647)
2024-03-11 13:33:44 -05:00
bruvzg
08da55cd0b [Core] Improve CowData and Memory metadata alignment.
(cherry picked from commit b173a4d935)
2024-03-11 13:11:26 -05:00
DaylilyZeleen
1ac8627b2e Fix object return value of builtin types' methods.
(cherry picked from commit 6a3753c076)
2024-03-11 12:59:32 -05:00
David Snopek
9d813310bb Add protections against registering classes that didn't use GDCLASS()
(cherry picked from commit a61cdc8860)
2023-10-23 10:11:04 -05:00
David Snopek
f7ffc4fe4d Automatically register only engine classes whose header has been included
(cherry picked from commit b507b3e591)
2023-10-22 14:46:26 -05:00
A Thousand Ships
205beacc5b Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable
(cherry picked from commit 1e5767693e)
2023-10-09 08:42:16 -05:00
David Snopek
bc82ae8b0b Add static methods to ClassDB for the methods bound to the ClassDB singleton
(cherry picked from commit 6f913563d8)
2023-09-19 21:30:03 -05:00
David Snopek
dcd7a69512 Ensure that PtrToArg specializations for native structs are used
(cherry picked from commit 3cd3f24150)
2023-09-19 21:22:54 -05:00
Kehom
20be441026 Unregister custom classes in reverse registration order 2023-06-19 11:04:11 -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
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
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
Rémi Verschelde
e9942db502 Merge pull request #1044 from zhehangd/fix_obj_ptr_crash
Fix crash using Object* as parameter
2023-04-01 11:36:17 +02:00
Zhehang Ding
093f0673f5 Fix PtrToArg<Object*> crash 2023-03-30 19:38:12 -07:00
bruvzg
ba4b50118d Fix incorrect memory allocation in release builds.
Co-authored-by: lightyears <lightyears1998@hotmail.com>
2023-02-21 15:32:26 +02:00
David Snopek
964c515d75 Revert "Fix Object::cast_to<T>() for custom classes"
This reverts commit 75af9003dc.
2023-02-16 06:58:32 -06:00
David Snopek
75af9003dc Fix Object::cast_to<T>() for custom classes 2023-02-11 17:16:59 -06:00
Rémi Verschelde
fccceb8736 Merge pull request #1011 from mihe/error-macros
Update error macros to match core
2023-02-07 13:47:51 +01:00
Rémi Verschelde
c1d4fb2b68 Merge pull request #1023 from mashumafi/fix-alloc-order
Move DefaultTypedAllocator after memdelete
2023-01-30 12:32:07 +01:00
Rémi Verschelde
2ef10f9754 Merge pull request #956 from DmitriySalnikov/enum_bitfield_cast
Fixed `VARIANT_ENUM/BITFIELD_CAST` to show the correct names
2023-01-30 12:07:15 +01:00
mashumafi
a8be6aa8dd Move allocator to after memdelete 2023-01-29 23:29:31 -05:00
George Marques
64be8c1507 Use std type traits instead of intrinsics
This removes warnings and mimics what has been done in Godot itself.
2023-01-28 13:59:34 -03:00
Mikael Hermansson
d174b47e51 Update error macros to match core 2023-01-22 14:24:57 +01:00
Rémi Verschelde
00b29630ba Merge pull request #1003 from akien-mga/fix-sign-0
Change behavior of Math::sign to match Godot builtin
2023-01-20 23:02:13 +01:00
Дмитрий Сальников
6528c7177f Fixed variant casting for enum and bitfield 2023-01-20 21:10:03 +03:00
Andy Maloney
e6b636cc51 Fix sign comparison warnings in method_bind.hpp
Part of #999
2023-01-19 08:26:02 -05:00
bruvzg
abca497b72 Expose some low level functions and String operators. 2023-01-19 13:12:21 +02:00
Erik Abair
d3f17c1dca Change behavior of Math::sign to match Godot builtin
Fixes #551.
2023-01-19 09:47:13 +01: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
Fabio Alessandrelli
9fd33b5cde Allow method binds to take Object subclasses as arguments
As done in upstream Godot via GH-57205.

Add a test that ensures it works also for "gdextended" objects.
2023-01-10 12:55:41 +01:00
Jan Haller
fce753c05d Extension header: amend const correctness of p_args parameters 2022-12-14 15:47:42 +01:00
Rémi Verschelde
bab247dcb6 Rename godot-headers to gdextension, move header to top folder
Changes the `<godot/gdextension_interface.h>` include to simply
`<gdextension_interface.h>`.

Refactor and better document the SCons and CMake logic around setting
the paths to the header and API JSON file.
2022-12-14 12:36:59 +01:00
Дмитрий Сальников
b7eeddcf52 Use int64_t for BitField as in Godot itself 2022-12-13 13:36:16 +03: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
fe79449969 Fix cast on PtrToArg::convert 2022-12-05 03:30:50 +01:00