Commit Graph

297 Commits (e24b6b0e517bbebe4ed98d9736c0c7219c418b99)

Author SHA1 Message Date
bruvzg 713b122b84
Add support for BitField hint, sync API files. 2022-07-11 15:00:17 +03:00
Alessandro Famà d894f48f25 Fix crash when using static methods without return value 2022-07-03 17:00:43 +02:00
Fabio Alessandrelli 5bbcd42378 Fix GDN_EXPORT define with mingw.
This commit changes the platform detection order to detect mingw
compiling for windows (which defines `__GNUC__`).

This commit also wraps the definition around a guard so it can be
overridden via a define at build-time.
2022-06-18 14:38:18 +02:00
bruvzg e3119e7d05
Sync containers with new HashMap/HashSet, sync API headers. 2022-06-06 12:18:07 +03:00
Teodor Potancok 5c32dc3948 Cast `Variant::Type` to `GDNativeVariantType` 2022-05-17 07:01:43 +02:00
bruvzg 031a83b0ea
[Method Bind] Add support for default argument values and static method binding. Sync headers. 2022-05-06 10:17:51 +03:00
bruvzg e06d5cd414
Add double precision build support. 2022-05-04 15:56:35 +03:00
bruvzg 8bf5a532de
Change registered initializers / terminators to the single function with level argument. 2022-05-04 11:14:51 +03:00
Rémi Verschelde 24f5cd2d48 Color: Rename to_srgb/to_linear to include base color space
Counterpart to https://github.com/godotengine/godot/pull/60199.
Also syncs the extension API with that PR.
2022-04-13 12:50:21 +02:00
bruvzg 057a771fda
Add support for variadic method binds with the typed return. Sync headers. 2022-03-30 15:11:28 +03:00
bruvzg 93de1b2b0b
Sync godot-headers and fix build after "Create GDExtension clases for PhysicsServer3D". 2022-03-16 20:33:06 +02:00
bruvzg 817efdd484
Fix build after "Discern between VIRTUAL and ABSTRACT class bindings". 2022-03-15 13:43:12 +02:00
Rémi Verschelde 1632322ce0 Update copyright year 2022-03-15 10:17:53 +01:00
bruvzg b1385953fe
Add `ObjectDB::get_instance` method to get wrapped `Object *` from `ObjectID`. 2022-03-08 10:17:33 +02:00
Melissa Geels d97dc518d3 Fixed crash on release builds due to missing argument type information 2022-03-02 14:44:23 +01:00
Gilles Roudière a94148ca4c Reorder native extension initialization steps 2022-02-28 15:44:54 +01:00
Rémi Verschelde d154ffbe86
Merge pull request #708 from Zylann/fix_inheriting_class_with_namespace 2022-02-21 11:27:31 +01:00
Rémi Verschelde 76bad22978
Merge pull request #701 from bruvzg/port_templates 2022-02-21 11:25:40 +01:00
Marc Gilleron 6fdcb18f6a Fix GDCLASS when inherited class is in another namespace 2022-02-20 19:33:00 +00:00
Rémi Verschelde 7e3321d1b2 Use forward declares for vector math types
Adds operators to convert from int vector types to float vector types
as done in the upstream engine implementations.
2022-02-20 12:04:08 +01:00
Rémi Verschelde 917b0c2ca3
Merge pull request #688 from zhehangd/master 2022-02-19 16:31:32 +01:00
bruvzg e36180f377
Port a bunch of Godot container templates to GDExtension. 2022-02-18 21:07:53 +02:00
bruvzg 65dc3e89c7
Add ERR_ macros variants using `String` messages. 2022-02-17 10:18:04 +02:00
bruvzg a8cd21ac07
Fix "const" NativePtr binds. 2022-02-16 11:35:13 +02:00
bruvzg bf8fc4c53d
Add `ptr()` / `ptrw()` to the arrays, add missing `String` methods, add missing `CharString` method implementations. 2022-02-14 23:17:21 +02:00
Zhehang Ding df0e28fe43 Add missing Vector2::operator Vector2i() 2022-02-07 01:23:18 -08:00
ondy-personal 3d237fc7d7
Fixed crash when called methods return nullptr.
The returned value "ret" may be nullptr in which case the code would crash because "object_get_instance_binding" can't be called on nullptr input.

