Commit Graph

210 Commits (daf8ac1c330839304040fb0ed5e8ff5775980cc3)

Author SHA1 Message Date
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
Bastiaan Olij dd72ce151a Remove unused import that breaks on windows 2021-09-27 23:08:09 +10:00
George Marques 9d4e51011a Properly encode numeric POD types 2021-09-27 23:08:09 +10:00
George Marques f19bb9f57c Add copy/move constructors and assignment op to builtin types 2021-09-27 23:08:09 +10:00
George Marques 3a9ff8de7a Add support for engine singletons
Use, e.g. Engine::get_singleton() to get the singleton object();
2021-09-27 23:08:09 +10:00
George Marques feafe0da36 Fix build with native structs 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 83ef64079b
bindgen: Properly escape NodePath in default args 2021-09-27 12:41:46 +02:00
Raul Santos 54c2d23572 Escape parameters named `enum`.
Prefix parameters named `enum` with an underscore like all the other
reserved keywords.
2021-09-22 16:07:23 +02:00
Fabio Alessandrelli 024ffef50f Fix binding when default parameter is a PoolByteArray.
Like done for the other pool array types.
2021-07-17 18:06:50 +02:00
Hristo Stamenov 476a870d6c
Fix CMake generation on Windows (#536) 2021-05-15 22:57:05 +02:00
Matteo De Carlo 0c8dd096c4 Fix cmake source file generation 2021-03-03 19:40:54 +01:00
Marc Gilleron 67976ee47d Remove the need to use GODOT_SUBCLASS 2020-09-12 17:38:46 +01:00
Marc 824f4ef481
Merge pull request #416 from DuncanSparks/template_get_node
Add option to generate template version of Node::get_node
2020-08-23 20:28:44 +01:00
Duncan Sparks a2ebc8bbec
Update binding_generator.py 2020-08-23 10:30:27 -07:00
Duncan Sparks bd72bd4d68
Fix redundant check in binding_generator.py 2020-08-23 09:01:23 -07:00
sheepandshepherd 33f9de16e4 Use godot_object_cast_to instead of TagDB to cast engine types 2020-08-17 00:05:57 +02:00
Duncan Sparks 2b14529de6
Merge branch 'master' into template_get_node 2020-08-16 14:50:32 -07:00
Marc Gilleron 251062c9a5 Don't use Ref<T> in Object.hpp 2020-07-28 20:28:13 +01:00
Duncan Sparks 3b16f34d89
Add option for template get_node 2020-06-17 15:34:49 -07:00
Daniel Rakos 01606fa212 Optimizations to the generated bindings
This change gets rid of the call-time method binding query, instead it queries
all method bindings up-front at initialization time so that no extra cost is
added at function call time.

In addition, also converted the "icall" code to a header-only library so one
level of unnecessary call-stack is eliminated.

Also changed binding generator to use real_t instead of double everywhere
(except at the GDNative interface where unfortunately using doubles is hard-coded
on the engine side).

All this comes at a minimal increase in binary size (for the library, as actual
native modules might not even increase in size in practice).
2019-04-10 16:51:51 +02:00
Hugo Locurcio 976a188837
Fix and improve the build system
- Fix automatic architecture detection
- Fix compiling with MinGW on Linux
  - MinGW on Windows is still not working though
- Default to Clang on macOS
- Remove redundant `use_custom_api_file` option
- Format SConstruct using Flake8

This closes #245.
2019-04-07 15:40:49 +02:00
David Castro 30500632b1 escape 'typename' keyword, which is causing errors when generating bindings 2019-02-03 17:55:16 -08:00
bruvzg be5a012ff7
Fix NULL dereferencing in get_from_variant and cast_to 2018-11-26 08:11:31 +02:00
bruvzg 715d1dc82b
Fix passing NULL pointers as arguments via ptrcall 2018-11-19 22:40:31 +02:00
bruvzg ec5d718191
Fix TagDB registration for classes with underscore in the name. 2018-11-17 18:25:12 +02:00
bruvzg 700310c8c3
Fix ptrcall passing invalid size int. 2018-11-17 18:23:52 +02:00
karroffel 200bf226bf Nativescript 1.1
implemented instance binding data usage

This commit changes the way C++ wrapper classes work.
Previously, wrapper classes were merely wrapper *interfaces*.
They used the `this` pointer to store the actual foreign Godot
Object.

With the NativeScript 1.1 extension it is now possible to have
low-overhead language binding data attached to Objects.

The C++ bindings use that feature to implement *proper* wrappers
and enable regular C++ inheritance usage that way.

Some things might still be buggy and untested, but the C++
SimpleDemo works with those changes.

new and free change, custom free will crash engine, be wary

fix exporting of non-object types

fix free() crash with custom resources

added type tags and safe object casting

fix global type registration order

fix cast_to

changed build system to be more self contained

updated .gitignore

use typeid() for type tags now

fix indentation in bindings generator

remove accidentally added files

fix gitignore

Fixed up registering tool and updated godot_headers

Fix crash when calling String::split/split_floats

Was casting to the wrong object type.
Also adds parse_ints function to String with the same logic

Better warning/error macros

Change gitignore so we get our gen folders

New documentation based on nativescript 1.1

Fixed GODOT_SUBCLASS macro

Preventing crash when function returned null ptr

Adds needed include <typeinfo>

 Solves this issue #168 due to not having the include of typeinfo

Fix compile error of 'WARN_PRINT' and 'ERR_PRINT'.

cannot pass non-trivial object of type 'godot::String' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs]

