Commit Graph

210 Commits (daf8ac1c330839304040fb0ed5e8ff5775980cc3)

Author SHA1 Message Date
David Snopek 3cd3f24150 Ensure that PtrToArg specializations for native structs are used 2023-08-15 17:54:11 -05:00
David Snopek 5eebc6b20c
Merge pull request #1193 from Zylann/version_header
Added generated version header
2023-08-11 10:33:49 -05: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
David Snopek 8bc1c1dbeb Implement `String::resize()` 2023-07-31 15:14:10 -05:00
Marc Gilleron c6b2c82570 Added generated version header 2023-07-26 23:23:56 +01:00
Marc Gilleron 548c758677 Don't cache `null` forever if a singleton isn't available yet
# Conflicts:
#	binding_generator.py
2023-07-22 16:31:28 +01:00
David Snopek efc16b49d9 In generated methods, only construct the method StringName the first time 2023-07-13 13:05:41 -05:00
Daylily-Zeleen 3536803e9e Implement vararg methods of builtin classes. 2023-07-03 17:30:42 +08:00
Rémi Verschelde 130644c061
Merge pull request #1138 from dsnopek/editor-plugins-deinitialize
Automatically remove editor plugins when deinitializing GDExtension
2023-06-19 10:43:34 +02:00
Rémi Verschelde ca78bcf558
Merge pull request #1086 from lucasrafael98/fixes/missing-include-audio-frame
Fix: Include method_ptrcall.hpp on simple structs.
2023-06-19 10:43:10 +02:00
Rémi Verschelde f56f45156b
Merge pull request #1143 from bruvzg/py_utf8
Force UTF-8 encoding in the binding generator script.
2023-06-16 10:30:08 +02:00
bruvzg f1ad719ffc Force UTF-8 encoding in the binding generator script. 2023-06-16 10:41:23 +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 d28a3cbbd5 Automatically remove editor plugins when deinitializing GDExtension 2023-06-13 14:24:33 -05:00
Rémi Verschelde d12cf071bb
Merge pull request #1128 from Mathis-Z/master
Fixing #1127 by making return types of auto-generated functions dynamic
2023-06-08 22:31:51 +02:00
Mathis-Z ac98dd2752 Fixing #1127 by making return types of auto-generated functions dynamic 2023-06-08 20:35:29 +02: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
Rémi Verschelde 2078c00bab
Merge pull request #1114 from dsnopek/editor-plugins
Add support for adding/removing editor plugins
2023-05-26 11:04:35 +02:00
David Snopek e75ebffb70 Add support for adding/removing editor plugins 2023-05-16 22:02:35 -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
Lucas Rafael cb0b105402 Fix: Include method_ptrcall.hpp on simple structs. 2023-04-07 18:53:07 +01:00
Daylily-Zeleen a614f61015 Fix global enum cast and add Varint::Type cast. 2023-02-02 16:42:15 +08:00
bruvzg 37f6e35974
Update typed array API to match "GDScript: Fix typed arrays". 2023-01-31 11:28:55 +02:00
Andy Maloney 2d5e5c0fd6 Binding generator cleanups
- remove unused vars
- fix a few f-strings
- remove f-string notation where not used
2023-01-30 10:57:26 -05:00
Rémi Verschelde f59fd96ab4
Merge pull request #1013 from bruvzg/set_typed_move
Move Array:set_typed to internal GDExtension structure.
2023-01-30 12:31:38 +01:00
bruvzg 40d3cfd97b
Move Array:set_typed to internal GDExtension structure. 2023-01-30 13:27:25 +02: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
George Marques 1c625befa3
Support typed array default values in extension API
The API JSON has changed syntax for default values of typed arrays. This
detects the new format and use initializer lists (currently empty since
the TypedArray class does not support initializer list construction and
default values are always empty arrays).
2023-01-28 14:01:27 -03:00
Дмитрий Сальников 6528c7177f Fixed variant casting for enum and bitfield 2023-01-20 21:10:03 +03:00
Rémi Verschelde 2a9b21e46a
Merge pull request #1004 from asmaloney/remove-unused-ucaps
Remove unused ucaps header
2023-01-19 13:55:29 +01:00
Andy Maloney 67be0c95e1 Remove unused ucaps header
These static structs were being included in every file string.hpp was included in...