This should be very easy to reproduce, I encountered it pretty much any time I called a method that returned Ref<Something>. E.g.:

Ref<GeometryInstance3D> instance;
instance.instantiate();
instance.get_mesh();    // Crash because no mesh was set for the instance and the returned value was nullptr.
2022-01-31 17:12:45 -08:00
Lukas Tönne 836cc4d3dc Fix for pointer indirection in the Ref<T> template.
Patch by Nana Sakisaka (saki7).
2022-01-07 09:20:05 +01:00
Rémi Verschelde cfd3fa97d1
Merge pull request #668 from groud/fix_extension_instance_set 2022-01-06 17:44:29 +01:00
Lukas Tönne 5fa9b765dc Fixed pointer indirection in the PtrToArg template for Object arguments. 2022-01-02 17:10:32 +01:00
Bradley Clemetson 76c4adb7f8
Normalized additional macros to ensure that everything works without client code needing using 2021-12-18 15:16:14 -08:00
Bradley Clemetson 37938a1761
Fix namespace to be consistent with the previous ADD functions 2021-12-12 18:23:33 -08:00
Gilles Roudière adbbf1a3a1 Fix object_set_instance being wrongly called for built-in wrapped classes 2021-12-06 15:40:19 +01:00
Gilles Roudière 3fcb8a4d1e Make extension instances create the corresponding godot object in their constructor 2021-12-03 15:37:49 +01:00
Bastiaan Olij 94efe3d410 Fixing compiler warnings around implicit type casting loosing precision 2021-11-22 21:48:20 +11:00
Bastiaan Olij 957f86c3e3 Add Array:make macro 2021-11-02 00:20:19 +11:00
Bastiaan Olij ef528d3a86 Rename interface to gdn_interface because it's a defined keyword under windows 2021-10-28 19:44:20 +11:00
Rémi Verschelde 6a720e5c7c
Merge pull request #631 from Faless/ext/ref_casting_2 2021-09-28 16:14:45 +02:00
Fabio Alessandrelli b90d0ac555 Add Ref<T> binding support.
Added PtrToArg and GetTypeInfo adapted from Godot.
2021-09-28 15:49:08 +02:00
Fabio Alessandrelli 80fdb9146f Add pointers support for virtual methods.
As introduced in godot for virtual methods.
Custom structs are not yet supported.
2021-09-27 16:13:24 +02:00
Bastiaan Olij 0e3bc393d5 Fully register class on register_class call 2021-09-27 23:08:12 +10:00
Bastiaan Olij fad6329699 Implement Ref copy constructor 2021-09-27 23:08:12 +10:00
Fabio Alessandrelli ea7324afe8 Fix encoding/decoding of null objects. 2021-09-27 23:08:12 +10:00
Fabio Alessandrelli 42dd64f22f Fix binding of function that takes Object * parameters. 2021-09-27 23:08:11 +10:00
Fabio Alessandrelli b4632e317d Fix creation (and godot-side deletion) of extended objects.
Proper initialization for godot-cpp classes with memnew.

Extension classes (i.e. the `GDCLASS` macro) behave differently from
regular wrapped classes, and requires Godot to initialize them during
object construction.

This commit update the GDCLASS macro to not create/destroy the instance
during the bindings callback, but during the extension callbacks.

When setting the object instance, the bindings instance is set to the
pointer of the extension instance so that it can later be retrieved
normally via `object_get_instance_bindings`.
2021-09-27 23:08:11 +10:00
Fabio Alessandrelli cc88df05e7 Fix PtrToArg encoding for `Object *`.
It didn't set the return value at all, changing the local value instead.
Now instead correctly sets it as a generic pointer type from `_owner`.
2021-09-27 23:08:11 +10:00
Bastiaan Olij fab017c91a Fix some clang format things 2021-09-27 23:08:11 +10:00
George Marques 38ee8bfcf7 Change constructor/destructor management of extension classes
This makes sure custom constructors are always called on extension
classes. However, note that constructors should not take any parameters,
since Godot doesn't support that. Parameters are ignore in memnew macro.