update vector3::distance_to

Remove godot_api.json as its now in the godot_headers submodule (api.json)
2018-11-07 21:23:08 +11:00
Thomas Herzog d8becfbe90
Merge pull request #130 from marcelofg55/int_real_arrays
Fix bindings for PoolIntArray and PoolRealArray
2018-05-09 10:22:59 +02:00
Marcelo Fernandez ae38ebc80c fix method calls that take floats/doubles 2018-05-08 21:58:48 -03:00
Marcelo Fernandez 709446da94 Fix bindings for PoolIntArray and PoolRealArray 2018-05-08 21:47:34 -03:00
Nickolai Korshunov ef37d8d76e Merge branch 'master' of https://github.com/GodotNativeTools/godot-cpp 2018-04-25 11:40:49 +03:00
Nickolai Korshunov 876715b610 disable strict enums 2018-04-25 11:39:18 +03:00
danielytics 01db553c49 adds Array::make and Dictionary::make static methods and has variadic template functions use those 2018-03-07 10:27:34 +00:00
danielytics c7b03c4132 make register_signal and auto-generated variadic funcitons use variadic templates to streamline their use 2018-03-06 21:36:20 +00:00
Nickolai Korshunov f1c35f24f6 NULL -> nullptr 2018-02-23 16:08:36 +03:00
Nickolai Korshunov 3f8456135f local deps included with quotes 2018-02-23 15:57:37 +03:00
Nickolai Korshunov e123650d76 Strict enums 2018-02-23 15:50:41 +03:00
Marc Gilleron ac0679eb1a Fix Ref leak when using Godot getters 2018-01-25 20:55:56 +01:00
RameshRavone 4aec7cbf42
Do not include Ref.hpp file in Reference.hpp 2018-01-24 15:18:30 +05:30
Marc Gilleron 3197c3dce3 Rewrite Ref<T> to behave like Godot again 2018-01-22 22:27:10 +01:00
karroffel 2e4de7b67d Don't leak memory from Ref<>() 2018-01-19 11:40:50 +01:00
karroffel 7dde412e26 custom types can now be used as method parameters 2018-01-14 23:03:57 +01:00
Grosskopf 575b2f4d14 Fixed building
without this, the clang command fails
2017-12-11 16:36:03 +01:00
BastiaanOlij 0f773c2d72 Update bindings to use new Api extensions and rename Rect3->AABB 2017-11-23 22:50:05 +11:00
Bastiaan Olij 6452ba6e88 Implemented using api struct 2017-10-23 21:20:14 +11:00
Ramesh Ravone 10bb24cfbc
updated bindings 2017-10-03 16:07:34 +05:30
Maxim Sheronov 8939c663d9 Fix bindings generation for enums 2017-09-13 21:30:30 +03:00
Karroffel c27af379b8 updated to use the new NativeScript and GDNative interface 2017-07-24 17:08:52 +02:00
Karroffel 4769f49cb4 Use static linking instead of dynamic linking 2017-07-23 17:53:50 +02:00
Karroffel 606d2624af new ptrcall number sizes (int64_t and double) 2017-07-23 17:14:50 +02:00
Karroffel e1f3865467 Wohoo, Ref<>s are now working 2017-06-21 02:14:54 +02:00
Karroffel 38f1ee741d some Ref WIP, memory leaks and invalid returns 2017-06-21 00:42:29 +02:00
Karroffel 82165394ca fixed singleton naming thingy 2017-06-20 23:26:22 +02:00
Karroffel ac630353cf [experimental] constructors and Ref<T> 2017-06-19 02:03:59 +02:00
Karroffel ad3720440e removed InputEvent and Image 2017-05-23 23:03:57 +02:00
Karroffel 9caeb8d296 made msvc happier 2017-05-16 09:00:17 +02:00
Karroffel fad8f7c9eb made script "inheritance" less OOP 2017-05-13 13:55:04 +02:00
Karroffel cf30b0f39d rewrote binding generator in python 2017-05-12 21:53:07 +02:00