Part of #999
2023-01-19 07:15:40 -05:00
bruvzg abca497b72
Expose some low level functions and String operators. 2023-01-19 13:12:21 +02:00
Rémi Verschelde 931f1a3f34
Sync license copyright with upstream GH-70885 2023-01-10 16:15:31 +01:00
Ricardo Buring 47140cdad0 Rename float=64 build option to precision=double
This makes the build system consistent with Godot again.
Also fix CMake build to define REAL_T_IS_DOUBLE when precision=double.
2023-01-09 23:22:03 +01:00
bruvzg 18eed144ca
Fix enum return value size. 2023-01-07 00:48:40 +02:00
Fabio Alessandrelli c0eaadac86
Merge pull request #903 from PapyChacal/build_library
Make build_library=no usable at godot-cpp's root
2022-12-19 23:03:17 +01:00
Emilien Bauer e52d4b6486 Remove gen from emitted files to solve circular dependency with build_library=no.
Use env variable to pass the output dir instead.
Add a CI step to guard regression on this. Clean the generated sources to avoid interfering with next steps.
2022-12-19 21:20:15 +00: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
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
rune-scape d04ce481c4 Add missing String operators 2022-11-20 03:44:54 -05:00
Emmanuel Leblond b6ba0dca13
StringName is working fine with demo \o/ 2022-11-08 21:44:33 +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 5282009121
Fix Variant types displayed as `Nil` in extension_api.json 2022-10-10 00:56:35 +02:00
Mikael Hermansson 40d181d2f3 Bind enums in built-in types and expose bindings for global constants 2022-10-06 11:16:17 +02:00
Rémi Verschelde 1507253bd5 Merge pull request #864 from Zylann/fix_passing_null
Fix passing null to functions taking Object parameters
2022-10-05 10:37:17 +02:00
Rémi Verschelde 50a534bf55 Merge pull request #880 from aaronfranke/struct
Use `struct` instead of `class` for core structures
2022-10-05 10:35:59 +02:00
Rémi Verschelde 91afc08de1 Merge pull request #855 from Zylann/fix_issue854_virtual_methods
Fix deriving a custom class with virtual methods
2022-10-05 10:35:54 +02:00
Aaron Franke 0455f72ede
Use struct instead of class for core structures 2022-10-05 01:46:15 -05:00
bruvzg fb8253c912
Add wrapper function generation for built-in module ↔ godot-cpp interoperability. 2022-09-28 10:04:35 +03:00
Marc Gilleron cd2232eddf Fix passing null to functions taking Object parameters 2022-09-23 21:20:37 +01:00
bruvzg c001d0e5c7
Implement support for typed arrays. 2022-09-23 09:02:00 +03:00
Marc Gilleron 5de2c059d1 Fix deriving a custom class with virtual methods 2022-09-21 19:31:30 +01:00
Fabio Alessandrelli 0b87aaa74c
Merge pull request #838 from PapyChacal/scons-caching
Add options to use scons caching for faster iteration.
2022-09-19 14:51:40 +02:00
Emilien Bauer 8e717acf48 Add options to use scons caching for faster iteration.
Sort the sets in source generation so they are generated consistently between runs; otherwise caching is useless.
2022-09-19 13:32:23 +02:00
Rémi Verschelde d4cef0bd43 Merge pull request #849 from Zylann/const_cast_to
cast_to` for `const Object*`
2022-09-19 09:29:51 +02:00
Marc Gilleron 99c004f689 Add `Object::cast_to` for `const Object*` 2022-09-18 22:23:49 +01:00
Marc Gilleron f8f25980e1 Class constants should be static 2022-09-18 20:58:44 +01:00
Fabio Alessandrelli c263b3e38c Fix get_file_list not returning all generated files.
Adds a CI static check for it.
2022-09-11 21:39:06 +02:00
Aaron Franke 76ad89fe0b
Generate constants in the bindings generator 2022-09-02 21:32:38 -05:00
Rémi Verschelde 1863bd88ad
Merge pull request #703 from AlphaSoftLLC/fix_struct_forward_declaration 2022-08-31 13:04:03 +02:00
bruvzg 91c56a0ad1
Add bindings for Vector4, Vector4i, Projection built-in types. 2022-07-21 09:36:38 +03:00
bruvzg 713b122b84
Add support for BitField hint, sync API files. 2022-07-11 15:00:17 +03:00
Rémi Verschelde bffedfed1e Fix typo in static method binding generator
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-07-08 15:30:23 +02:00
Aaron Franke e5c4351bc7
Unify bits, android_arch, macos_arch ios_arch into arch, support non-x86
Unify arguments and add support for ARM64 and RV64 Linux
2022-06-01 13:00:25 -05:00
bruvzg e06d5cd414
Add double precision build support. 2022-05-04 15:56:35 +03:00
Fabio Alessandrelli fa698ddd12 [Scons] Use builder to track bindings regeneration.
Using a scons Builder we now regenerate the bindings automatically
when the Godot API json or header has changed.

The option to force bindings regeneration (generate_bindings=yes) is
retained.
2022-05-03 10:48:23 +02:00
Fabio Alessandrelli b47dfb6a5c [CI] Add python file format to static checks.
Uses the same version of `black` as godot.
2022-05-02 21:13:56 +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 d9d68550d9
Fix generating static methods without return value. 2022-03-25 14:13:45 +02:00
bruvzg 28027394f5
Add support for static method bindings. 2022-03-22 16:06:13 +02:00
bruvzg 93de1b2b0b
Sync godot-headers and fix build after "Create GDExtension clases for PhysicsServer3D". 2022-03-16 20:33:06 +02:00
Rémi Verschelde 1632322ce0 Update copyright year 2022-03-15 10:17:53 +01:00
bruvzg b8b9a2fad9
Fix return type encoding for ptrcall. 2022-03-09 17:18:21 +02:00
Aaron Franke 101d61b64a
[master] Run black format on SConstruct files and bindings generator 2022-02-26 15:04:11 -06:00
bruvzg e36180f377
Port a bunch of Godot container templates to GDExtension. 2022-02-18 21:07:53 +02:00
Rémi Verschelde 7fa81e798b
Merge pull request #704 from bruvzg/fix_const_ptr 2022-02-16 13:29:29 +01:00
Rémi Verschelde d9111350b9
Merge pull request #699 from bruvzg/enum_and_ptr_binds 2022-02-16 12:32:26 +01:00
bruvzg a8cd21ac07
Fix "const" NativePtr binds. 2022-02-16 11:35:13 +02:00
Nikita Parfenov 309db943e9 Native structures forward declaration fix 2022-02-16 15:29:01 +06:00
bruvzg 7aaab11b0f
Add Variant binders for the generated classes, structs and global enums 2022-02-15 10:47:12 +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
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 b008810c01 Implementing dictionary operators 2021-11-23 19:44:53 +11:00
Bastiaan Olij c2b690439f Implement index operators for Arrays 2021-11-12 14:29:54 +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
Hennadii Chernyshchyk 1f96a0d16c
Use default destructor for Object 2021-09-28 09:59:17 +03:00
Bastiaan Olij d5e0fc8e7c Temporary fix for issue in JSON export with NIL in operators 2021-09-27 23:08:12 +10:00
Hennadii Chernyshchyk 2b1100c878 Use default initialization
{ 0 } initializes only first element with zero explicitly and other
elements with their default value (zeros too). Technically it will work
the same, but will be more correct.
2021-09-27 23:08:11 +10:00
Bastiaan Olij 7a2a7ea9e4 Add virtual destructor to Object class 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
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 3a5bd21092 Always convert float to double 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk e8030ed1cf Fix print file list 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk b7f03837a2 Fix return type check for variadic functions 2021-09-27 23:08:09 +10:00