Use memnew(MyClass()) instead of memnew(MyClass) since it now needs a
value instead of a class name. This macro calls MyClass::_new() (define
in GDCLASS macro) which ultimately calls Godot to create the object,
ensuring that both the Godot and the extension instances are created.

Non Godot classes (that don't derive godot::Object) are constructed as
usual an can have parameters.

memdelete is also changed for the same reason, as it needs to destroy
the Godot object as well, and that automatically frees the bound
extension instance.
2021-09-27 23:08:11 +10:00
Bastiaan Olij e839199848 Add support for property groups 2021-09-27 23:08:11 +10:00
Bastiaan Olij 02802b1d0e Add in driver types and rejig code to make it easier to extend 2021-09-27 23:08:11 +10:00
George Marques aef0f1e248 Change initialization to allow custom level callbacks
Now it needs a callback for each level so custom logic (like loading
singletons) can be performed.
2021-09-27 23:08:10 +10:00
George Marques dfa526ce16 Fix formatting of files 2021-09-27 23:08:10 +10:00
George Marques f5858ef6c6 Fix calling of native functions that return object types 2021-09-27 23:08:10 +10:00
Bastiaan Olij 46c63af715 Re-introduce build-in type code for core types 2021-09-27 23:08:10 +10:00
Bastiaan Olij b07559882c Silence delete compile warning in memory.h/cpp on Windows 2021-09-27 23:08:09 +10:00
George Marques a0634cca3f Auto-bind virtual method overrides 2021-09-27 23:08:08 +10:00
George Marques 8bcf32a619 Fix issues with method calls 2021-09-27 23:08:08 +10:00
George Marques e4ed48976a Replace bindgins to work with extensions 2021-09-27 23:08:08 +10:00
Rémi Verschelde 4e8508ad53
Fixup style after #563 2021-09-27 12:26:32 +02:00
Rémi Verschelde 3de367920f
Merge pull request #563 from LinwoodCloud/master 2021-09-27 11:41:41 +02:00
Rémi Verschelde 055f3141f8
Merge pull request #588 from aaronfranke/signal-no-arg 2021-09-27 11:34:08 +02:00
Rémi Verschelde 7a693df988
Merge pull request #601 from colugomusic/fix-string-args-constness 2021-09-27 11:31:56 +02:00
Rémi Verschelde 0fba89df67
Merge pull request #595 from Calinou/add-license-headers 2021-09-27 11:31:31 +02:00
Colugo bba8393af7 Fix argument constness in String::begins_with, String::ends_with 2021-08-22 16:02:14 +01:00
Hugo Locurcio cf5428e103
Add license headers to all source and header files
This is consistent with the core Godot source code, and ensures the
license isn't detached from its original code when individual files
are distributed.
2021-08-02 18:34:58 +02:00
Hugo Locurcio abab0715a0
Remove extraneous Error enum values that were removed in Godot 3.0 2021-08-02 18:23:41 +02:00
Mai Lavelle 2f534ddd88 Fix typo in CRASH_COND leading to unexpected continuation after fail 2021-08-01 17:20:39 -04:00
Aaron Franke 95ff72706d
Add ability to easily register signals with no arguments 2021-07-10 19:23:36 -04:00
Marc fda7ddd158
Merge pull request #567 from DhruvMaroo/string
added String's move constructor and move assignment operator
2021-06-01 23:35:46 +01:00
DhruvMaroo 7a1890345b edited according to clang-format 2021-06-01 23:16:09 +05:30
DhruvMaroo b44b98a94c removed _deleted class member 2021-05-31 09:10:59 +05:30
DhruvMaroo cd05371ce8 added class member, safety check in the destructor 2021-05-31 00:52:36 +05:30
DhruvMaroo 492285f681 changed spaces to tabs 2021-05-30 22:29:41 +05:30
DhruvMaroo 6e662223aa changed spaces to tabs 2021-05-30 22:15:37 +05:30
DhruvMaroo bdc5674ace added move assignment operator 2021-05-30 12:33:40 +05:30
DhruvMaroo 689b5fb98b added mover constructor 2021-05-30 12:30:11 +05:30
DhruvMaroo c296e9210b Revert "Revert "added inverse trigonometric functions in Math.hpp""
This reverts commit 8ef2e4f139.
2021-05-30 12:23:39 +05:30
DhruvMaroo 8ef2e4f139 Revert "added inverse trigonometric functions in Math.hpp"
This reverts commit 5128858b1e.
2021-05-30 12:22:45 +05:30
DhruvMaroo 5128858b1e added inverse trigonometric functions in Math.hpp 2021-05-30 11:45:47 +05:30
kb1000 3fe276c02f
Stop including iostream in Variant.hpp (to produce smaller binaries) 2021-05-23 16:28:11 +02:00
George Marques cba90d6301
Update clang-format to version 11
This is taken from the Godot repository, so formatting is similar. This
updates the style rules as well.

Also fix style in files to conform with this version.
2021-02-28 16:57:34 -03:00
Marc Gilleron 1f7f66d09e Re-added clang-format checks to the CI 2021-02-03 22:04:45 +00:00
Hrishikesh 09df1fc9b5 Removed the redundant functions in CameraMatrix.hpp 2021-02-03 18:55:39 +05:30
Hrishikesh 8558d2360a Removed redundant function definitions in CameraMatrix and used the ones in Math.hpp 2021-02-03 06:32:44 +05:30
Marc Gilleron 4c0763cd88 Revert comment, this raised another warning, and I could not find a pattern that works 2021-01-31 22:36:01 +00:00
Marc b400dba875
Merge branch 'master' into container_leaks 2021-01-31 20:06:56 +00:00
Marc 05ba977cc6
Merge pull request #485 from colugomusic/fix-array-const
Fix constness of Array::find, Array::find_last and Array::rfind
2021-01-31 20:03:47 +00:00
Marc e76efdd3ab
Merge pull request #481 from Zylann/vec_constants
Added missing constants to Vector2, Vector3, Basis and Quat
2021-01-31 20:02:06 +00:00
Marc 18e1b262ff
Merge pull request #480 from Zylann/ref_safer_cast
Use safer casts in Ref<T>
2021-01-31 20:01:12 +00:00
Marc ffcdef965e
Merge pull request #479 from Zylann/fix_math_warnings
Fix some Math warnings
2021-01-31 19:58:10 +00:00
Marc 1aab5e3962
Merge branch 'master' into master 2021-01-31 19:32:56 +00:00
Marc Gilleron fb71edd45b Fix container and string leaks
Some functions return a new instance of such containers,
but instead we made a copy of them, without taking ownership of the
original created by the function.
Now we use a specific constructor taking ownership on the godot_* struct.
2021-01-07 01:05:12 +00:00
Colugo 38c9b624db Fix constness of Array::find, Array::find_last and Array::rfind 2020-12-20 16:53:40 +00:00
Marc Gilleron 8e1cc29c66 Added missing constants to Vector2, Vector3, Basis and Quat 2020-12-08 23:35:17 +00:00
Marc Gilleron 2893c883f8 Use safer casts in Ref<T> 2020-12-08 22:10:59 +00:00
Marc Gilleron deddacd6f7 Fix some Math warnings 2020-12-08 20:47:42 +00:00
Marc 43828ebb39
Merge pull request #459 from Silver1063/master
Added some missing Vector3 functions and Fixed Vector3 slide
2020-12-08 20:00:06 +00:00
Silver1063 96ae052e06 Added missing Vector3 slerp and Vector3 project
Vector3 slerp and Vector3 project were missing from godot cpp so I added them.
2020-10-11 17:31:23 -07:00
Silver1063 a733457285 Update Vector3 slide to match godot implementation
It wasn't the same before and resulted in weird behavior, its better now.
2020-10-11 15:47:01 -07:00
Marc Gilleron 67976ee47d Remove the need to use GODOT_SUBCLASS 2020-09-12 17:38:46 +01:00