104 Commits

Author SHA1 Message Date
Fabio Alessandrelli
8d4de1b537
Merge pull request #677 from lukas-toenne/fix_object_ptr_args
Fixed pointer indirection in the PtrToArg template for Object arguments.
2022-07-29 01:17:34 +02:00
DNKpp
95574c1b11 fix: Object::cast_to checks provided object for nullptr 2022-07-26 00:41:57 +02:00
bruvzg
91c56a0ad1
Add bindings for Vector4, Vector4i, Projection built-in types. 2022-07-21 09:36:38 +03:00
Rémi Verschelde
8772a7faca
Merge pull request #686 from ondy-personal/patch-1 2022-07-18 15:48:17 +02:00
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
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
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
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
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
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
ef528d3a86 Rename interface to gdn_interface because it's a defined keyword under windows 2021-10-28 19:44:20 +11: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
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
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
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
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
Karroffel
cf30b0f39d rewrote binding generator in python 2017-05-12 21:53:07 +02:00
Karroffel
ac51c7b141 moved includes out of namespace 2017-04-18 00:38:09 +02:00
Karroffel
005b9aa148 String.c_string() now returns char * 2017-04-11 15:48:26 +02:00
Karroffel
5e3b01f0f1 some NodePath fixes and better handling of Object type arguments 2017-04-06 02:32:24 +02:00
Karroffel
8aaef5a6a2 use pointers for objects, default arguments 2017-04-05 01:00:33 +02:00
Karroffel
7fa7f7b9c5 added operator overload for string 2017-03-18 15:23:28 +01:00
Karroffel
8d63048c6d Windows compatibility 2017-03-15 23:19:58 +01:00
Karroffel
bce9ac109d mistakes were made. I undid them. 2017-03-15 18:13:29 +01:00
Karroffel
575bb7f339 reworked object system a little bit 2017-03-09 03:03:21 +01:00